-
Notifications
You must be signed in to change notification settings - Fork 848
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prometheus Exporters do not interact with Resource attributes #4046
Comments
Hi @yangtaoran - there is currently not any support for mapping resource properties into metric attributes for Prometheus exporter. Are you using the prometheus exporter in this repository or are you using the OpenTelemetry collector? Currently I believe the way to achieve what you want is to use |
I am using the prometheus exporter in this repository. So what can do for the SdkMeterProviderBuilder setResource method?According to you, I can use OTLP to export metrics data to the collector, and the collector configure prometheus exporter with |
Yup I think using OTLP exporter from SDK to collector and using that setting is probably the best bet for now. We need to think of how to better support this in the SDK natively. |
I think It's necessary that the Prometheus exporter from SDK should export metrics data with resource.Although I can do like above,it's complicated.If it is possible,I can push a PR. |
@yangtaoran The prometheus exporter is not fully specified in OTEL yet. I fully expect resource -> prometheus labels to part of that final specification, but we're still discussing the details of what would be done in SDKs. You can see:
@anuraaga's workaround should be good for now, but expect improvements in the SDK-exporter going forward. |
https://github.com/open-telemetry/opentelemetry-java/blob/main/sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/SdkMeterProviderBuilder.java#L56
Here,I set setResource to all meter.I think all metrics will add attributes from the resource,but it not.
I init SdkMeterProvider by follow:
I scrap the metrics like this:
I think it will be ”meter_test_total{hello="world",instance="xxxx"} 1.0 1641357854770”
The text was updated successfully, but these errors were encountered: