opentelemetry-java: Too many wrapper objects?
Is your feature request related to a problem? Please describe.
Currently there are many wrapper objects like TraceId
, SpanId
. In other languages these may be cheap but in Java, allocations do affect app performance and instrumentation needs to take efforts to reduce the burden on an app. Lately there’s some buzz on the interwebs about this topic folks may have seen 😃
Describe the solution you’d like
These are mostly attributes of a span’s context. It seems like SpanContext
could store the values like the long IDs directly and provide any needed helpers like hex encoding.
Has this been given any thought? I found this but it doesn’t seem to provide concrete motivation for wrappers.
https://github.com/open-telemetry/opentelemetry-java/issues/12
SpanId
seems particularly aggregious, it’s effectively just a Long
.
Consider how much effort JVMs have put in to avoiding boxing as much as possible, it seems a bit weird to me that we are boxing everything by default.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 20 (20 by maintainers)
Since we have issues for the non-ID stuff, I think we can close this, @jkwatson sound good?
I’d be up for prototyping this idea. Do you have an idea of how to limit the scope of the prototype? This will be a very large change, in general.
@carlosalberto one option is to expose all methods on the SpanContext instead of exposing them on their own objects. I would like to see a prototype before making a decision