-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Inconsistent normalization of Transaction/Span data #2646
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
Comments
All of the context types documented in [1] are flat objects. The new contexts.trace is the only key under contexts that may have nested objects under contexts.trace.data. That value holds the data for the Transaction Span and matches spans[].data for invidual Spans. At the moment one of the data fields is heavily limited, while the other is ignored by normalization. [1]: https://develop.sentry.dev/sdk/event-payloads/contexts/ This is the simplest to implement fix to #2646, thus what I'm doing here perhaps temporarily. Fixes #2646
Option 3️⃣ Option 2 Option 3 |
This shouldn't affect how we should display this on product side if any of the 3 options are implemented, right? |
@dashed nope |
Option 3 would not fix the inconsistency. Just delays the time until someone will hit the |
All of the context types documented in [1] are flat objects. The new contexts.trace is the only key under contexts that may have nested objects under contexts.trace.data. That value holds the data for the Transaction Span and matches spans[].data for invidual Spans. At the moment one of the data fields is heavily limited, while the other is ignored by normalization. [1]: https://develop.sentry.dev/sdk/event-payloads/contexts/ This is the simplest to implement fix to #2646, thus what I'm doing here perhaps temporarily. Fixes #2646
Related: #2539 |
All of the context types documented in [1] are flat objects. The more recent addition contexts.trace is the only context type that may have nested objects under contexts.trace.data. That value holds the data for the Transaction Span and matches spans[].data for invidual Spans. Removing normalization is one solution to the inconsistency in which data in Transactions is heavily limited, while data in Span is ignored by normalization. This is the simplest to implement fix to #2646, thus what we implement here to evaluate. We expect that no other key under contexts will be affected negatively by this change. [1]: https://develop.sentry.dev/sdk/event-payloads/contexts/ Fixes #2646
In light of hearing that Option 4
The end result is normalization applies to every part of The serialization of Transactions and Spans is then consistent, and neither |
All of the context types documented in [1] are flat objects. The new contexts.trace is the only key under contexts that may have nested objects under contexts.trace.data. That value holds the data for the Transaction Span and matches spans[].data for invidual Spans. At the moment one of the data fields is heavily limited, while the other is ignored by normalization. [1]: https://develop.sentry.dev/sdk/event-payloads/contexts/ This is the simplest to implement fix to #2646, thus what I'm doing here perhaps temporarily. Fixes #2646
All of the context types documented in [1] are flat objects. The new contexts.trace is the only key under contexts that may have nested objects under contexts.trace.data. That value holds the data for the Transaction Span and matches spans[].data for invidual Spans. At the moment one of the data fields is heavily limited, while the other is ignored by normalization. [1]: https://develop.sentry.dev/sdk/event-payloads/contexts/ This is the simplest to implement fix to #2646, thus what I'm doing here perhaps temporarily. Fixes #2646
This is such that setting data on a Transaction behaves the same as setting data on a Span. Fixes #2646.
All of the context types documented in [1] are flat objects. The new contexts.trace is the only key under contexts that may have nested objects under contexts.trace.data. That value holds the data for the Transaction Span and matches spans[].data for invidual Spans. At the moment one of the data fields is heavily limited, while the other is ignored by normalization. [1]: https://develop.sentry.dev/sdk/event-payloads/contexts/ This is the simplest to implement fix to #2646, thus what I'm doing here perhaps temporarily. Fixes #2646
FTR, we merged an implementation of Option 4. |
@rhcarvalho as an optimization, would it be better to delete |
Sounds good. I bet if we invest time on profiling the SDK we may find other/better optimizations in the hot path of events. |
Summary
Transaction.data
is too easily truncatedSpan.data
is never normalizedDetails
Introduction
The JS SDKs have a feature to normalize events before serialization that prevents serializing very deeply nested objects.
sentry-javascript/packages/types/src/options.ts
Lines 97 to 106 in 4e552ec
This is a great feature, however it does not apply consistently to Transaction/Span data.
Problem
Event.contexts.trace.data
.Event.spans[].data
.Unlike for breadcrumbs that normalization applies only to the
.data
property of each breadcrumb, normalization is applied toEvent.contexts
as a whole:sentry-javascript/packages/core/src/baseclient.ts
Lines 303 to 323 in 4e552ec
What that means in practice is that, without changes to
normalizeDepth
, it is impossible to store objects inTransaction.data
and have them sent to Sentry.Transaction.data
is indirectly forced to be a flat object.Users unaware of
normalizeDepth
can hack it andJSON.stringify
the values they send, but that gives worse user experience 2 times:[Object]
where the expect some data; fix the frustration withJSON.stringify
and thenManually stringified object

Regular JSON object

Possible solutions
Considering that all documented context types are flat objects, it is possible that we could relax the way how normalization applies to
Event.contexts
.The new
contexts.trace
is the only key under contexts that may have nested objects undercontexts.trace.data
.Option 1: liberal
An obvious option to consistently handle Transaction/Span data is to remove normalization from
contexts
altogether.Option 2: restrictive
Alternatively, normalization should:
contexts
as a whole; andcontexts.trace.data
; andspans[].data
.Option 3: Improve Contexts normalizationnot apply tocontexts
as a whole; andInstead, walk through all the keys in contexts and apply it to that values of the keyedit: this is not an option to fix the inconsistency, it would still treat
Transaction.data
andSpan.data
differently.The text was updated successfully, but these errors were encountered: