Skip to content

HttpClient outgoing logging: default-filled RequestMetadata yields path="unknown" instead of "REDACTED" #7536

@ssmelov

Description

@ssmelov

Description

When RequestMetadata is attached to an outgoing HttpRequestMessage but RequestRoute and RequestName are left at their default values (TelemetryConstants.Unknown), HttpRequestReader.GetRedactedPathAndParameters emits path = "unknown" instead of scrubbing it to "REDACTED". The no-metadata branch already returns "REDACTED" for the same underlying situation (URL present, no route template to safely scrub sub-parts), so the two cases should converge.

This affects callers who attach RequestMetadata only to set unrelated fields (e.g. DependencyName) — they end up with misleading "unknown" in their logs rather than the conservative scrub the framework already produces when no metadata is attached.

Reproduction Steps

request.SetRequestMetadata(new RequestMetadata { DependencyName = "Graph" });
// → path is logged as "unknown"

Expected behavior

GetRedactedPathAndParameters sets logRecord.Path to TelemetryConstants.Redacted — same as when no RequestMetadata is attached.

Actual behavior

GetRedactedPathAndParameters sets logRecord.Path to "unknown" — it falls back to RequestMetadata.RequestName, which is TelemetryConstants.Unknown by default, leaking that string into the Path dimension.

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-telemetrybugThis issue describes a behavior which is not expected - a bug.untriaged

    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