Skip to content

Too many wrapper objects? #1314

Description

@anuraaga

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.

#12

SpanId seems particularly aggregious, it's effectively just a Long.

https://github.com/open-telemetry/opentelemetry-java/blob/master/api/src/main/java/io/opentelemetry/trace/SpanId.java

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

APIAPI related issuesFeature RequestSuggest an idea for this projectpriority:p1Critical issues and bugs. Highest priority; breaking API changes.release:required-for-gaRequired for 1.0 GA release

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions