opentelemetry-dotnet
opentelemetry-dotnet copied to clipboard
[Exporter.Prometheus] Possibility to disable otel_scope attributes
Fixes #3972
Changes
Add instrument scope info and version to Prometheus exporter as per https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/compatibility/prometheus_and_openmetrics.md#instrumentation-scope-1
Scope info is automatically added to the Prometheus exporters.
Before this change:
# TYPE MyFruitCounter_total counter MyFruitCounter_total{color="red",name="apple"} 66 1702578315791 MyFruitCounter_total{color="yellow",name="lemon"} 77 1702578315791 MyFruitCounter_total{color="green",name="apple"} 22 1702578315791 # EOFAfter (with no
Acceptheader):# TYPE otel_scope_info info # HELP otel_scope_info Scope metadata otel_scope_info{otel_scope_name="MyCompany.MyProduct.MyLibrary"} 1 # TYPE MyFruitCounter_total counter MyFruitCounter_total{otel_scope_name="MyCompany.MyProduct.MyLibrary",otel_scope_version="1.0",color="red",name="apple"} 102 1702577575197 MyFruitCounter_total{otel_scope_name="MyCompany.MyProduct.MyLibrary",otel_scope_version="1.0",color="yellow",name="lemon"} 119 1702577575197 MyFruitCounter_total{otel_scope_name="MyCompany.MyProduct.MyLibrary",otel_scope_version="1.0",color="green",name="apple"} 34 1702577575197 # EOFAfter (when passing
Accept: application/openmetrics-text:# TYPE otel_scope_info info # HELP otel_scope_info Scope metadata otel_scope_info{otel_scope_name="MyCompany.MyProduct.MyLibrary"} 1 # TYPE MyFruitCounter_total counter MyFruitCounter_total{otel_scope_name="MyCompany.MyProduct.MyLibrary",otel_scope_version="1.0",color="red",name="apple"} 4692 1702577811.302 MyFruitCounter_total{otel_scope_name="MyCompany.MyProduct.MyLibrary",otel_scope_version="1.0",color="yellow",name="lemon"} 5474 1702577811.302 MyFruitCounter_total{otel_scope_name="MyCompany.MyProduct.MyLibrary",otel_scope_version="1.0",color="green",name="apple"} 1564 1702577811.302 # EOFMerge requirement checklist
- [x] CONTRIBUTING guidelines followed (nullable enabled, static analysis, etc.)
- [x] Unit tests added/updated
- [x] Appropriate
CHANGELOG.mdfiles updated for non-trivial changes- [ ] Changes in public API reviewed (if applicable)
Hi guys, It’s cool, of course, that you added this a feature, but looks like that manuals describes the ability for the exporter to disable this feature
https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/compatibility/prometheus_and_openmetrics.md#instrumentation-scope-1
Prometheus exporters SHOULD provide a configuration option to disable the otel_scope_info metric and otel_scope_ labels.
Originally posted by @ezhdn in https://github.com/open-telemetry/opentelemetry-dotnet/issues/5086#issuecomment-2192642249
@ezhdn, @robertcoltheart, would you like to contribute to this?
I'll think about it, depends on time, but looks interesting
Are there any updates? I'm losing my mind on this
@LucaTheHacker, would you like to contribute to fix this problem?
@Kielek surely I can.
I'll send a PR soon!