open-telemetry / opentelemetry-specification

Specifications for OpenTelemetry
https://opentelemetry.io
Apache License 2.0
3.71k stars 887 forks source link

Define whether instrumentations can emit non-event log records #4234

Open pellared opened 5 hours ago

pellared commented 5 hours ago

Imagine I'm instrumenting kafka:

The library logs are emitted with is not relevant to users - they'd get the same logs if lib used 3rd party logger or OTel API. So I don't see why we should limit instrumentations from using OTel API to emit undocumented regular (but structured) logs.

_Originally posted by @lmolkova in https://github.com/open-telemetry/opentelemetry-specification/pull/4225#discussion_r1781723278_

lmolkova commented 4 hours ago

To add a bit of context: client libraries or infra components usually emit some logs using some non-OTel logging API. If they are instrumented natively with OTel they need to have 2 dependencies - OTel and 3rd party logging lib.

While it's unlikely that existing libraries will replace their existing logging with OTel one, by providing user-facing logging API we allow future native instrumentations that use OTel for metrics and tracing to also use OTel logging API instead of adding a new dependency.

Before #4225 it was not possible.