Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OTEL_SEMCONV_STABILITY_OPT_IN=http doesn't enable new metric convention #4951

Closed
karataliu opened this issue Oct 14, 2023 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@karataliu
Copy link

Bug Report

List of all OpenTelemetry NuGet
packages
and version that you are
using (e.g. OpenTelemetry 1.0.2):

    <PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.6.0" />
    <PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.5.1-beta.1" />

Runtime version (e.g. net462, net48, netcoreapp3.1, net6.0 etc. You can
find this information from the *.csproj file):
net7.0

Symptom

Setting OTEL_SEMCONV_STABILITY_OPT_IN=http doesn't turn on http.server.request.duration

See repro below.

What is the expected behavior?

filter:'http.server.request.duration'

What is the actual behavior?

filter:'http.server.duration'

Reproduce

Repro code:

using System.Reflection;
using OpenTelemetry.Instrumentation.AspNetCore;
using OpenTelemetry.Metrics;

Environment.SetEnvironmentVariable("OTEL_SEMCONV_STABILITY_OPT_IN", "http");
var hscField = typeof(AspNetCoreMetricsInstrumentationOptions)
    .GetField("HttpSemanticConvention", BindingFlags.NonPublic | BindingFlags.Instance);
var builder = WebApplication.CreateBuilder(args);
builder.Services
    .AddOpenTelemetry()
        .WithMetrics(b =>
        {
            b.AddAspNetCoreInstrumentation(o1 => {
                Console.WriteLine("convention:'{0}'", hscField.GetValue(o1));
                o1.Filter = (a, _) =>
                {
                    Console.WriteLine("filter:'{0}'", a);
                    return true;
                };
            });
        });
builder.Build().Run();

output:

convention:'New'
filter:'http.server.duration' # upon any request, should be 'http.server.request.duration' since convention is new?
@karataliu karataliu added the bug Something isn't working label Oct 14, 2023
@vishweshbankwar
Copy link
Member

@karataliu This change is not yet released. if you set OTEL_SEMCONV_STABILITY_OPT_IN=http then you should get new tags with metric name as http.server.duration. Next release should include the change you are expecting i.e. the metric will be emitted as http.server.request.duration.

Also, I notice you are using filter. FYI open-telemetry/opentelemetry-dotnet-contrib#1733

@karataliu
Copy link
Author

Thanks @vishweshbankwar for the info.

i'm using filter to repro the issue only for now, thanks for the heads up.

I thought https://github.com/open-telemetry/opentelemetry-dotnet/tree/1.5.1-beta.1 has the change but actually not. Looks like it's in #4802

Looking forward for the new release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants