Skip to content

[QUERY] Enriching activity using the current request #41147

@safakgur

Description

@safakgur

Library name and version

Azure.Monitor.OpenTelemetry.AspNetCore 1.0.0

Query/Question

I use Azure.Monitor.OpenTelemetry.AspNetCore 1.0.0 to add OTel HttpClient instrumentation and Azure Monitor exporter.

On 1.0.0-beta.7, I was able to do the following:

services.Configure<AspNetCoreInstrumentationOptions>(opts =>
{
    opts.EnrichWithHttpRequest = (activity, httpRequest) =>
    {
        // Use `httpRequest` to add tags to `activity`
    };
});

But with the new version, AspNetCoreInstrumentationOptions is made internal.

So, what's the new, recommended way of enriching the request activity?

One alternative I've been experimenting with is moving away from this do-it-all package to the following, more granular packages:

  • OpenTelemetry.Instrumentation.AspNetCore (comes with a public AspNetCoreTraceInstrumentationOptions class)
  • Azure.Monitor.OpenTelemetry.Exporter
  • OpenTelemetry.Extensions.Hosting

...but I'd rather keep this one if it provides the same features.

Environment

Windows 10 .NET 8.0.100
Visual Studio 17.8.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    ClientThis issue is related to a non-management packageMonitorMonitor, Monitor Ingestion, Monitor QueryService AttentionWorkflow: This issue is responsible by Azure service team.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions