Skip to content

Commit b433b0c

Browse files
committed
feat: Remove normalization of contexts
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
1 parent 1fb0580 commit b433b0c

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

packages/core/src/baseclient.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,6 @@ export abstract class BaseClient<B extends Backend, O extends Options> implement
289289
* Normalized keys:
290290
* - `breadcrumbs.data`
291291
* - `user`
292-
* - `contexts`
293292
* - `extra`
294293
* @param event Event
295294
* @returns Normalized event
@@ -313,9 +312,6 @@ export abstract class BaseClient<B extends Backend, O extends Options> implement
313312
...(event.user && {
314313
user: normalize(event.user, depth),
315314
}),
316-
...(event.contexts && {
317-
contexts: normalize(event.contexts, depth),
318-
}),
319315
...(event.extra && {
320316
extra: normalize(event.extra, depth),
321317
}),

packages/core/test/lib/base.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ describe('BaseClient', () => {
467467
});
468468
expect(TestBackend.instance!.event!).toEqual({
469469
breadcrumbs: [normalizedBreadcrumb, normalizedBreadcrumb, normalizedBreadcrumb],
470-
contexts: normalizedObject,
470+
contexts: fourLevelsObject,
471471
event_id: '42',
472472
extra: normalizedObject,
473473
timestamp: 2020,
@@ -512,7 +512,7 @@ describe('BaseClient', () => {
512512
});
513513
expect(TestBackend.instance!.event!).toEqual({
514514
breadcrumbs: [normalizedBreadcrumb, normalizedBreadcrumb, normalizedBreadcrumb],
515-
contexts: normalizedObject,
515+
contexts: fourLevelsObject,
516516
event_id: '42',
517517
extra: normalizedObject,
518518
timestamp: 2020,

0 commit comments

Comments
 (0)