[Prototype] log: Events support literally following spec #6017
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This prototype is doing everything to be compliant with https://github.com/open-telemetry/opentelemetry-specification/blob/50027a1036746dce293ee0a8592639f131fc1fb8/specification/logs/api.md#emit-an-event.
It adds
EmitEvent
andEnabledEvent
methods toLogger
interface.These changes are BREAKING from Go stability perspective. Adding methods to interfaces is defined as not backwards-compatible. See: https://go.dev/doc/go1compat. Even though that we have comments saying that it can happen, we know that our users are unhappy each time it occurs.
It requires a lot of code while it still misses a lot of tests, benchmarks, docs etc.
Doing everything would required more than 1k LOC. Probably it would be around 2k LOC.
Basically it makes a new API surface and requires a lot of boilerplate.
It also adds complexity to
logtest
.For me, adding more methods to
Logger
is a design smell. Interfaces should consist of minimal API surface necessary to do the job.Moreover, the experimental
FilterProcessor
is not able to access event name for sake of filtering in itsEnabled
method. Should theFilterProcessor
acceptEnabledEventParameters
instead? This would feel wrong.There is nothing in the design which forces instrumentation devs to use
EmitEvent
overEmit
(orEnabledEvent
overEnabled
). There are only comments.See second prototype: #6018.