Closed pellared closed 2 months ago
In a nutshell, my critique is that the SDK has to provide an implementation of this Logger#enabled method, but there is currently nothing in the SDK spec which would allow the Logger#enabled to do anything differently based on the context / severity arguments.
Cannot this be proposed as a separate PR?
In Go SIG, we are indeed experimenting how to best model it on the SDK level. We have an experimental feature, but we would like to have some more feedback before we propose something to the specification.
I think we can separately work on specifying the API and how SDK is implementing the API.
In my opinion, designing and implementing the SDK implementation would be harder and more opinionated. Therefore, I think it would be better to separate those into distinct PRs.
I agree that not having any specification on the SDK level may be seen as a blocker of making it stable. On the other hand, there are already APIs which are not defined how the SDK should handle them like https://github.com/open-telemetry/opentelemetry-specification/issues/4160.
Notice that this section is still in "Development".
Cannot this be proposed as a separate PR?
I'm fine splitting this out in a way that allows iteration. But we need a way to not loose track of this - maybe a TODO in the spec and a new issue upon merging? Resolving this discrepancy between the API and SDK should be a blocker to stability.
Cannot this be proposed as a separate PR?
I'm fine splitting this out in a way that allows iteration. But we need a way to not loose track of this - maybe a TODO in the spec and a new issue upon merging? Resolving this discrepancy between the API and SDK should be a blocker to stability.
Good idea. I created:
Feel free to update description or even create more issues.
may also want to consider blocking stability on whether we want to include "event name" in the enabled parameters, e.g. see @lmolkova's https://github.com/open-telemetry/oteps/pull/265#issuecomment-2344112029
may also want to consider blocking stability on whether we want to include "event name" in the enabled parameters, e.g. see @lmolkova's open-telemetry/oteps#265 (comment)
If you want you can add it to https://github.com/open-telemetry/opentelemetry-specification/issues/4208.
However, I do not think that it should block the stability of Enabled as:
event.name
log attribute for it. It may be better to add "attributes" to enabled parameters. I think we would rather use just an attribute for that. See https://github.com/open-telemetry/oteps/pull/265#issuecomment-2339082984
- Adding a parameter would not be a breaking change
💯
- I feel that there is no conclusion if we want to add an "event name" do the LogRecord model or if we just want to use an
event.name
log attribute for it. It may be better to add "attributes" to enabled parameters. I think we would rather use just an attribute for that. See Event basics oteps#265 (comment)
There might be more to consider (definitely not for this PR):
Here (Proposal A) is an idea how the SDK can implement Logger.Enabled
.
Here (Proposal B) is a second (I think better) idea how the SDK can implement filtering which will affect not only Logger.Enabled
but also Logger.Emit
. It is more like sampling in tracing SDK.
Follows https://github.com/open-telemetry/opentelemetry-specification/pull/4020
During 7/5/24 OTel Specification SIG meeting it was decided to move the discussion about parameters to a separate PR; a little cleaned up transcript:
This is needed for stabilization of
Logger.Enabled
in the spec which is need for the stabilization of Go Logs API.Related issue: https://github.com/open-telemetry/opentelemetry-go/issues/5769
Implementation in Go: https://github.com/open-telemetry/opentelemetry-go/pull/5791
Changes
Add a minimal (and maybe even sufficient?) set of parameters for
Logger.Enabled
:Context
is needed for allowing "context related" behavior. For instance, it enables to user to disable logging for some key/value in the context has been set (example). It can also used to see if the call is within a span.SeverityLevel
is needed as it is common to configure the minimum level for logging (e.g. https://pkg.go.dev/go.opentelemetry.io/contrib/processors/minsev). Moreover, the https://pkg.go.dev/log/slog#Handler (Go standard library structured logging), https://pkg.go.dev/go.uber.org/zap/zapcore#LevelEnabler (popular Go structured logging library), https://pkg.go.dev/github.com/go-logr/logr#LogSink (opinionated common logging abstraction) allow creating a bridge/hook/sink that is checking if a logger is enabled and it accepts the logging level as an argument.Add guidelines/rules for the
Enabled
parameters.