I’m pushing some metrics created via the opentelemetry-python
sdk into Grafana Cloud via the OpenTelemetry Collector otlp
receiver and otlphttp
exporter.
I’ve familiarized myself with most details on how OTLP metrics are converted to Prometheus-style metrics I can view from Grafana Cloud by reading:
- OTLP: OpenTelemetry Protocol format considerations | Grafana Cloud documentation
- Configure the OpenTelemetry Collector to write metrics into Mimir | Grafana Mimir documentation
- Prometheus and OpenMetrics Compatibility | OpenTelemetry
but I still have one point of confusion, which is what happens to the instrumentation scope of my metrics.
According to the specification at the above link,
Prometheus exporters SHOULD generate an Info-typed metric named
otel_scope_info
for each Instrumentation Scope with non-empty scope attributes …
Prometheus exporters MUST add the scope name as theotel_scope_name
label and the scope version as theotel_scope_version
label on all metric points by default, based on the scope the original data point was nested in.
If I configure a ConsoleMetricExporter
for my test application, I can see
{
"resource_metrics": [
[...]
"scope_metrics": [
{
"scope": {
"name": "test.meter.name",
"version": "0.1",
"schema_url": "",
"attributes": null
},
"metrics": [
[...]
]
}
Is there a way to query that information from hosted metrics/mimir? I don’t see a otel_scope_name
label on my metric or an otel_scope_info
info metric, but I could very well be misunderstanding the specification. Thanks for your help!
My opentelemetry-collector config is very simple, but here it is in case it’s relevant:
extensions:
basicauth/grafana_cloud:
client_auth:
username: ${env:GRAFANA_USER}
password: ${env:GRAFANA_PASSWORD}
receivers:
otlp:
protocols:
grpc:
processors:
batch:
exporters:
otlphttp/grafana_cloud:
endpoint: "https://otlp-gateway-prod-eu-west-2.grafana.net/otlp"
auth:
authenticator: basicauth/grafana_cloud
service:
extensions: [basicauth/grafana_cloud]
pipelines:
metrics:
receivers: [otlp]
processors: [batch]
exporters: [otlphttp/grafana_cloud]