Skip to content

[feature request] AddAspNetCoreInstrumentation After Routing Filter #2788

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

Open
Kharlap-Sergey opened this issue May 11, 2025 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@Kharlap-Sergey
Copy link

Kharlap-Sergey commented May 11, 2025

Component

OpenTelemetry.Instrumentation.AspNetCore

Is your feature request related to a problem?

In AspNetCoreTraceInstrumentationOptions we have Filter configuration
but

Filter = context => {
  var endpoint = context.GetEndpoint(); //Endpoint is null here
  ...
};

What is the expected behavior?

Expected

AfterRoutingFilter = context => {
  var endpoint = context.GetEndpoint(); //Endpoint is !not null!
  ...
};

Why?
Working with Endpoint Metadata is a standard in the Asp community.
So we can achieve something same we have with AllowAnonymous

   // Decompiled with JetBrains decompiler
   public static TBuilder AllowAnonymous<TBuilder>(this TBuilder builder) where TBuilder : IEndpointConventionBuilder
    {
      ref TBuilder local = ref builder;
      if ((object) default (TBuilder) == null)
      {
        TBuilder builder1 = local;
        local = ref builder1;
      }
      local.Add((Action<EndpointBuilder>) (endpointBuilder => endpointBuilder.Metadata.Add((object) AuthorizationEndpointConventionBuilderExtensions._allowAnonymousMetadata)));
      return builder;
    }

Which alternative solutions or features have you considered?

Additional context

No response

@Kharlap-Sergey Kharlap-Sergey added the enhancement New feature or request label May 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant