0

I am working to instrument a .NET Core windows service by adding custom metrics. Here listed in this official documentation are the things that Azure Monitor supports attaching to a custom metric. My goal is to construct a Meter instance and have that meter's name used as the metric namespace within Azure Monitor.

By default my custom metric telemetry that is exported to Azure Monitor when using the Azure.Monitor.OpenTelemetry.Exporter package has this unhelpful metric namespace of "azure.applicationinsights".

Azure Monitor Metrics screenshot showing that my meter name is not available as a metric namespace

Absurdly, when looking at the raw meter data within azure monitor, it appears that the meter name doesn't appear to have been sent or persisted at all.

Here's how I am setting things up early in my application:

builder.Services.AddOpenTelemetry()
    .WithMetrics(metrics => metrics.AddMeter(MyTelemetryConstants.SomeMeterName))
    .UseAzureMonitor(o =>
    {
        o.ConnectionString = builder.Configuration.GetConnectionString("AzureMonitor");
    });

And here's generally how I'm creating metrics:

public class MyAppMeter
{
    // metric sources can use this instrument directly: `appMeter.SomeCounter.Add(1);`
    public Counter<int> SomeCounter { get; }

    public MyAppMeter(IMeterFactory meterFactory)
    {
        // I want `MyTelemetryConstants.SomeMeterName`'s value to be the Metric Namespace within Azure Monitor
        var meter = meterFactory.Create(MyTelemetryConstants.SomeMeterName);
        SomeCounter = meter.CreateCounter<int>("some_counter");
    }
}

What am I missing?

1 Answer 1

0

I just found this github issue and this more specific issue, with a comment which states:

It is currently hardcoded and not available for customization.

It seems that I should not use the recommended azure monitor exporter because it is not feature complete.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.