Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.0.0",
"private": true,
"scripts": {
"start": "deno run --allow-net --allow-env --allow-read src/app.ts",
"start": "deno run --allow-net --allow-env --allow-read --allow-sys src/app.ts",
"test": "playwright test",
"clean": "npx rimraf node_modules pnpm-lock.yaml",
"test:build": "pnpm install",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import { waitForStreamedSpans, getSpanOp } from '@sentry-internal/test-utils';

const SEGMENT_SPAN = {
attributes: {
'app.start_time': {
type: 'string',
value: expect.any(String),
},
'client.address': {
type: 'string',
value: expect.any(String),
Expand All @@ -11,6 +15,11 @@ const SEGMENT_SPAN = {
type: 'integer',
value: expect.any(Number),
},
// TODO: 'device.archs' is set but arrays are not yet serialized in span attributes
Comment thread
chargome marked this conversation as resolved.
'device.processor_count': {
type: 'integer',
value: expect.any(Number),
},
'http.request.header.accept': {
type: 'string',
value: '*/*',
Expand Down Expand Up @@ -51,6 +60,14 @@ const SEGMENT_SPAN = {
type: 'integer',
value: expect.any(Number),
},
'os.name': {
type: 'string',
value: expect.any(String),
},
'os.version': {
type: 'string',
value: expect.any(String),
},
'sentry.environment': {
type: 'string',
value: 'qa',
Expand Down Expand Up @@ -115,6 +132,14 @@ const SEGMENT_SPAN = {
type: 'string',
value: 'node',
},
'process.runtime.engine.name': {
type: 'string',
value: 'v8',
},
'process.runtime.engine.version': {
type: 'string',
value: expect.any(String),
},
},
end_timestamp: expect.any(Number),
is_segment: true,
Expand Down
24 changes: 23 additions & 1 deletion packages/deno/src/integrations/context.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Event, IntegrationFn } from '@sentry/core';
import { defineIntegration } from '@sentry/core';
import { defineIntegration, safeSetSpanJSONAttributes } from '@sentry/core';

const INTEGRATION_NAME = 'DenoContext';

Expand Down Expand Up @@ -53,11 +53,33 @@ async function addDenoRuntimeContext(event: Event): Promise<Event> {
}

const _denoContextIntegration = (() => {
// Eagerly resolve the async OS release so it's available synchronously in processSegmentSpan
let cachedOsRelease: string | undefined;
getOSRelease()
.then(release => {
cachedOsRelease = release;
})
.catch(() => {
// Ignore - os.version will be undefined
});
Comment thread
sentry[bot] marked this conversation as resolved.
Outdated

return {
name: INTEGRATION_NAME,
processEvent(event) {
return addDenoRuntimeContext(event);
},
processSegmentSpan(span) {
safeSetSpanJSONAttributes(span, {
'app.start_time': new Date(Date.now() - performance.now()).toISOString(),
Comment thread
chargome marked this conversation as resolved.
Outdated
'device.archs': [Deno.build.arch],
// eslint-disable-next-line no-restricted-globals
'device.processor_count': navigator.hardwareConcurrency,
'os.name': getOSName(),
'os.version': cachedOsRelease,
'process.runtime.engine.name': 'v8',
'process.runtime.engine.version': Deno.version.v8,
});
},
};
}) satisfies IntegrationFn;

Expand Down
Loading