Skip to content

[feature request] Sending service custom dimensions on Microsoft.Data.SqlClient.EventSource #3113

@gustavodaquino

Description

@gustavodaquino

Component

OpenTelemetry.Instrumentation.EventCounters

Is your feature request related to a problem?

When using [email protected] together with [email protected], the custom dimensions service.name and service.instance.id are not being sent with the metrics.

Minimal setup to reproduce:

builder.Services.AddOpenTelemetry()
    .UseAzureMonitor()
    .WithMetrics(metrics =>
    {
        metrics.AddEventCountersInstrumentation(options =>
        {
            options.AddEventSources("Microsoft.Data.SqlClient.EventSource");
        });
        metrics.AddView(
            instrumentName: "Microsoft.Data.SqlClient.EventSource",
            new MetricStreamConfiguration
            {
                TagKeys = ["service.name", "service.instance.id"]
            }
        );
    });

What is the expected behavior?

Both service.name and service.instance.id should be sent as custom dimensions on customMetrics bucket, on Azure Monitor.

Which alternative solutions or features have you considered?

I tried unsuccessfully to send them manually, using the extension method AddView.

Additional context

No response

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions