[editorial] Clarify additional LogRecord interfaces #3937
Closed
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 PR is a simpler version of #3898.
Currently, the Logs SDK specification says:
This suggests that both types should have a representation in the SDK.
The problem is that each abstraction/type conversion can lead (depending on language) to performance overhead.
E.g. for Go:
Moreover, having less abstractions reduces the API surface and makes the design simpler.
I believe that for Logs signal, performance is more important than API esthetics. Based on https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/README.md, I think that the Logs SDK should be designed in a way to achieve to have high performance for a scenario when a OTLP exporter with a batch processor is used.
In my opinion, the
ReadableLogRecord
,ReadWriteLogRecord
terms should only be used to describe what the functionalities accepting log records MUST be able to do with them. The key is that the log processor MUST be able to mutate the log record that is received inOnEmit
while all other functionalities do not need mutate the record so they MAY accept an immutable value.I noticed that .NET SDK does not define anything like
ReadableLogRecord
.Maybe it will help other languages as well in implementing the SDK.
Footnotes
https://go101.org/optimizations/0.3-memory-allocations.html ↩
https://github.com/open-telemetry/opentelemetry-go/blob/main/log/DESIGN.md#record-as-interface ↩
https://tip.golang.org/doc/gc-guide#Eliminating_heap_allocations ↩