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

Tracing is broken when AspNetCore integration is used #2875

Open
lmolkova opened this issue Nov 19, 2024 · 5 comments
Open

Tracing is broken when AspNetCore integration is used #2875

lmolkova opened this issue Nov 19, 2024 · 5 comments
Labels
Needs: Triage (Functions) potential-bug Items opened using the bug report template, not yet triaged and confirmed as a bug

Comments

@lmolkova
Copy link
Member

lmolkova commented Nov 19, 2024

Description

I configure ASP.NET Core integration along with OTel in the following way

var host = new HostBuilder()
    .ConfigureFunctionsWebApplication()
    .ConfigureServices(s => s.AddOpenTelemetry()
        .WithTracing(t => t
                .AddSource("testme")
                .AddAspNetCoreInstrumentation()
                .AddHttpClientInstrumentation())
    .UseFunctionsWorkerDefaults()
    .UseOtlpExporter())
    .Build();

and enable host telemetry with

"telemetryMode": "openTelemetry"

In my function code I create another activity

[Function("Function1")]
public async Task<HttpResponseData> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post")] HttpRequestData req)
{
    using var act = test.StartActivity("THIS IS A TEST");
    _logger.LogInformation("C# HTTP trigger function processed a request.");

    var response = req.CreateResponse(HttpStatusCode.OK);
    response.Headers.Add("Content-Type", "text/plain; charset=utf-8");

    await response.WriteStringAsync("Welcome to Azure Functions!");

    return response;
}

What I get:

Image

I.e.

  • GET - incoming HTTP request to host
    • GET - outgoing HTTP request from host to worker
      • TestFuncs GET api/Function1 - incoming request on worker tracked by ASP.NET Core and OTel instrumentation on the worker
    • THIS IS A TEST generated within Function1 execution. It's a child of the incoming request to host - this is the problem

What I expect

  • GET - incoming HTTP request to host
    • GET - outgoing HTTP request from host to worker
      • TestFuncs GET api/Function1 - incoming request on worker tracked by ASP.NET Core and OTel instrumentation on the worker
        • THIS IS A TEST generated within Function1 execution. It's a child of the incoming request to worker

Steps to reproduce

Related to #2733

@jviau
Copy link
Contributor

jviau commented Nov 19, 2024

Are you using AspNetCore integration here?

@lmolkova
Copy link
Member Author

Yes, it's configured in ConfigureFunctionsWebApplication()

@jviau
Copy link
Contributor

jviau commented Nov 19, 2024

This is a known issue we are working on for AspNetCore integration. We have AspNetCore and Functions pipelines both creating their own activity to track this work and those two pipelines are disjointed, causing the correlation issue.

@lmolkova
Copy link
Member Author

Awesome, feel free to close if it's a duplicate

@jviau
Copy link
Contributor

jviau commented Nov 22, 2024

Awesome, feel free to close if it's a duplicate

I am not sure if we have a different issue tracking this. I will leave this open until I find that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Triage (Functions) potential-bug Items opened using the bug report template, not yet triaged and confirmed as a bug
Projects
None yet
Development

No branches or pull requests

2 participants