Skip to content

[OpenTelemetry] ASP.NET Core 11 does not fully implement the HTTP server semantic conventions #65873

@martincostello

Description

@martincostello

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

From working on open-telemetry/opentelemetry-dotnet-contrib#3808 as a follow-up to #64851, there are two parts (conditionally) required of the OpenTelemetry Semantic conventions for HTTP spans.

/cc @JamesNK


The first is the url.query attribute which is conditionally required. This is noted in the code already:

// The tags here are set when the activity is created. They can be used in sampling decisions.
// Most values in semantic conventions that are present at creation are specified:
// https://github.com/open-telemetry/semantic-conventions/blob/27735ccca3746d7bb7fa061dfb73d93bcbae2b6e/docs/http/http-spans.md#L581-L592
// Missing values recommended by the spec are:
// - url.query (need configuration around redaction to do properly)

To properly implement the specification, some sort of configuration surface needs to be designed to allow it to be configured and have sensible built-in defaults for redaction.

See #64850 and #65369.

There's some prior art for implementing this also in the HttpClient instrumentation for the url.full attribute (DiagnosticsHandler.SendAsyncCore() and UriRedactionHelper).


The second is support for providing a way to override the list of known values for http.request.method. For example, the OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS is one way of doing this. This would also require a configuration surface needs to be designed to allow it to be configured and have sensible built-in defaults for redaction.

The second could be argued to be optional if HTTP QUERY is fully supported (see #63276, #65489, #65714).

There was a similar discussion around that for HttpClient's instrumentation, and they decided to not implement it: dotnet/runtime#123936 (comment)

Expected Behavior

ASP.NET Core 11 implements all (conditionally) required parts of the OpenTelemetry Semantic conventions for HTTP spans.

Steps To Reproduce

Compare ASP.NET Core 11 preview 2 OpenTelemetry trace attributes against the semantic conventions (e.g. with the Aspire dashboard).

Exceptions (if any)

No response

.NET Version

11.0.100-preview.2.26159.112

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions