open-telemetry / opentelemetry-dotnet

The OpenTelemetry .NET Client
https://opentelemetry.io
Apache License 2.0
3.23k stars 765 forks source link

[feature request] Log sampling #5813

Closed alrz closed 2 months ago

alrz commented 2 months ago

Package

OpenTelemetry

Is your feature request related to a problem?

dotnet is currently exploring adding log sampling at https://github.com/dotnet/extensions/issues/5123 but since sampling mechanism is already present in otel (only for traces afaik) I think it makes sense to have feature parity between the two.

What is the expected behavior?

I think on the surface this would look like just what we have for traces, ie SetSampler on the logger options.

Which alternative solutions or features have you considered?

-

Additional context

No response

cijothomas commented 2 months ago

OTel Logs have no concept of sampling. We will add one here, once it is introduced in the OTel spec. I am not aware of any work occurring in OTel spec world to support this.

Users can still write FilteringLogRecordProcessors to achieve the same goals and this is not prohibited by the spec.

ILogger can add sampling/advanced-filtering, and that is independent of OTel spec. It'll work for any providers, not just OTel. For example, Iloggers sampling/filtering will work with any providers like the ConsoleLogProvider. On the other hand, anything added in OTel will only work for OpenTelemetryProviders, not others like ConsoleLogProviders.

If you elaborate more on "feature parity" part, I can comment on it. I'll close the issue now, as there is no action for this repo. Happy to reopen, if there are things this repo should be doing.