Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { expect, it } from 'vitest';
import {
GEN_AI_OPERATION_NAME_ATTRIBUTE,
GEN_AI_REQUEST_MAX_TOKENS_ATTRIBUTE,
GEN_AI_REQUEST_MODEL_ATTRIBUTE,
GEN_AI_REQUEST_TEMPERATURE_ATTRIBUTE,
GEN_AI_RESPONSE_ID_ATTRIBUTE,
GEN_AI_RESPONSE_MODEL_ATTRIBUTE,
GEN_AI_SYSTEM_ATTRIBUTE,
GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE,
GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE,
GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE,
} from '../../../../../packages/core/src/tracing/ai/gen-ai-attributes';
GEN_AI_OPERATION_NAME,
GEN_AI_REQUEST_MAX_TOKENS,
GEN_AI_REQUEST_MODEL,
GEN_AI_REQUEST_TEMPERATURE,
GEN_AI_RESPONSE_ID,
GEN_AI_RESPONSE_MODEL,
GEN_AI_SYSTEM,
GEN_AI_USAGE_INPUT_TOKENS,
GEN_AI_USAGE_OUTPUT_TOKENS,
GEN_AI_USAGE_TOTAL_TOKENS,
} from '@sentry/conventions/attributes';
import { createRunner } from '../../../runner';

