dotnet / dotnet/aspnetcore

Logging scope opt-out

Open
#53,879 0 comments 4 reactions 0 assignees View on GitHub
area-networking
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 5h
Merged PRs (30d)
276

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

We have a feature in OpenTelemetry .NET which allows users to capture logging scopes which may be active when a log is emitted: https://github.com/open-telemetry/opentelemetry-dotnet/blob/752778270def63bc710f286856cc9ffe48e7bf39/src/OpenTelemetry/Logs/ILogger/OpenTelemetryLoggerOptions.cs#L36

OTel exporters typically ship off scope KVPs with all the KVPs taken from the logged `TState`: https://github.com/open-telemetry/opentelemetry-dotnet/blob/752778270def63bc710f286856cc9ffe48e7bf39/src/OpenTelemetry/Logs/LogRecordScope.cs#L44

A user raised this issue: https://github.com/open-telemetry/opentelemetry-dotnet/issues/5239

They are asking for a filtering mechanism because some of the data currently automatically added by AspNetCore (for example ConnectionId) isn't very useful but they do want to capture their own scopes.

/cc @JamesNK @cijothomas

### Describe the solution you'd like

I don't know if we _need_ a solution, but the question is should we expose some settings to allow users to opt-out of these scopes or perhaps some of the values they emit?

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.