Skip to content

[Exporter.Prometheus] Possibility to disable otel_scope attributes #5725

@Kielek

Description

@Kielek

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

# EOF

After (with no Accept header):

# 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
# EOF

After (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
# EOF

Merge requirement checklist

  • CONTRIBUTING guidelines followed (nullable enabled, static analysis, etc.)
  • Unit tests added/updated
  • Appropriate CHANGELOG.md files 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 #5086 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions