Skip to content

Commit 30d5ce4

Browse files
committed
review suggestions
1 parent c249b03 commit 30d5ce4

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

packages/core/src/tracing/span.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ export class Span implements SpanInterface {
133133
// eslint-disable-next-line deprecation/deprecation
134134
this.instrumenter = spanContext.instrumenter || 'sentry';
135135

136-
this._attributes = dropUndefinedKeys({
136+
this._attributes = {};
137+
this.setAttributes({
137138
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: spanContext.origin || 'manual',
138139
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: spanContext.op,
139140
...spanContext.attributes,

packages/tracing-internal/src/node/integrations/prisma.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getCurrentHub, startSpan } from '@sentry/core';
1+
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, getCurrentHub, startSpan } from '@sentry/core';
22
import type { Integration } from '@sentry/types';
33
import { addNonEnumerableProperty, logger } from '@sentry/utils';
44

@@ -104,7 +104,9 @@ export class Prisma implements Integration {
104104
{
105105
name: model ? `${model} ${action}` : action,
106106
op: 'db.prisma',
107-
origin: 'auto.db.prisma',
107+
attributes: {
108+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.prisma',
109+
},
108110
data: { ...clientData, 'db.operation': action },
109111
},
110112
() => next(params),

packages/tracing/test/hub.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,8 @@ describe('Hub', () => {
305305
makeMain(hub);
306306
hub.startTransaction({ name: 'dogpark', parentSampled: true });
307307

308-
// length 1 because `sentry.origin` is set on span initialization
309-
expect(Transaction.prototype.setAttribute).toHaveBeenCalledTimes(1);
308+
// length 2 because origin and op are set as attributes on span initialization
309+
expect(Transaction.prototype.setAttribute).toHaveBeenCalledTimes(2);
310310
});
311311

312312
it('should record sampling method and rate when sampling decision comes from traceSampleRate', () => {

0 commit comments

Comments
 (0)