GoogleCloudPlatform / opentelemetry-operations-go

Apache License 2.0
127 stars 99 forks source link

Question: support for customized cloud.provider #767

Closed shohei-ihaya closed 7 months ago

shohei-ihaya commented 8 months ago

Thanks for the great library.

I have a question about metrics with Cloud Resource Attributes.

I am sending metrics with googlecloud exporter.

If I set the resource attribute by resourcedetection processor with the environment variable OTEL_RESOURCE_ATTRIBUTES="cloud.platform=linode_instance,cloud.provider=linode", the metrics are not displayed in the console.

Without the resource attribute cloud.xxx, metrics will be displayed as generic nodes or generic tasks.

Is the customized cloud.xxx resource attribute not supported?

dashpole commented 8 months ago

Are you using the collector exporter (in collector-contrib), or the in-process metrics exporter (exporter/metrics)?

You should be able to provide those attributes, but we generally use them to map to Monitored Resources in Cloud Monitoring. If you want them to show up explicitly, you can set the resource filter to add them as metric attributes: WithFilteredResourceAttributes

shohei-ihaya commented 8 months ago

Thanks for quick reply.

I'm using collector exporter (in collector-contrib).

If you want them to show up explicitly, you can set the resource filter to add them as metric attributes: WithFilteredResourceAttributes

I understand, I will try. thanks!

aabmass commented 7 months ago

@shohei-ihaya did that solve your problem?

shohei-ihaya commented 7 months ago

@aabmass Actually no. I gave up storing customized values in resource parameter, and now I store them in metric attributes

aabmass commented 7 months ago

I believe the option David mentioned should do that for you automatically if that's easier.

To be clear, Cloud Monitoring has strict schema for monitored resource and can only store the predefined keys. If you want other resource attributes, they have to be put as metric attributes for now. Given that you got it working that way, I'm going to close as "working as intended". Feel free to re-open if needed