Skip to content

Instrument tags not attached #5478

Open
@YarinOmesi

Description

What are you trying to achieve?

System.Diagnostics.DiagnosticSource v8.0 introduced the ability to instantiate an insrument with tags. for example Counter with tags.

Using System.Diagnostics.DiagnosticSource v8.0, when creating and exporting a counter with tags, I expect tags declared in an instrument will be attached and be exported (in prometheus).

Example Code:

Meter meter = new Meter("MyMeter", "1.0");

TagList counterTags = new TagList() {
    {"counter_tag", true}
};

Counter<long> myCounter = meter.CreateCounter<long>("myCounter", null, null, counterTags);

MeterProvider meterProvider = Sdk.CreateMeterProviderBuilder()
    .AddMeter("MyMeter")
    .AddConsoleExporter()
    .AddPrometheusHttpListener(options => options.UriPrefixes = new []{"http://localhost:9000"})
    .Build();

myCounter.Add(1);

meterProvider.Dispose();

What did you expect to see?

I expect tags declared in an instrument will be attached and be exported (in prometheus).

Actual output, without the instrument tags

# TYPE myCounter_total counter
myCounter_total 1 1706978095318

# EOF

Additional context.

Discussed In #5313

Relevant docs:
https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/docs/metrics#metrics-enrichment

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestmetricsMetrics signal related

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions