Closed jsirianni closed 1 year ago
What platform (GCE (VMs), GKE, cloud run, etc.) are you running on?
I would highly encourage you to use the gcp
resource detector. It is designed to detect the resource attributes required to map to the correct monitored resource based on the platform. Neither generic_node or generic_task are ideal.
Outside of GCP. We are supporting customers who are migrating to GCP and have workloads running onpremis and in other clouds. The Google team has always instructed us to send to workload apis + generic_node.
Ah, I would recommend removing the service instance id attribute (with the resource processor) in that case. It isn't as useful since it is a local target.
It would be nice to keep it considering it is called out in the semantic conventions and expected by users using the Prometheus receiver. https://opentelemetry.io/docs/reference/specification/resource/semantic_conventions/#service.
Would it be possible to map to generic_node if host.name
is set? It seems like the exporter could check for generic_node first, as host.name
(node_id) is not used by generic_task.
When using the prometheus server to monitor non-local applications, i'd argue generic_task is the right monitored resource (since we don't know the host name of the application we are scraping). But for local prometheus targets, you are right that generic_node is preferable.
If we changed the order, that would be breaking for users, so i'd like to avoid doing that if possible. Another option for you would be to use resource_filters
to match net.host.port
. That would provide the important piece of information from the instance id you are using. Alternatively, we could add configuration to allow influencing monitored resource selection via config.
In this case, service.instance.id is the hostname:port of the instance being scraped. In my example I am scraping local host but I could scrape one or many remote IP / hostnames.
Would it be appropriate to rename service.instance.id to host.name?
Ideally, it would be set to <host IP>:<port>
to be closer to what you would get from a prometheus server scraping it, but <host.name>:<port>
, or <host.id>
are also reasonable things to do.
I'd like to classify this issue as either bug/enhancement/wontfix etc.
From what I can tell on this discussion:
As such I'm going to mark this as a feature request for #2. Feel free to update classification if this is wrong.
Sorry, I had formatting errors above. I think overriding service.instance.id with the host IP + port or host name + port is a better option than sending to generic_node, and should be possible with the transform processor.
Problem
I am scraping Prometheus metrics (Aerospike exporter) using the Prometheus receiver. The google exporter is mapping these metrics to
generic_task
monitored resource type when I would expect it to map togeneric_node
.This is because Prometheus exporter sets the following resource labels
job
field)taskID
field)Resource labels (From logging exporter)
Expected Behavior
I would expect to map Prometheus metrics to
generic_node
. The description for Generic Task does not match Prometheus metrics:The description for
generic_node
makes more sense in my opinion:I have considered renaming service.name and service.instance.id, however, Open Telemetry Semantic Conventions encourage their use.
Environment
Collector: opentelemetry-collector-contrib.jsirianni main branch and v0.53.0
Configuration:
Mapping code