Closed aronchick closed 3 years ago
Hi @aronchick, no, there's no way to get span attributes from the API.
Can you share which use case you're trying to solve by duplicating the parent's span attributes as events on the child? Maybe we're able to solve that by other means.
from the spec sig mtg today, discussed this and the answer is "no", if there is a need, please send a PR to the spec to propose a change.
To point out two important reason for why get
cannot be provided:
Gotcha – can you recommend a solution for later getting an attribute (if it exists) on a span?
I guess what I’m really looking for is a way to pass state, in a variable, to a child span or event being written.
@aronchick try to use CorrelationContext
Hi all! I'm looking to populate all events inside the span with the attributes from the parent span - so, for example, i start a span with the set_attribute("project_id", "foo") and then I'd like to set that as an attribute in the add_event call. I get that I could do this on the backend when I pull everything apart, but it'd be much more convenient to just duplicate now. But, though there's plenty of documentation on how to "set_attribute", there's none I can find on how to "get_attribute". Any suggestions?