Skip to content

[BUG] Azure.Monitor.OpenTelemetry.Exporter does not export Pathbase #53609

@ionmincu

Description

@ionmincu

Library name and version

Azure.Monitor.OpenTelemetry.Exporter 1.3.0-beta

Describe the bug

I've added http.url and url.full but I do not see the full url with patbase in requests table

        builder.Services.Configure<AspNetCoreTraceInstrumentationOptions>(options =>
        {
            options.EnrichWithHttpResponse = (activity, httpResponse) =>
            {
                // remove query string as it may contain sensitive data 
                activity.SetTag("url.query", string.Empty);
 
                // add this at the end to override with Forwarded headers if present
                var request = httpResponse.HttpContext.Request;
                activity.SetTag("server.address", request.Host.Host);
                activity.SetTag("server.port", request.Host.Port);
                activity.SetTag("url.scheme", request.Scheme);
                activity.SetTag("url.full", $"{request.Scheme}://{request.Host}{request.PathBase}{request.Path}");
                activity.SetTag("http.url", $"{request.Scheme}://{request.Host}{request.PathBase}{request.Path}");
            };
        });

Expected behavior

See full url including pathbase

Actual behavior

I only see $"{request.Scheme}://{request.Host}{request.Path}");

Reproduction Steps

Create a webapp with app.UsePathBase(/mypath) and make requests to /mypath/api/controller you will only see http://server/api/controller

Environment

No response

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