// This test runs the `@anthropic-ai/sdk` on the Workers runtime (with a
Expand Down Expand Up @@ -40,16 +40,16 @@ it('traces a basic message creation request with the anthropic SDK', async ({ si
attributes: {
'sentry.origin': { value: 'auto.ai.anthropic', type: 'string' },
'sentry.op': { value: 'gen_ai.chat', type: 'string' },
[GEN_AI_SYSTEM_ATTRIBUTE]: { value: 'anthropic', type: 'string' },
[GEN_AI_OPERATION_NAME_ATTRIBUTE]: { value: 'chat', type: 'string' },
[GEN_AI_REQUEST_MODEL_ATTRIBUTE]: { value: 'claude-3-haiku-20240307', type: 'string' },
[GEN_AI_REQUEST_TEMPERATURE_ATTRIBUTE]: { value: 0.7, type: 'double' },
[GEN_AI_REQUEST_MAX_TOKENS_ATTRIBUTE]: { value: 100, type: 'integer' },
[GEN_AI_RESPONSE_ID_ATTRIBUTE]: { value: 'msg_mock123', type: 'string' },
[GEN_AI_RESPONSE_MODEL_ATTRIBUTE]: { value: 'claude-3-haiku-20240307', type: 'string' },
[GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE]: { value: 10, type: 'integer' },
[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: { value: 15, type: 'integer' },
[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: { value: 25, type: 'integer' },
[GEN_AI_SYSTEM]: { value: 'anthropic', type: 'string' },
[GEN_AI_OPERATION_NAME]: { value: 'chat', type: 'string' },
[GEN_AI_REQUEST_MODEL]: { value: 'claude-3-haiku-20240307', type: 'string' },
[GEN_AI_REQUEST_TEMPERATURE]: { value: 0.7, type: 'double' },
[GEN_AI_REQUEST_MAX_TOKENS]: { value: 100, type: 'integer' },
[GEN_AI_RESPONSE_ID]: { value: 'msg_mock123', type: 'string' },
[GEN_AI_RESPONSE_MODEL]: { value: 'claude-3-haiku-20240307', type: 'string' },
[GEN_AI_USAGE_INPUT_TOKENS]: { value: 10, type: 'integer' },
[GEN_AI_USAGE_OUTPUT_TOKENS]: { value: 15, type: 'integer' },
[GEN_AI_USAGE_TOTAL_TOKENS]: { value: 25, type: 'integer' },
},
});
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { expect, it } from 'vitest';
import type { SerializedStreamedSpan } from '@sentry/core';
import {
GEN_AI_OPERATION_NAME_ATTRIBUTE,
GEN_AI_REQUEST_MAX_TOKENS_ATTRIBUTE,
GEN_AI_REQUEST_MODEL_ATTRIBUTE,
GEN_AI_REQUEST_TEMPERATURE_ATTRIBUTE,
GEN_AI_REQUEST_TOP_P_ATTRIBUTE,
GEN_AI_SYSTEM_ATTRIBUTE,
GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE,
GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE,
GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE,
} from '../../../../../packages/core/src/tracing/ai/gen-ai-attributes';
GEN_AI_OPERATION_NAME,
GEN_AI_REQUEST_MAX_TOKENS,
GEN_AI_REQUEST_MODEL,
GEN_AI_REQUEST_TEMPERATURE,
GEN_AI_REQUEST_TOP_P,
GEN_AI_SYSTEM,
GEN_AI_USAGE_INPUT_TOKENS,
GEN_AI_USAGE_OUTPUT_TOKENS,
GEN_AI_USAGE_TOTAL_TOKENS,
} from '@sentry/conventions/attributes';
import { createRunner } from '../../../runner';

// This test runs the `@google/genai` SDK on the Workers runtime (with a
Expand Down Expand Up @@ -43,12 +43,12 @@ it('traces Google GenAI chat, generateContent, and embedContent calls', async ({
attributes: {
'sentry.origin': { value: 'auto.ai.google_genai', type: 'string' },
'sentry.op': { value: 'gen_ai.chat', type: 'string' },
[GEN_AI_SYSTEM_ATTRIBUTE]: { value: 'google_genai', type: 'string' },
[GEN_AI_OPERATION_NAME_ATTRIBUTE]: { value: 'chat', type: 'string' },
[GEN_AI_REQUEST_MODEL_ATTRIBUTE]: { value: 'gemini-1.5-pro', type: 'string' },
[GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE]: { value: 8, type: 'integer' },
[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: { value: 12, type: 'integer' },
[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: { value: 20, type: 'integer' },
[GEN_AI_SYSTEM]: { value: 'google_genai', type: 'string' },
[GEN_AI_OPERATION_NAME]: { value: 'chat', type: 'string' },
[GEN_AI_REQUEST_MODEL]: { value: 'gemini-1.5-pro', type: 'string' },
[GEN_AI_USAGE_INPUT_TOKENS]: { value: 8, type: 'integer' },
[GEN_AI_USAGE_OUTPUT_TOKENS]: { value: 12, type: 'integer' },
[GEN_AI_USAGE_TOTAL_TOKENS]: { value: 20, type: 'integer' },
},
});

Expand All @@ -64,15 +64,15 @@ it('traces Google GenAI chat, generateContent, and embedContent calls', async ({
attributes: {
'sentry.origin': { value: 'auto.ai.google_genai', type: 'string' },
'sentry.op': { value: 'gen_ai.generate_content', type: 'string' },
[GEN_AI_SYSTEM_ATTRIBUTE]: { value: 'google_genai', type: 'string' },
[GEN_AI_OPERATION_NAME_ATTRIBUTE]: { value: 'generate_content', type: 'string' },
[GEN_AI_REQUEST_MODEL_ATTRIBUTE]: { value: 'gemini-1.5-flash', type: 'string' },
[GEN_AI_REQUEST_TEMPERATURE_ATTRIBUTE]: { value: 0.7, type: 'double' },
[GEN_AI_REQUEST_TOP_P_ATTRIBUTE]: { value: 0.9, type: 'double' },
[GEN_AI_REQUEST_MAX_TOKENS_ATTRIBUTE]: { value: 100, type: 'integer' },
[GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE]: { value: 8, type: 'integer' },
[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: { value: 12, type: 'integer' },
[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: { value: 20, type: 'integer' },
[GEN_AI_SYSTEM]: { value: 'google_genai', type: 'string' },
[GEN_AI_OPERATION_NAME]: { value: 'generate_content', type: 'string' },
[GEN_AI_REQUEST_MODEL]: { value: 'gemini-1.5-flash', type: 'string' },
[GEN_AI_REQUEST_TEMPERATURE]: { value: 0.7, type: 'double' },
[GEN_AI_REQUEST_TOP_P]: { value: 0.9, type: 'double' },
[GEN_AI_REQUEST_MAX_TOKENS]: { value: 100, type: 'integer' },
[GEN_AI_USAGE_INPUT_TOKENS]: { value: 8, type: 'integer' },
[GEN_AI_USAGE_OUTPUT_TOKENS]: { value: 12, type: 'integer' },
[GEN_AI_USAGE_TOTAL_TOKENS]: { value: 20, type: 'integer' },
},
});

Expand All @@ -88,9 +88,9 @@ it('traces Google GenAI chat, generateContent, and embedContent calls', async ({
attributes: {
'sentry.origin': { value: 'auto.ai.google_genai', type: 'string' },
'sentry.op': { value: 'gen_ai.embeddings', type: 'string' },
[GEN_AI_SYSTEM_ATTRIBUTE]: { value: 'google_genai', type: 'string' },
[GEN_AI_OPERATION_NAME_ATTRIBUTE]: { value: 'embeddings', type: 'string' },
[GEN_AI_REQUEST_MODEL_ATTRIBUTE]: { value: 'text-embedding-004', type: 'string' },
[GEN_AI_SYSTEM]: { value: 'google_genai', type: 'string' },
[GEN_AI_OPERATION_NAME]: { value: 'embeddings', type: 'string' },
[GEN_AI_REQUEST_MODEL]: { value: 'text-embedding-004', type: 'string' },
},
});
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { expect, it } from 'vitest';
import {
GEN_AI_OPERATION_NAME_ATTRIBUTE,
GEN_AI_REQUEST_MAX_TOKENS_ATTRIBUTE,
GEN_AI_REQUEST_MODEL_ATTRIBUTE,
GEN_AI_REQUEST_TEMPERATURE_ATTRIBUTE,
GEN_AI_RESPONSE_FINISH_REASONS_ATTRIBUTE,
GEN_AI_RESPONSE_ID_ATTRIBUTE,
GEN_AI_RESPONSE_MODEL_ATTRIBUTE,
GEN_AI_RESPONSE_STOP_REASON_ATTRIBUTE,
GEN_AI_SYSTEM_ATTRIBUTE,
GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE,
GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE,
GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE,
} from '../../../../../packages/core/src/tracing/ai/gen-ai-attributes';
GEN_AI_OPERATION_NAME,
GEN_AI_REQUEST_MAX_TOKENS,
GEN_AI_REQUEST_MODEL,
GEN_AI_REQUEST_TEMPERATURE,
GEN_AI_RESPONSE_FINISH_REASONS,
GEN_AI_RESPONSE_ID,
GEN_AI_RESPONSE_MODEL,
GEN_AI_SYSTEM,
GEN_AI_USAGE_INPUT_TOKENS,
GEN_AI_USAGE_OUTPUT_TOKENS,
GEN_AI_USAGE_TOTAL_TOKENS,
} from '@sentry/conventions/attributes';
import { GEN_AI_RESPONSE_STOP_REASON_ATTRIBUTE } from '../../../../../packages/core/src/tracing/ai/gen-ai-attributes';
import { createRunner } from '../../../runner';

// This test runs the `@langchain/openai` model (backed by the
Expand Down Expand Up @@ -42,17 +42,17 @@ it('traces a LangChain chat model invocation', async ({ signal }) => {
attributes: {
'sentry.origin': { value: 'auto.ai.langchain', type: 'string' },
'sentry.op': { value: 'gen_ai.chat', type: 'string' },
[GEN_AI_SYSTEM_ATTRIBUTE]: { value: 'openai', type: 'string' },
[GEN_AI_OPERATION_NAME_ATTRIBUTE]: { value: 'chat', type: 'string' },
[GEN_AI_REQUEST_MODEL_ATTRIBUTE]: { value: 'gpt-3.5-turbo', type: 'string' },
[GEN_AI_REQUEST_TEMPERATURE_ATTRIBUTE]: { value: 0.7, type: 'double' },
[GEN_AI_REQUEST_MAX_TOKENS_ATTRIBUTE]: { value: 100, type: 'integer' },
[GEN_AI_RESPONSE_FINISH_REASONS_ATTRIBUTE]: { value: '["stop"]', type: 'string' },
[GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE]: { value: 10, type: 'integer' },
[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: { value: 15, type: 'integer' },
[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: { value: 25, type: 'integer' },
[GEN_AI_RESPONSE_MODEL_ATTRIBUTE]: { value: 'gpt-3.5-turbo', type: 'string' },
[GEN_AI_RESPONSE_ID_ATTRIBUTE]: { value: 'chatcmpl-mock123', type: 'string' },
[GEN_AI_SYSTEM]: { value: 'openai', type: 'string' },
[GEN_AI_OPERATION_NAME]: { value: 'chat', type: 'string' },
[GEN_AI_REQUEST_MODEL]: { value: 'gpt-3.5-turbo', type: 'string' },
[GEN_AI_REQUEST_TEMPERATURE]: { value: 0.7, type: 'double' },
[GEN_AI_REQUEST_MAX_TOKENS]: { value: 100, type: 'integer' },
[GEN_AI_RESPONSE_FINISH_REASONS]: { value: '["stop"]', type: 'string' },
[GEN_AI_USAGE_INPUT_TOKENS]: { value: 10, type: 'integer' },
[GEN_AI_USAGE_OUTPUT_TOKENS]: { value: 15, type: 'integer' },
[GEN_AI_USAGE_TOTAL_TOKENS]: { value: 25, type: 'integer' },
[GEN_AI_RESPONSE_MODEL]: { value: 'gpt-3.5-turbo', type: 'string' },
[GEN_AI_RESPONSE_ID]: { value: 'chatcmpl-mock123', type: 'string' },
[GEN_AI_RESPONSE_STOP_REASON_ATTRIBUTE]: { value: 'stop', type: 'string' },
},
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { expect, it } from 'vitest';
import type { SerializedStreamedSpan } from '@sentry/core';
import {
GEN_AI_AGENT_NAME_ATTRIBUTE,
GEN_AI_INPUT_MESSAGES_ATTRIBUTE,
GEN_AI_OPERATION_NAME_ATTRIBUTE,
GEN_AI_PIPELINE_NAME_ATTRIBUTE,
GEN_AI_RESPONSE_MODEL_ATTRIBUTE,
GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE,
GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE,
GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE,
} from '../../../../../packages/core/src/tracing/ai/gen-ai-attributes';
GEN_AI_AGENT_NAME,
GEN_AI_INPUT_MESSAGES,
GEN_AI_OPERATION_NAME,
GEN_AI_PIPELINE_NAME,
GEN_AI_RESPONSE_MODEL,
GEN_AI_USAGE_INPUT_TOKENS,
GEN_AI_USAGE_OUTPUT_TOKENS,
GEN_AI_USAGE_TOTAL_TOKENS,
} from '@sentry/conventions/attributes';
import { createRunner } from '../../../runner';

// These tests are not exhaustive because the instrumentation is
Expand Down Expand Up @@ -40,13 +40,13 @@ it('traces langgraph compile and invoke operations', async ({ signal }) => {
);
expect(createAgentSpan).toBeDefined();
expect(createAgentSpan!.status).toBe('ok');
expect(createAgentSpan!.attributes[GEN_AI_OPERATION_NAME_ATTRIBUTE]).toEqual({
expect(createAgentSpan!.attributes[GEN_AI_OPERATION_NAME]).toEqual({
type: 'string',
value: 'create_agent',
});
expect(createAgentSpan!.attributes['sentry.op']).toEqual({ type: 'string', value: 'gen_ai.create_agent' });
expect(createAgentSpan!.attributes['sentry.origin']).toEqual({ type: 'string', value: 'auto.ai.langgraph' });
expect(createAgentSpan!.attributes[GEN_AI_AGENT_NAME_ATTRIBUTE]).toEqual({
expect(createAgentSpan!.attributes[GEN_AI_AGENT_NAME]).toEqual({
type: 'string',
value: 'weather_assistant',
});
Expand All @@ -56,37 +56,37 @@ it('traces langgraph compile and invoke operations', async ({ signal }) => {
);
expect(invokeAgentSpan).toBeDefined();
expect(invokeAgentSpan!.status).toBe('ok');
expect(invokeAgentSpan!.attributes[GEN_AI_OPERATION_NAME_ATTRIBUTE]).toEqual({
expect(invokeAgentSpan!.attributes[GEN_AI_OPERATION_NAME]).toEqual({
type: 'string',
value: 'invoke_agent',
});
expect(invokeAgentSpan!.attributes['sentry.op']).toEqual({ type: 'string', value: 'gen_ai.invoke_agent' });
expect(invokeAgentSpan!.attributes['sentry.origin']).toEqual({ type: 'string', value: 'auto.ai.langgraph' });
expect(invokeAgentSpan!.attributes[GEN_AI_AGENT_NAME_ATTRIBUTE]).toEqual({
expect(invokeAgentSpan!.attributes[GEN_AI_AGENT_NAME]).toEqual({
type: 'string',
value: 'weather_assistant',
});
expect(invokeAgentSpan!.attributes[GEN_AI_PIPELINE_NAME_ATTRIBUTE]).toEqual({
expect(invokeAgentSpan!.attributes[GEN_AI_PIPELINE_NAME]).toEqual({
type: 'string',
value: 'weather_assistant',
});
expect(invokeAgentSpan!.attributes[GEN_AI_INPUT_MESSAGES_ATTRIBUTE]).toEqual({
expect(invokeAgentSpan!.attributes[GEN_AI_INPUT_MESSAGES]).toEqual({
type: 'string',
value: '[{"role":"user","content":"What is the weather in SF?"}]',
});
expect(invokeAgentSpan!.attributes[GEN_AI_RESPONSE_MODEL_ATTRIBUTE]).toEqual({
expect(invokeAgentSpan!.attributes[GEN_AI_RESPONSE_MODEL]).toEqual({
type: 'string',
value: 'mock-model',
});
expect(invokeAgentSpan!.attributes[GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE]).toEqual({
expect(invokeAgentSpan!.attributes[GEN_AI_USAGE_INPUT_TOKENS]).toEqual({
type: 'integer',
value: 20,
});
expect(invokeAgentSpan!.attributes[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]).toEqual({
expect(invokeAgentSpan!.attributes[GEN_AI_USAGE_OUTPUT_TOKENS]).toEqual({
type: 'integer',
value: 10,
});
expect(invokeAgentSpan!.attributes[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]).toEqual({
expect(invokeAgentSpan!.attributes[GEN_AI_USAGE_TOTAL_TOKENS]).toEqual({
type: 'integer',
value: 30,
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { expect, it } from 'vitest';
import {
GEN_AI_OPERATION_NAME_ATTRIBUTE,
GEN_AI_REQUEST_MODEL_ATTRIBUTE,
GEN_AI_REQUEST_TEMPERATURE_ATTRIBUTE,
GEN_AI_RESPONSE_FINISH_REASONS_ATTRIBUTE,
GEN_AI_RESPONSE_ID_ATTRIBUTE,
GEN_AI_RESPONSE_MODEL_ATTRIBUTE,
GEN_AI_SYSTEM_ATTRIBUTE,
GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE,
GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE,
GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE,
} from '../../../../../packages/core/src/tracing/ai/gen-ai-attributes';
GEN_AI_OPERATION_NAME,
GEN_AI_REQUEST_MODEL,
GEN_AI_REQUEST_TEMPERATURE,
GEN_AI_RESPONSE_FINISH_REASONS,
GEN_AI_RESPONSE_ID,
GEN_AI_RESPONSE_MODEL,
GEN_AI_SYSTEM,
GEN_AI_USAGE_INPUT_TOKENS,
GEN_AI_USAGE_OUTPUT_TOKENS,
GEN_AI_USAGE_TOTAL_TOKENS,
} from '@sentry/conventions/attributes';
import { createRunner } from '../../../runner';

// This test runs the `openai` SDK on the Workers runtime (with a canned
Expand Down Expand Up @@ -40,16 +40,16 @@ it('traces a basic chat completion request with the openai SDK', async ({ signal
attributes: {
'sentry.origin': { value: 'auto.ai.openai', type: 'string' },
'sentry.op': { value: 'gen_ai.chat', type: 'string' },
[GEN_AI_SYSTEM_ATTRIBUTE]: { value: 'openai', type: 'string' },
[GEN_AI_OPERATION_NAME_ATTRIBUTE]: { value: 'chat', type: 'string' },
[GEN_AI_REQUEST_MODEL_ATTRIBUTE]: { value: 'gpt-3.5-turbo', type: 'string' },
[GEN_AI_REQUEST_TEMPERATURE_ATTRIBUTE]: { value: 0.7, type: 'double' },
[GEN_AI_RESPONSE_ID_ATTRIBUTE]: { value: 'chatcmpl-mock123', type: 'string' },
[GEN_AI_RESPONSE_MODEL_ATTRIBUTE]: { value: 'gpt-3.5-turbo', type: 'string' },
[GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE]: { value: 10, type: 'integer' },
[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: { value: 15, type: 'integer' },
[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: { value: 25, type: 'integer' },
[GEN_AI_RESPONSE_FINISH_REASONS_ATTRIBUTE]: { value: '["stop"]', type: 'string' },
[GEN_AI_SYSTEM]: { value: 'openai', type: 'string' },
[GEN_AI_OPERATION_NAME]: { value: 'chat', type: 'string' },
[GEN_AI_REQUEST_MODEL]: { value: 'gpt-3.5-turbo', type: 'string' },
[GEN_AI_REQUEST_TEMPERATURE]: { value: 0.7, type: 'double' },
[GEN_AI_RESPONSE_ID]: { value: 'chatcmpl-mock123', type: 'string' },
[GEN_AI_RESPONSE_MODEL]: { value: 'gpt-3.5-turbo', type: 'string' },
[GEN_AI_USAGE_INPUT_TOKENS]: { value: 10, type: 'integer' },
[GEN_AI_USAGE_OUTPUT_TOKENS]: { value: 15, type: 'integer' },
[GEN_AI_USAGE_TOTAL_TOKENS]: { value: 25, type: 'integer' },
[GEN_AI_RESPONSE_FINISH_REASONS]: { value: '["stop"]', type: 'string' },
},
});
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { expect, it } from 'vitest';
import {
GEN_AI_OPERATION_NAME_ATTRIBUTE,
GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE,
GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE,
GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE,
} from '../../../../../../packages/core/src/tracing/ai/gen-ai-attributes';
GEN_AI_OPERATION_NAME,
GEN_AI_USAGE_INPUT_TOKENS,
GEN_AI_USAGE_OUTPUT_TOKENS,
GEN_AI_USAGE_TOTAL_TOKENS,
} from '@sentry/conventions/attributes';
import { createRunner } from '../../../../runner';

it('captures a transaction with Vercel AI v6 spans via @sentry/cloudflare vercelAIIntegration', async ({ signal }) => {
Expand Down Expand Up @@ -32,10 +32,10 @@ it('captures a transaction with Vercel AI v6 spans via @sentry/cloudflare vercel
attributes: expect.objectContaining({
'sentry.op': { type: 'string', value: 'gen_ai.invoke_agent' },
'sentry.origin': { type: 'string', value: 'auto.vercelai.otel' },
[GEN_AI_OPERATION_NAME_ATTRIBUTE]: { type: 'string', value: 'invoke_agent' },
[GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE]: { type: 'integer', value: 10 },
[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE]: { type: 'integer', value: 20 },
[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE]: { type: 'integer', value: 30 },
[GEN_AI_OPERATION_NAME]: { type: 'string', value: 'invoke_agent' },
[GEN_AI_USAGE_INPUT_TOKENS]: { type: 'integer', value: 10 },
[GEN_AI_USAGE_OUTPUT_TOKENS]: { type: 'integer', value: 20 },
[GEN_AI_USAGE_TOTAL_TOKENS]: { type: 'integer', value: 30 },
}),
},
{
Expand All @@ -50,7 +50,7 @@ it('captures a transaction with Vercel AI v6 spans via @sentry/cloudflare vercel
attributes: expect.objectContaining({
'sentry.op': { type: 'string', value: 'gen_ai.generate_content' },
'sentry.origin': { type: 'string', value: 'auto.vercelai.otel' },
[GEN_AI_OPERATION_NAME_ATTRIBUTE]: { type: 'string', value: 'generate_content' },
[GEN_AI_OPERATION_NAME]: { type: 'string', value: 'generate_content' },
}),
},
]),
Expand Down
Loading
Loading