Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access all attributes from ReadableSpan #6344

Closed
jack-berg opened this issue Apr 3, 2024 · 0 comments · Fixed by #6382
Closed

Access all attributes from ReadableSpan #6344

jack-berg opened this issue Apr 3, 2024 · 0 comments · Fixed by #6382
Labels
Feature Request Suggest an idea for this project

Comments

@jack-berg
Copy link
Member

Currently if you're writing a span processor and want to read all of a span's attributes, you need to first get an immutable copy of that span via ReadableSpan#toSpanData().

Oddly, ReadableSpan has a method for accessing a single attribute if you know the key ahead of time, but not all attributes. This seems to be a simple oversight. The specification states the following on Readable Span:

A function receiving this as argument MUST be able to access all information that was added to the span, as listed in the API spec for Span.

Given that accessors are available for many parts of the span, its odd that attributes are not accessible in the same way. Clearly the trick of converting toSpanData() first to access all fields was not the intended usage patter, else why have any direct accessors on ReadableSpan in the first place?

I propose we add Attributes getAttributes to ReadableSpan.

@jack-berg jack-berg added the Feature Request Suggest an idea for this project label Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request Suggest an idea for this project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant