Skip to content

Commit a37abc4

Browse files
committed
use attributes for user provided attrs
1 parent 7bb3e2e commit a37abc4

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

plugins/web/opentelemetry-instrumentation-web-exception/src/instrumentation.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ export class WebExceptionInstrumentation extends InstrumentationBase<GlobalError
7373

7474
eventLogger.emit({
7575
name: 'browser.exception',
76-
data: { ...errorAttributes, ...customAttributes },
76+
data: errorAttributes,
77+
attributes: customAttributes,
7778
severityNumber: SeverityNumber.ERROR,
7879
timestamp: hrTime(),
7980
});

plugins/web/opentelemetry-instrumentation-web-exception/test/instrumentation.test.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,10 @@ describe('WebExceptionInstrumentation', () => {
172172
const events = exporter.getFinishedLogRecords();
173173
assert.ok(events.length > 0, 'Expected at least one log record');
174174
const event = events[0];
175-
const body = event.body as Record<string, any>;
176-
assert.strictEqual(body['app.custom.exception'], 'SOMETHING HAPPENED!');
175+
assert.strictEqual(
176+
event.attributes['app.custom.exception'],
177+
'SOMETHING HAPPENED!'
178+
);
177179
}, 0);
178180
});
179181
});

0 commit comments

Comments
 (0)