Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
2 changes: 0 additions & 2 deletions dev-packages/bun-integration-tests/node-suites/excludes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,8 @@ const BUN_BUILD_NOT_TRIAGED = [
'suites/tracing/mongoose-v9/test.ts',
'suites/tracing/mongoose/test.ts',
'suites/tracing/mysql/test.ts',
'suites/tracing/openai/test.ts',
'suites/tracing/prisma-orm-v8/test.ts',
'suites/tracing/together-ai/test.ts',
'suites/tracing/vercelai/test.ts',
'suites/tracing/vercelai/v6_v7/test.ts',
];

Expand Down
2 changes: 2 additions & 0 deletions packages/bun/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as os from 'node:os';
import type { Integration, Options } from '@sentry/core';
import {
applySdkMetadata,
conversationIdIntegration,
dedupeIntegration,
eventFiltersIntegration,
functionToStringIntegration,
Expand Down Expand Up @@ -51,6 +52,7 @@ export function getDefaultIntegrationsWithoutPerformance(): Integration[] {
linkedErrorsIntegration(),
dedupeIntegration(),
requestDataIntegration(),
conversationIdIntegration(),
// Native Wrappers
consoleIntegration(),
httpIntegration(),
Expand Down
15 changes: 15 additions & 0 deletions packages/bun/test/init.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { GEN_AI_CONVERSATION_ID } from '@sentry/conventions/attributes';
import { type Integration } from '@sentry/core';
import * as sentryServerUtils from '@sentry/server-utils';
import type { Mock } from 'bun:test';
Expand All @@ -8,6 +9,9 @@ import {
getDefaultIntegrationsWithoutPerformance,
init,
initWithoutDefaultIntegrations,
spanToJSON,
startSpan,
withScope,
} from '../src';

const PUBLIC_DSN = 'https://username@domain/123';
Expand Down Expand Up @@ -127,6 +131,17 @@ describe('init()', () => {
expect(integrations?.map(({ name }) => name)).toContain('Some mock integration 4.1');
expect(integrations?.map(({ name }) => name)).toContain('Some mock integration 4.3');
});

it('adds the conversation id of the scope to gen_ai spans', () => {
init({ dsn: PUBLIC_DSN, tracesSampleRate: 1 });

withScope(scope => {
scope.setConversationId('conversation-1');
startSpan({ name: 'chat', op: 'gen_ai.chat' }, span => {
expect(spanToJSON(span).attributes[GEN_AI_CONVERSATION_ID]).toBe('conversation-1');
});
});
});
});

describe('runtime', () => {
Expand Down
Loading