-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(event-schema): Copy root span data when converting from events (#…
…3790) SDKs place span data for root spans into `event.contexts.trace.data`. Therefore, top-level span data was missing for metric extraction and in indexed spans. This PR copies trace data over to the root span when events are converted to spans. The two types used for trace data and span data are different (called `Data` and `SpanData`, respectively). Each of the types is partially typed out, where some fields overlap but have different types, and otherwise most fields are different. In a follow-up, these two types will be merged, but in the meanwhile we can convert between them via `IntoValue` and `FromValue`. The current approach carries two noteworthy caveats: 1. Roundtrip behavior is loosened, since the conversion function places certain event attributes into span.data. These are then cloned back into trace.data, where they did not reside in the original event. 2. `IntoValue` does not honor `skip_serialization`, so all typed fields are inserted into the `other` field as `Annotated::empty()`. This is a cosmetic issue in tests and leads to suboptimal performance, but these fields will be omitted properly in JSON serialization.
- Loading branch information
Showing
3 changed files
with
48 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters