Skip to content

HTTP client metrics: url.scheme should be opt-in, server.port should be required #94829

Description

@lmolkova

Description

OTel HTTP semconv made the last-minute change open-telemetry/semantic-conventions#459 before stability and now HTTP client metrics are not fully aligned with the spec (sorry).

Even though it's a pretty minor difference it'd be nice to align with the OTel spec at some point.

Reproduction Steps

N/A

Expected behavior

  • url.scheme is now opt-in, so should be set when explicitly enabled (or not set at all)
  • server.port should be set even when it has a default value

Actual behavior

scheme is always set, port is set when not default.

tags.Add("url.scheme", requestUri.Scheme);
tags.Add("server.address", requestUri.Host);
// Add port tag when not the default value for the current scheme
if (!requestUri.IsDefaultPort)
{
tags.Add("server.port", requestUri.Port);
}

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

Labels

area-System.Net.Httpin-prThere is an active PR which will close this issue when it is merged

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions