@sentry/node 9.26.0 → 9.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/index.js +2 -0
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/integrations/anr/index.js +1 -1
- package/build/cjs/integrations/local-variables/local-variables-async.js +1 -1
- package/build/cjs/integrations/tracing/vercelai/ai_sdk_attributes.js +128 -0
- package/build/cjs/integrations/tracing/vercelai/ai_sdk_attributes.js.map +1 -0
- package/build/cjs/integrations/tracing/vercelai/constants.js +6 -0
- package/build/cjs/integrations/tracing/vercelai/constants.js.map +1 -0
- package/build/cjs/integrations/tracing/vercelai/index.js +113 -89
- package/build/cjs/integrations/tracing/vercelai/index.js.map +1 -1
- package/build/cjs/integrations/tracing/vercelai/instrumentation.js +56 -10
- package/build/cjs/integrations/tracing/vercelai/instrumentation.js.map +1 -1
- package/build/esm/index.js +1 -0
- package/build/esm/index.js.map +1 -1
- package/build/esm/integrations/anr/index.js +1 -1
- package/build/esm/integrations/anr/worker-script.js +2 -2
- package/build/esm/integrations/local-variables/local-variables-async.js +1 -1
- package/build/esm/integrations/local-variables/worker-script.js +2 -2
- package/build/esm/integrations/tracing/vercelai/ai_sdk_attributes.js +116 -0
- package/build/esm/integrations/tracing/vercelai/ai_sdk_attributes.js.map +1 -0
- package/build/esm/integrations/tracing/vercelai/constants.js +4 -0
- package/build/esm/integrations/tracing/vercelai/constants.js.map +1 -0
- package/build/esm/integrations/tracing/vercelai/index.js +111 -87
- package/build/esm/integrations/tracing/vercelai/index.js.map +1 -1
- package/build/esm/integrations/tracing/vercelai/instrumentation.js +57 -12
- package/build/esm/integrations/tracing/vercelai/instrumentation.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/types/index.d.ts +1 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/vercelai/ai_sdk_attributes.d.ts +669 -0
- package/build/types/integrations/tracing/vercelai/ai_sdk_attributes.d.ts.map +1 -0
- package/build/types/integrations/tracing/vercelai/constants.d.ts +2 -0
- package/build/types/integrations/tracing/vercelai/constants.d.ts.map +1 -0
- package/build/types/integrations/tracing/vercelai/index.d.ts +2 -1
- package/build/types/integrations/tracing/vercelai/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/vercelai/instrumentation.d.ts +18 -0
- package/build/types/integrations/tracing/vercelai/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/vercelai/types.d.ts +16 -0
- package/build/types/integrations/tracing/vercelai/types.d.ts.map +1 -1
- package/build/types-ts3.8/index.d.ts +1 -0
- package/build/types-ts3.8/integrations/tracing/vercelai/ai_sdk_attributes.d.ts +669 -0
- package/build/types-ts3.8/integrations/tracing/vercelai/constants.d.ts +2 -0
- package/build/types-ts3.8/integrations/tracing/vercelai/index.d.ts +2 -1
- package/build/types-ts3.8/integrations/tracing/vercelai/instrumentation.d.ts +18 -0
- package/build/types-ts3.8/integrations/tracing/vercelai/types.d.ts +16 -0
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai_sdk_attributes.js","sources":["../../../../../src/integrations/tracing/vercelai/ai_sdk_attributes.ts"],"sourcesContent":["/**\n * AI SDK Telemetry Attributes\n * Based on https://ai-sdk.dev/docs/ai-sdk-core/telemetry#collected-data\n */\n\n// =============================================================================\n// COMMON ATTRIBUTES\n// =============================================================================\n\n/**\n * Common attribute for operation name across all functions and spans\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#collected-data\n */\nexport const OPERATION_NAME_ATTRIBUTE = 'operation.name';\n\n/**\n * Common attribute for AI operation ID across all functions and spans\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#collected-data\n */\nexport const AI_OPERATION_ID_ATTRIBUTE = 'ai.operationId';\n\n// =============================================================================\n// SHARED ATTRIBUTES\n// =============================================================================\n\n/**\n * `generateText` function - `ai.generateText` span\n * `streamText` function - `ai.streamText` span\n *\n * The prompt that was used when calling the function\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generatetext-function\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamtext-function\n */\nexport const AI_PROMPT_ATTRIBUTE = 'ai.prompt';\n\n/**\n * `generateObject` function - `ai.generateObject` span\n * `streamObject` function - `ai.streamObject` span\n *\n * The JSON schema version of the schema that was passed into the function\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generateobject-function\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamobject-function\n */\nexport const AI_SCHEMA_ATTRIBUTE = 'ai.schema';\n\n/**\n * `generateObject` function - `ai.generateObject` span\n * `streamObject` function - `ai.streamObject` span\n *\n * The name of the schema that was passed into the function\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generateobject-function\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamobject-function\n */\nexport const AI_SCHEMA_NAME_ATTRIBUTE = 'ai.schema.name';\n\n/**\n * `generateObject` function - `ai.generateObject` span\n * `streamObject` function - `ai.streamObject` span\n *\n * The description of the schema that was passed into the function\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generateobject-function\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamobject-function\n */\nexport const AI_SCHEMA_DESCRIPTION_ATTRIBUTE = 'ai.schema.description';\n\n/**\n * `generateObject` function - `ai.generateObject` span\n * `streamObject` function - `ai.streamObject` span\n *\n * The object that was generated (stringified JSON)\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generateobject-function\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamobject-function\n */\nexport const AI_RESPONSE_OBJECT_ATTRIBUTE = 'ai.response.object';\n\n/**\n * `generateObject` function - `ai.generateObject` span\n * `streamObject` function - `ai.streamObject` span\n *\n * The object generation mode, e.g. `json`\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generateobject-function\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamobject-function\n */\nexport const AI_SETTINGS_MODE_ATTRIBUTE = 'ai.settings.mode';\n\n/**\n * `generateObject` function - `ai.generateObject` span\n * `streamObject` function - `ai.streamObject` span\n *\n * The output type that was used, e.g. `object` or `no-schema`\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generateobject-function\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamobject-function\n */\nexport const AI_SETTINGS_OUTPUT_ATTRIBUTE = 'ai.settings.output';\n\n/**\n * `embed` function - `ai.embed.doEmbed` span\n * `embedMany` function - `ai.embedMany` span\n *\n * The values that were passed into the function (array)\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#embed-function\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#embedmany-function\n */\nexport const AI_VALUES_ATTRIBUTE = 'ai.values';\n\n/**\n * `embed` function - `ai.embed.doEmbed` span\n * `embedMany` function - `ai.embedMany` span\n *\n * An array of JSON-stringified embeddings\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#embed-function\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#embedmany-function\n */\nexport const AI_EMBEDDINGS_ATTRIBUTE = 'ai.embeddings';\n\n// =============================================================================\n// GENERATETEXT FUNCTION - UNIQUE ATTRIBUTES\n// =============================================================================\n\n/**\n * `generateText` function - `ai.generateText` span\n *\n * The text that was generated\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generatetext-function\n */\nexport const AI_RESPONSE_TEXT_ATTRIBUTE = 'ai.response.text';\n\n/**\n * `generateText` function - `ai.generateText` span\n *\n * The tool calls that were made as part of the generation (stringified JSON)\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generatetext-function\n */\nexport const AI_RESPONSE_TOOL_CALLS_ATTRIBUTE = 'ai.response.toolCalls';\n\n/**\n * `generateText` function - `ai.generateText` span\n *\n * The reason why the generation finished\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generatetext-function\n */\nexport const AI_RESPONSE_FINISH_REASON_ATTRIBUTE = 'ai.response.finishReason';\n\n/**\n * `generateText` function - `ai.generateText` span\n *\n * The maximum number of steps that were set\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generatetext-function\n */\nexport const AI_SETTINGS_MAX_STEPS_ATTRIBUTE = 'ai.settings.maxSteps';\n\n/**\n * `generateText` function - `ai.generateText.doGenerate` span\n *\n * The format of the prompt\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generatetext-function\n */\nexport const AI_PROMPT_FORMAT_ATTRIBUTE = 'ai.prompt.format';\n\n/**\n * `generateText` function - `ai.generateText.doGenerate` span\n *\n * The messages that were passed into the provider\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generatetext-function\n */\nexport const AI_PROMPT_MESSAGES_ATTRIBUTE = 'ai.prompt.messages';\n\n/**\n * `generateText` function - `ai.generateText.doGenerate` span\n *\n * Array of stringified tool definitions\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generatetext-function\n */\nexport const AI_PROMPT_TOOLS_ATTRIBUTE = 'ai.prompt.tools';\n\n/**\n * `generateText` function - `ai.generateText.doGenerate` span\n *\n * The stringified tool choice setting (JSON)\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generatetext-function\n */\nexport const AI_PROMPT_TOOL_CHOICE_ATTRIBUTE = 'ai.prompt.toolChoice';\n\n// =============================================================================\n// STREAMTEXT FUNCTION - UNIQUE ATTRIBUTES\n// =============================================================================\n\n/**\n * `streamText` function - `ai.streamText.doStream` span\n *\n * The time it took to receive the first chunk in milliseconds\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamtext-function\n */\nexport const AI_RESPONSE_MS_TO_FIRST_CHUNK_ATTRIBUTE = 'ai.response.msToFirstChunk';\n\n/**\n * `streamText` function - `ai.streamText.doStream` span\n *\n * The time it took to receive the finish part of the LLM stream in milliseconds\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamtext-function\n */\nexport const AI_RESPONSE_MS_TO_FINISH_ATTRIBUTE = 'ai.response.msToFinish';\n\n/**\n * `streamText` function - `ai.streamText.doStream` span\n *\n * The average completion tokens per second\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamtext-function\n */\nexport const AI_RESPONSE_AVG_COMPLETION_TOKENS_PER_SECOND_ATTRIBUTE = 'ai.response.avgCompletionTokensPerSecond';\n\n// =============================================================================\n// EMBED FUNCTION - UNIQUE ATTRIBUTES\n// =============================================================================\n\n/**\n * `embed` function - `ai.embed` span\n *\n * The value that was passed into the `embed` function\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#embed-function\n */\nexport const AI_VALUE_ATTRIBUTE = 'ai.value';\n\n/**\n * `embed` function - `ai.embed` span\n *\n * A JSON-stringified embedding\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#embed-function\n */\nexport const AI_EMBEDDING_ATTRIBUTE = 'ai.embedding';\n\n// =============================================================================\n// BASIC LLM SPAN INFORMATION\n// =============================================================================\n\n/**\n * Basic LLM span information\n * Multiple spans\n *\n * The functionId that was set through `telemetry.functionId`\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#basic-llm-span-information\n */\nexport const RESOURCE_NAME_ATTRIBUTE = 'resource.name';\n\n/**\n * Basic LLM span information\n * Multiple spans\n *\n * The id of the model\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#basic-llm-span-information\n */\nexport const AI_MODEL_ID_ATTRIBUTE = 'ai.model.id';\n\n/**\n * Basic LLM span information\n * Multiple spans\n *\n * The provider of the model\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#basic-llm-span-information\n */\nexport const AI_MODEL_PROVIDER_ATTRIBUTE = 'ai.model.provider';\n\n/**\n * Basic LLM span information\n * Multiple spans\n *\n * The request headers that were passed in through `headers`\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#basic-llm-span-information\n */\nexport const AI_REQUEST_HEADERS_ATTRIBUTE = 'ai.request.headers';\n\n/**\n * Basic LLM span information\n * Multiple spans\n *\n * The maximum number of retries that were set\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#basic-llm-span-information\n */\nexport const AI_SETTINGS_MAX_RETRIES_ATTRIBUTE = 'ai.settings.maxRetries';\n\n/**\n * Basic LLM span information\n * Multiple spans\n *\n * The functionId that was set through `telemetry.functionId`\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#basic-llm-span-information\n */\nexport const AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE = 'ai.telemetry.functionId';\n\n/**\n * Basic LLM span information\n * Multiple spans\n *\n * The metadata that was passed in through `telemetry.metadata`\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#basic-llm-span-information\n */\nexport const AI_TELEMETRY_METADATA_ATTRIBUTE = 'ai.telemetry.metadata';\n\n/**\n * Basic LLM span information\n * Multiple spans\n *\n * The number of completion tokens that were used\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#basic-llm-span-information\n */\nexport const AI_USAGE_COMPLETION_TOKENS_ATTRIBUTE = 'ai.usage.completionTokens';\n\n/**\n * Basic LLM span information\n * Multiple spans\n *\n * The number of prompt tokens that were used\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#basic-llm-span-information\n */\nexport const AI_USAGE_PROMPT_TOKENS_ATTRIBUTE = 'ai.usage.promptTokens';\n\n// =============================================================================\n// CALL LLM SPAN INFORMATION\n// =============================================================================\n\n/**\n * Call LLM span information\n * Individual LLM call spans\n *\n * The model that was used to generate the response\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information\n */\nexport const AI_RESPONSE_MODEL_ATTRIBUTE = 'ai.response.model';\n\n/**\n * Call LLM span information\n * Individual LLM call spans\n *\n * The id of the response\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information\n */\nexport const AI_RESPONSE_ID_ATTRIBUTE = 'ai.response.id';\n\n/**\n * Call LLM span information\n * Individual LLM call spans\n *\n * The timestamp of the response\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information\n */\nexport const AI_RESPONSE_TIMESTAMP_ATTRIBUTE = 'ai.response.timestamp';\n\n// =============================================================================\n// SEMANTIC CONVENTIONS FOR GENAI OPERATIONS\n// =============================================================================\n\n/**\n * Semantic Conventions for GenAI operations\n * Individual LLM call spans\n *\n * The provider that was used\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information\n */\nexport const GEN_AI_SYSTEM_ATTRIBUTE = 'gen_ai.system';\n\n/**\n * Semantic Conventions for GenAI operations\n * Individual LLM call spans\n *\n * The model that was requested\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information\n */\nexport const GEN_AI_REQUEST_MODEL_ATTRIBUTE = 'gen_ai.request.model';\n\n/**\n * Semantic Conventions for GenAI operations\n * Individual LLM call spans\n *\n * The temperature that was set\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information\n */\nexport const GEN_AI_REQUEST_TEMPERATURE_ATTRIBUTE = 'gen_ai.request.temperature';\n\n/**\n * Semantic Conventions for GenAI operations\n * Individual LLM call spans\n *\n * The maximum number of tokens that were set\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information\n */\nexport const GEN_AI_REQUEST_MAX_TOKENS_ATTRIBUTE = 'gen_ai.request.max_tokens';\n\n/**\n * Semantic Conventions for GenAI operations\n * Individual LLM call spans\n *\n * The frequency penalty that was set\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information\n */\nexport const GEN_AI_REQUEST_FREQUENCY_PENALTY_ATTRIBUTE = 'gen_ai.request.frequency_penalty';\n\n/**\n * Semantic Conventions for GenAI operations\n * Individual LLM call spans\n *\n * The presence penalty that was set\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information\n */\nexport const GEN_AI_REQUEST_PRESENCE_PENALTY_ATTRIBUTE = 'gen_ai.request.presence_penalty';\n\n/**\n * Semantic Conventions for GenAI operations\n * Individual LLM call spans\n *\n * The topK parameter value that was set\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information\n */\nexport const GEN_AI_REQUEST_TOP_K_ATTRIBUTE = 'gen_ai.request.top_k';\n\n/**\n * Semantic Conventions for GenAI operations\n * Individual LLM call spans\n *\n * The topP parameter value that was set\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information\n */\nexport const GEN_AI_REQUEST_TOP_P_ATTRIBUTE = 'gen_ai.request.top_p';\n\n/**\n * Semantic Conventions for GenAI operations\n * Individual LLM call spans\n *\n * The stop sequences\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information\n */\nexport const GEN_AI_REQUEST_STOP_SEQUENCES_ATTRIBUTE = 'gen_ai.request.stop_sequences';\n\n/**\n * Semantic Conventions for GenAI operations\n * Individual LLM call spans\n *\n * The finish reasons that were returned by the provider\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information\n */\nexport const GEN_AI_RESPONSE_FINISH_REASONS_ATTRIBUTE = 'gen_ai.response.finish_reasons';\n\n/**\n * Semantic Conventions for GenAI operations\n * Individual LLM call spans\n *\n * The model that was used to generate the response\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information\n */\nexport const GEN_AI_RESPONSE_MODEL_ATTRIBUTE = 'gen_ai.response.model';\n\n/**\n * Semantic Conventions for GenAI operations\n * Individual LLM call spans\n *\n * The id of the response\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information\n */\nexport const GEN_AI_RESPONSE_ID_ATTRIBUTE = 'gen_ai.response.id';\n\n/**\n * Semantic Conventions for GenAI operations\n * Individual LLM call spans\n *\n * The number of prompt tokens that were used\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information\n */\nexport const GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE = 'gen_ai.usage.input_tokens';\n\n/**\n * Semantic Conventions for GenAI operations\n * Individual LLM call spans\n *\n * The number of completion tokens that were used\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#call-llm-span-information\n */\nexport const GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE = 'gen_ai.usage.output_tokens';\n\n// =============================================================================\n// BASIC EMBEDDING SPAN INFORMATION\n// =============================================================================\n\n/**\n * Basic embedding span information\n * Embedding spans\n *\n * The number of tokens that were used\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#basic-embedding-span-information\n */\nexport const AI_USAGE_TOKENS_ATTRIBUTE = 'ai.usage.tokens';\n\n// =============================================================================\n// TOOL CALL SPANS\n// =============================================================================\n\n/**\n * Tool call spans\n * `ai.toolCall` span\n *\n * The name of the tool\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#tool-call-spans\n */\nexport const AI_TOOL_CALL_NAME_ATTRIBUTE = 'ai.toolCall.name';\n\n/**\n * Tool call spans\n * `ai.toolCall` span\n *\n * The id of the tool call\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#tool-call-spans\n */\nexport const AI_TOOL_CALL_ID_ATTRIBUTE = 'ai.toolCall.id';\n\n/**\n * Tool call spans\n * `ai.toolCall` span\n *\n * The parameters of the tool call\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#tool-call-spans\n */\nexport const AI_TOOL_CALL_ARGS_ATTRIBUTE = 'ai.toolCall.args';\n\n/**\n * Tool call spans\n * `ai.toolCall` span\n *\n * The result of the tool call\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#tool-call-spans\n */\nexport const AI_TOOL_CALL_RESULT_ATTRIBUTE = 'ai.toolCall.result';\n\n// =============================================================================\n// SPAN ATTRIBUTE OBJECTS\n// =============================================================================\n\n/**\n * Attributes collected for `ai.generateText` span\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generatetext-function\n */\nexport const AI_GENERATE_TEXT_SPAN_ATTRIBUTES = {\n OPERATION_NAME: OPERATION_NAME_ATTRIBUTE,\n AI_OPERATION_ID: AI_OPERATION_ID_ATTRIBUTE,\n AI_PROMPT: AI_PROMPT_ATTRIBUTE,\n AI_RESPONSE_TEXT: AI_RESPONSE_TEXT_ATTRIBUTE,\n AI_RESPONSE_TOOL_CALLS: AI_RESPONSE_TOOL_CALLS_ATTRIBUTE,\n AI_RESPONSE_FINISH_REASON: AI_RESPONSE_FINISH_REASON_ATTRIBUTE,\n AI_SETTINGS_MAX_STEPS: AI_SETTINGS_MAX_STEPS_ATTRIBUTE,\n // Basic LLM span information\n RESOURCE_NAME: RESOURCE_NAME_ATTRIBUTE,\n AI_MODEL_ID: AI_MODEL_ID_ATTRIBUTE,\n AI_MODEL_PROVIDER: AI_MODEL_PROVIDER_ATTRIBUTE,\n AI_REQUEST_HEADERS: AI_REQUEST_HEADERS_ATTRIBUTE,\n AI_SETTINGS_MAX_RETRIES: AI_SETTINGS_MAX_RETRIES_ATTRIBUTE,\n AI_TELEMETRY_FUNCTION_ID: AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE,\n AI_TELEMETRY_METADATA: AI_TELEMETRY_METADATA_ATTRIBUTE,\n AI_USAGE_COMPLETION_TOKENS: AI_USAGE_COMPLETION_TOKENS_ATTRIBUTE,\n AI_USAGE_PROMPT_TOKENS: AI_USAGE_PROMPT_TOKENS_ATTRIBUTE,\n} as const;\n\n/**\n * Attributes collected for `ai.generateText.doGenerate` span\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generatetext-function\n */\nexport const AI_GENERATE_TEXT_DO_GENERATE_SPAN_ATTRIBUTES = {\n OPERATION_NAME: OPERATION_NAME_ATTRIBUTE,\n AI_OPERATION_ID: AI_OPERATION_ID_ATTRIBUTE,\n AI_PROMPT_FORMAT: AI_PROMPT_FORMAT_ATTRIBUTE,\n AI_PROMPT_MESSAGES: AI_PROMPT_MESSAGES_ATTRIBUTE,\n AI_PROMPT_TOOLS: AI_PROMPT_TOOLS_ATTRIBUTE,\n AI_PROMPT_TOOL_CHOICE: AI_PROMPT_TOOL_CHOICE_ATTRIBUTE,\n // Basic LLM span information\n RESOURCE_NAME: RESOURCE_NAME_ATTRIBUTE,\n AI_MODEL_ID: AI_MODEL_ID_ATTRIBUTE,\n AI_MODEL_PROVIDER: AI_MODEL_PROVIDER_ATTRIBUTE,\n AI_REQUEST_HEADERS: AI_REQUEST_HEADERS_ATTRIBUTE,\n AI_SETTINGS_MAX_RETRIES: AI_SETTINGS_MAX_RETRIES_ATTRIBUTE,\n AI_TELEMETRY_FUNCTION_ID: AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE,\n AI_TELEMETRY_METADATA: AI_TELEMETRY_METADATA_ATTRIBUTE,\n AI_USAGE_COMPLETION_TOKENS: AI_USAGE_COMPLETION_TOKENS_ATTRIBUTE,\n AI_USAGE_PROMPT_TOKENS: AI_USAGE_PROMPT_TOKENS_ATTRIBUTE,\n // Call LLM span information\n AI_RESPONSE_MODEL: AI_RESPONSE_MODEL_ATTRIBUTE,\n AI_RESPONSE_ID: AI_RESPONSE_ID_ATTRIBUTE,\n AI_RESPONSE_TIMESTAMP: AI_RESPONSE_TIMESTAMP_ATTRIBUTE,\n // Semantic Conventions for GenAI operations\n GEN_AI_SYSTEM: GEN_AI_SYSTEM_ATTRIBUTE,\n GEN_AI_REQUEST_MODEL: GEN_AI_REQUEST_MODEL_ATTRIBUTE,\n GEN_AI_REQUEST_TEMPERATURE: GEN_AI_REQUEST_TEMPERATURE_ATTRIBUTE,\n GEN_AI_REQUEST_MAX_TOKENS: GEN_AI_REQUEST_MAX_TOKENS_ATTRIBUTE,\n GEN_AI_REQUEST_FREQUENCY_PENALTY: GEN_AI_REQUEST_FREQUENCY_PENALTY_ATTRIBUTE,\n GEN_AI_REQUEST_PRESENCE_PENALTY: GEN_AI_REQUEST_PRESENCE_PENALTY_ATTRIBUTE,\n GEN_AI_REQUEST_TOP_K: GEN_AI_REQUEST_TOP_K_ATTRIBUTE,\n GEN_AI_REQUEST_TOP_P: GEN_AI_REQUEST_TOP_P_ATTRIBUTE,\n GEN_AI_REQUEST_STOP_SEQUENCES: GEN_AI_REQUEST_STOP_SEQUENCES_ATTRIBUTE,\n GEN_AI_RESPONSE_FINISH_REASONS: GEN_AI_RESPONSE_FINISH_REASONS_ATTRIBUTE,\n GEN_AI_RESPONSE_MODEL: GEN_AI_RESPONSE_MODEL_ATTRIBUTE,\n GEN_AI_RESPONSE_ID: GEN_AI_RESPONSE_ID_ATTRIBUTE,\n GEN_AI_USAGE_INPUT_TOKENS: GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE,\n GEN_AI_USAGE_OUTPUT_TOKENS: GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE,\n} as const;\n\n/**\n * Attributes collected for `ai.streamText` span\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamtext-function\n */\nexport const AI_STREAM_TEXT_SPAN_ATTRIBUTES = {\n OPERATION_NAME: OPERATION_NAME_ATTRIBUTE,\n AI_OPERATION_ID: AI_OPERATION_ID_ATTRIBUTE,\n AI_PROMPT: AI_PROMPT_ATTRIBUTE,\n // Basic LLM span information\n RESOURCE_NAME: RESOURCE_NAME_ATTRIBUTE,\n AI_MODEL_ID: AI_MODEL_ID_ATTRIBUTE,\n AI_MODEL_PROVIDER: AI_MODEL_PROVIDER_ATTRIBUTE,\n AI_REQUEST_HEADERS: AI_REQUEST_HEADERS_ATTRIBUTE,\n AI_SETTINGS_MAX_RETRIES: AI_SETTINGS_MAX_RETRIES_ATTRIBUTE,\n AI_TELEMETRY_FUNCTION_ID: AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE,\n AI_TELEMETRY_METADATA: AI_TELEMETRY_METADATA_ATTRIBUTE,\n AI_USAGE_COMPLETION_TOKENS: AI_USAGE_COMPLETION_TOKENS_ATTRIBUTE,\n AI_USAGE_PROMPT_TOKENS: AI_USAGE_PROMPT_TOKENS_ATTRIBUTE,\n} as const;\n\n/**\n * Attributes collected for `ai.streamText.doStream` span\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamtext-function\n */\nexport const AI_STREAM_TEXT_DO_STREAM_SPAN_ATTRIBUTES = {\n OPERATION_NAME: OPERATION_NAME_ATTRIBUTE,\n AI_OPERATION_ID: AI_OPERATION_ID_ATTRIBUTE,\n AI_RESPONSE_MS_TO_FIRST_CHUNK: AI_RESPONSE_MS_TO_FIRST_CHUNK_ATTRIBUTE,\n AI_RESPONSE_MS_TO_FINISH: AI_RESPONSE_MS_TO_FINISH_ATTRIBUTE,\n AI_RESPONSE_AVG_COMPLETION_TOKENS_PER_SECOND: AI_RESPONSE_AVG_COMPLETION_TOKENS_PER_SECOND_ATTRIBUTE,\n // Basic LLM span information\n RESOURCE_NAME: RESOURCE_NAME_ATTRIBUTE,\n AI_MODEL_ID: AI_MODEL_ID_ATTRIBUTE,\n AI_MODEL_PROVIDER: AI_MODEL_PROVIDER_ATTRIBUTE,\n AI_REQUEST_HEADERS: AI_REQUEST_HEADERS_ATTRIBUTE,\n AI_SETTINGS_MAX_RETRIES: AI_SETTINGS_MAX_RETRIES_ATTRIBUTE,\n AI_TELEMETRY_FUNCTION_ID: AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE,\n AI_TELEMETRY_METADATA: AI_TELEMETRY_METADATA_ATTRIBUTE,\n AI_USAGE_COMPLETION_TOKENS: AI_USAGE_COMPLETION_TOKENS_ATTRIBUTE,\n AI_USAGE_PROMPT_TOKENS: AI_USAGE_PROMPT_TOKENS_ATTRIBUTE,\n // Call LLM span information\n AI_RESPONSE_MODEL: AI_RESPONSE_MODEL_ATTRIBUTE,\n AI_RESPONSE_ID: AI_RESPONSE_ID_ATTRIBUTE,\n AI_RESPONSE_TIMESTAMP: AI_RESPONSE_TIMESTAMP_ATTRIBUTE,\n // Semantic Conventions for GenAI operations\n GEN_AI_SYSTEM: GEN_AI_SYSTEM_ATTRIBUTE,\n GEN_AI_REQUEST_MODEL: GEN_AI_REQUEST_MODEL_ATTRIBUTE,\n GEN_AI_REQUEST_TEMPERATURE: GEN_AI_REQUEST_TEMPERATURE_ATTRIBUTE,\n GEN_AI_REQUEST_MAX_TOKENS: GEN_AI_REQUEST_MAX_TOKENS_ATTRIBUTE,\n GEN_AI_REQUEST_FREQUENCY_PENALTY: GEN_AI_REQUEST_FREQUENCY_PENALTY_ATTRIBUTE,\n GEN_AI_REQUEST_PRESENCE_PENALTY: GEN_AI_REQUEST_PRESENCE_PENALTY_ATTRIBUTE,\n GEN_AI_REQUEST_TOP_K: GEN_AI_REQUEST_TOP_K_ATTRIBUTE,\n GEN_AI_REQUEST_TOP_P: GEN_AI_REQUEST_TOP_P_ATTRIBUTE,\n GEN_AI_REQUEST_STOP_SEQUENCES: GEN_AI_REQUEST_STOP_SEQUENCES_ATTRIBUTE,\n GEN_AI_RESPONSE_FINISH_REASONS: GEN_AI_RESPONSE_FINISH_REASONS_ATTRIBUTE,\n GEN_AI_RESPONSE_MODEL: GEN_AI_RESPONSE_MODEL_ATTRIBUTE,\n GEN_AI_RESPONSE_ID: GEN_AI_RESPONSE_ID_ATTRIBUTE,\n GEN_AI_USAGE_INPUT_TOKENS: GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE,\n GEN_AI_USAGE_OUTPUT_TOKENS: GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE,\n} as const;\n\n/**\n * Attributes collected for `ai.generateObject` span\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#generateobject-function\n */\nexport const AI_GENERATE_OBJECT_SPAN_ATTRIBUTES = {\n OPERATION_NAME: OPERATION_NAME_ATTRIBUTE,\n AI_OPERATION_ID: AI_OPERATION_ID_ATTRIBUTE,\n AI_SCHEMA: AI_SCHEMA_ATTRIBUTE,\n AI_SCHEMA_NAME: AI_SCHEMA_NAME_ATTRIBUTE,\n AI_SCHEMA_DESCRIPTION: AI_SCHEMA_DESCRIPTION_ATTRIBUTE,\n AI_RESPONSE_OBJECT: AI_RESPONSE_OBJECT_ATTRIBUTE,\n AI_SETTINGS_MODE: AI_SETTINGS_MODE_ATTRIBUTE,\n AI_SETTINGS_OUTPUT: AI_SETTINGS_OUTPUT_ATTRIBUTE,\n // Basic LLM span information\n RESOURCE_NAME: RESOURCE_NAME_ATTRIBUTE,\n AI_MODEL_ID: AI_MODEL_ID_ATTRIBUTE,\n AI_MODEL_PROVIDER: AI_MODEL_PROVIDER_ATTRIBUTE,\n AI_REQUEST_HEADERS: AI_REQUEST_HEADERS_ATTRIBUTE,\n AI_SETTINGS_MAX_RETRIES: AI_SETTINGS_MAX_RETRIES_ATTRIBUTE,\n AI_TELEMETRY_FUNCTION_ID: AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE,\n AI_TELEMETRY_METADATA: AI_TELEMETRY_METADATA_ATTRIBUTE,\n AI_USAGE_COMPLETION_TOKENS: AI_USAGE_COMPLETION_TOKENS_ATTRIBUTE,\n AI_USAGE_PROMPT_TOKENS: AI_USAGE_PROMPT_TOKENS_ATTRIBUTE,\n} as const;\n\n/**\n * Attributes collected for `ai.streamObject` span\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#streamobject-function\n */\nexport const AI_STREAM_OBJECT_SPAN_ATTRIBUTES = {\n OPERATION_NAME: OPERATION_NAME_ATTRIBUTE,\n AI_OPERATION_ID: AI_OPERATION_ID_ATTRIBUTE,\n AI_SCHEMA: AI_SCHEMA_ATTRIBUTE,\n AI_SCHEMA_NAME: AI_SCHEMA_NAME_ATTRIBUTE,\n AI_SCHEMA_DESCRIPTION: AI_SCHEMA_DESCRIPTION_ATTRIBUTE,\n AI_RESPONSE_OBJECT: AI_RESPONSE_OBJECT_ATTRIBUTE,\n AI_SETTINGS_MODE: AI_SETTINGS_MODE_ATTRIBUTE,\n AI_SETTINGS_OUTPUT: AI_SETTINGS_OUTPUT_ATTRIBUTE,\n // Basic LLM span information\n RESOURCE_NAME: RESOURCE_NAME_ATTRIBUTE,\n AI_MODEL_ID: AI_MODEL_ID_ATTRIBUTE,\n AI_MODEL_PROVIDER: AI_MODEL_PROVIDER_ATTRIBUTE,\n AI_REQUEST_HEADERS: AI_REQUEST_HEADERS_ATTRIBUTE,\n AI_SETTINGS_MAX_RETRIES: AI_SETTINGS_MAX_RETRIES_ATTRIBUTE,\n AI_TELEMETRY_FUNCTION_ID: AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE,\n AI_TELEMETRY_METADATA: AI_TELEMETRY_METADATA_ATTRIBUTE,\n AI_USAGE_COMPLETION_TOKENS: AI_USAGE_COMPLETION_TOKENS_ATTRIBUTE,\n AI_USAGE_PROMPT_TOKENS: AI_USAGE_PROMPT_TOKENS_ATTRIBUTE,\n} as const;\n\n/**\n * Attributes collected for `ai.embed` span\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#embed-function\n */\nexport const AI_EMBED_SPAN_ATTRIBUTES = {\n OPERATION_NAME: OPERATION_NAME_ATTRIBUTE,\n AI_OPERATION_ID: AI_OPERATION_ID_ATTRIBUTE,\n AI_VALUE: AI_VALUE_ATTRIBUTE,\n AI_EMBEDDING: AI_EMBEDDING_ATTRIBUTE,\n // Basic LLM span information\n RESOURCE_NAME: RESOURCE_NAME_ATTRIBUTE,\n AI_MODEL_ID: AI_MODEL_ID_ATTRIBUTE,\n AI_MODEL_PROVIDER: AI_MODEL_PROVIDER_ATTRIBUTE,\n AI_REQUEST_HEADERS: AI_REQUEST_HEADERS_ATTRIBUTE,\n AI_SETTINGS_MAX_RETRIES: AI_SETTINGS_MAX_RETRIES_ATTRIBUTE,\n AI_TELEMETRY_FUNCTION_ID: AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE,\n AI_TELEMETRY_METADATA: AI_TELEMETRY_METADATA_ATTRIBUTE,\n // Basic embedding span information\n AI_USAGE_TOKENS: AI_USAGE_TOKENS_ATTRIBUTE,\n} as const;\n\n/**\n * Attributes collected for `ai.embed.doEmbed` span\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#embed-function\n */\nexport const AI_EMBED_DO_EMBED_SPAN_ATTRIBUTES = {\n OPERATION_NAME: OPERATION_NAME_ATTRIBUTE,\n AI_OPERATION_ID: AI_OPERATION_ID_ATTRIBUTE,\n AI_VALUES: AI_VALUES_ATTRIBUTE,\n AI_EMBEDDINGS: AI_EMBEDDINGS_ATTRIBUTE,\n // Basic LLM span information\n RESOURCE_NAME: RESOURCE_NAME_ATTRIBUTE,\n AI_MODEL_ID: AI_MODEL_ID_ATTRIBUTE,\n AI_MODEL_PROVIDER: AI_MODEL_PROVIDER_ATTRIBUTE,\n AI_REQUEST_HEADERS: AI_REQUEST_HEADERS_ATTRIBUTE,\n AI_SETTINGS_MAX_RETRIES: AI_SETTINGS_MAX_RETRIES_ATTRIBUTE,\n AI_TELEMETRY_FUNCTION_ID: AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE,\n AI_TELEMETRY_METADATA: AI_TELEMETRY_METADATA_ATTRIBUTE,\n // Basic embedding span information\n AI_USAGE_TOKENS: AI_USAGE_TOKENS_ATTRIBUTE,\n} as const;\n\n/**\n * Attributes collected for `ai.embedMany` span\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#embedmany-function\n */\nexport const AI_EMBED_MANY_SPAN_ATTRIBUTES = {\n OPERATION_NAME: OPERATION_NAME_ATTRIBUTE,\n AI_OPERATION_ID: AI_OPERATION_ID_ATTRIBUTE,\n AI_VALUES: AI_VALUES_ATTRIBUTE,\n AI_EMBEDDINGS: AI_EMBEDDINGS_ATTRIBUTE,\n // Basic LLM span information\n RESOURCE_NAME: RESOURCE_NAME_ATTRIBUTE,\n AI_MODEL_ID: AI_MODEL_ID_ATTRIBUTE,\n AI_MODEL_PROVIDER: AI_MODEL_PROVIDER_ATTRIBUTE,\n AI_REQUEST_HEADERS: AI_REQUEST_HEADERS_ATTRIBUTE,\n AI_SETTINGS_MAX_RETRIES: AI_SETTINGS_MAX_RETRIES_ATTRIBUTE,\n AI_TELEMETRY_FUNCTION_ID: AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE,\n AI_TELEMETRY_METADATA: AI_TELEMETRY_METADATA_ATTRIBUTE,\n // Basic embedding span information\n AI_USAGE_TOKENS: AI_USAGE_TOKENS_ATTRIBUTE,\n} as const;\n\n/**\n * Attributes collected for `ai.toolCall` span\n * @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#tool-call-spans\n */\nexport const AI_TOOL_CALL_SPAN_ATTRIBUTES = {\n OPERATION_NAME: OPERATION_NAME_ATTRIBUTE,\n AI_OPERATION_ID: AI_OPERATION_ID_ATTRIBUTE,\n AI_TOOL_CALL_NAME: AI_TOOL_CALL_NAME_ATTRIBUTE,\n AI_TOOL_CALL_ID: AI_TOOL_CALL_ID_ATTRIBUTE,\n AI_TOOL_CALL_ARGS: AI_TOOL_CALL_ARGS_ATTRIBUTE,\n AI_TOOL_CALL_RESULT: AI_TOOL_CALL_RESULT_ATTRIBUTE,\n // Basic LLM span information\n RESOURCE_NAME: RESOURCE_NAME_ATTRIBUTE,\n AI_MODEL_ID: AI_MODEL_ID_ATTRIBUTE,\n AI_MODEL_PROVIDER: AI_MODEL_PROVIDER_ATTRIBUTE,\n AI_REQUEST_HEADERS: AI_REQUEST_HEADERS_ATTRIBUTE,\n AI_SETTINGS_MAX_RETRIES: AI_SETTINGS_MAX_RETRIES_ATTRIBUTE,\n AI_TELEMETRY_FUNCTION_ID: AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE,\n AI_TELEMETRY_METADATA: AI_TELEMETRY_METADATA_ATTRIBUTE,\n} as const;\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;;;AAkBA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,mBAAoB,GAAE;;AAmNnC;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,qBAAsB,GAAE;;AAErC;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,2BAA4B,GAAE;;AAoB3C;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,kCAAmC,GAAE;;AAWlD;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,oCAAqC,GAAE;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,gCAAiC,GAAE;;AA+HhD;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,+BAAgC,GAAE;;AAW/C;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,mCAAoC,GAAE;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,oCAAqC,GAAE;;AAepD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,2BAA4B,GAAE;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,yBAA0B,GAAE;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../../../src/integrations/tracing/vercelai/constants.ts"],"sourcesContent":["export const INTEGRATION_NAME = 'VercelAI';\n"],"names":[],"mappings":"AAAO,MAAM,gBAAiB,GAAE;;;;"}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { defineIntegration, spanToJSON, SEMANTIC_ATTRIBUTE_SENTRY_OP } from '@sentry/core';
|
|
2
2
|
import { generateInstrumentOnce } from '../../../otel/instrument.js';
|
|
3
3
|
import { addOriginToSpan } from '../../../utils/addOriginToSpan.js';
|
|
4
|
+
import { AI_TOOL_CALL_NAME_ATTRIBUTE, AI_TOOL_CALL_ID_ATTRIBUTE, AI_MODEL_ID_ATTRIBUTE, AI_MODEL_PROVIDER_ATTRIBUTE, AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE, AI_PROMPT_ATTRIBUTE, GEN_AI_RESPONSE_MODEL_ATTRIBUTE, AI_USAGE_COMPLETION_TOKENS_ATTRIBUTE, GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE, AI_USAGE_PROMPT_TOKENS_ATTRIBUTE, GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE } from './ai_sdk_attributes.js';
|
|
5
|
+
import { INTEGRATION_NAME } from './constants.js';
|
|
4
6
|
import { SentryVercelAiInstrumentation } from './instrumentation.js';
|
|
5
7
|
|
|
6
|
-
const INTEGRATION_NAME = 'VercelAI';
|
|
7
|
-
|
|
8
8
|
const instrumentVercelAi = generateInstrumentOnce(INTEGRATION_NAME, () => new SentryVercelAiInstrumentation({}));
|
|
9
9
|
|
|
10
|
-
const _vercelAIIntegration = (() => {
|
|
10
|
+
const _vercelAIIntegration = ((options = {}) => {
|
|
11
11
|
let instrumentation;
|
|
12
12
|
|
|
13
13
|
return {
|
|
14
14
|
name: INTEGRATION_NAME,
|
|
15
|
+
options,
|
|
15
16
|
setupOnce() {
|
|
16
17
|
instrumentation = instrumentVercelAi();
|
|
17
18
|
},
|
|
@@ -24,81 +25,30 @@ const _vercelAIIntegration = (() => {
|
|
|
24
25
|
return;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
//
|
|
28
|
-
|
|
28
|
+
// Tool call spans
|
|
29
|
+
// https://ai-sdk.dev/docs/ai-sdk-core/telemetry#tool-call-spans
|
|
30
|
+
if (
|
|
31
|
+
attributes[AI_TOOL_CALL_NAME_ATTRIBUTE] &&
|
|
32
|
+
attributes[AI_TOOL_CALL_ID_ATTRIBUTE] &&
|
|
33
|
+
name === 'ai.toolCall'
|
|
34
|
+
) {
|
|
35
|
+
addOriginToSpan(span, 'auto.vercelai.otel');
|
|
36
|
+
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'gen_ai.execute_tool');
|
|
37
|
+
span.setAttribute('gen_ai.tool.call.id', attributes[AI_TOOL_CALL_ID_ATTRIBUTE]);
|
|
38
|
+
span.setAttribute('gen_ai.tool.name', attributes[AI_TOOL_CALL_NAME_ATTRIBUTE]);
|
|
39
|
+
span.updateName(`execute_tool ${attributes[AI_TOOL_CALL_NAME_ATTRIBUTE]}`);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
29
42
|
|
|
43
|
+
// The AI and Provider must be defined for generate, stream, and embed spans.
|
|
44
|
+
// The id of the model
|
|
45
|
+
const aiModelId = attributes[AI_MODEL_ID_ATTRIBUTE];
|
|
30
46
|
// the provider of the model
|
|
31
|
-
const aiModelProvider = attributes[
|
|
32
|
-
|
|
33
|
-
// both of these must be defined for the integration to work
|
|
47
|
+
const aiModelProvider = attributes[AI_MODEL_PROVIDER_ATTRIBUTE];
|
|
34
48
|
if (typeof aiModelId !== 'string' || typeof aiModelProvider !== 'string' || !aiModelId || !aiModelProvider) {
|
|
35
49
|
return;
|
|
36
50
|
}
|
|
37
51
|
|
|
38
|
-
let isPipelineSpan = false;
|
|
39
|
-
|
|
40
|
-
switch (name) {
|
|
41
|
-
case 'ai.generateText': {
|
|
42
|
-
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.generateText');
|
|
43
|
-
isPipelineSpan = true;
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
case 'ai.generateText.doGenerate': {
|
|
47
|
-
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run.doGenerate');
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
case 'ai.streamText': {
|
|
51
|
-
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.streamText');
|
|
52
|
-
isPipelineSpan = true;
|
|
53
|
-
break;
|
|
54
|
-
}
|
|
55
|
-
case 'ai.streamText.doStream': {
|
|
56
|
-
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run.doStream');
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
case 'ai.generateObject': {
|
|
60
|
-
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.generateObject');
|
|
61
|
-
isPipelineSpan = true;
|
|
62
|
-
break;
|
|
63
|
-
}
|
|
64
|
-
case 'ai.generateObject.doGenerate': {
|
|
65
|
-
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run.doGenerate');
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
case 'ai.streamObject': {
|
|
69
|
-
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.streamObject');
|
|
70
|
-
isPipelineSpan = true;
|
|
71
|
-
break;
|
|
72
|
-
}
|
|
73
|
-
case 'ai.streamObject.doStream': {
|
|
74
|
-
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run.doStream');
|
|
75
|
-
break;
|
|
76
|
-
}
|
|
77
|
-
case 'ai.embed': {
|
|
78
|
-
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.embed');
|
|
79
|
-
isPipelineSpan = true;
|
|
80
|
-
break;
|
|
81
|
-
}
|
|
82
|
-
case 'ai.embed.doEmbed': {
|
|
83
|
-
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.embeddings');
|
|
84
|
-
break;
|
|
85
|
-
}
|
|
86
|
-
case 'ai.embedMany': {
|
|
87
|
-
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.embedMany');
|
|
88
|
-
isPipelineSpan = true;
|
|
89
|
-
break;
|
|
90
|
-
}
|
|
91
|
-
case 'ai.embedMany.doEmbed': {
|
|
92
|
-
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.embeddings');
|
|
93
|
-
break;
|
|
94
|
-
}
|
|
95
|
-
case 'ai.toolCall':
|
|
96
|
-
case 'ai.stream.firstChunk':
|
|
97
|
-
case 'ai.stream.finish':
|
|
98
|
-
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run');
|
|
99
|
-
break;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
52
|
addOriginToSpan(span, 'auto.vercelai.otel');
|
|
103
53
|
|
|
104
54
|
const nameWthoutAi = name.replace('ai.', '');
|
|
@@ -106,19 +56,91 @@ const _vercelAIIntegration = (() => {
|
|
|
106
56
|
span.updateName(nameWthoutAi);
|
|
107
57
|
|
|
108
58
|
// If a Telemetry name is set and it is a pipeline span, use that as the operation name
|
|
109
|
-
const functionId = attributes[
|
|
110
|
-
if (functionId && typeof functionId === 'string' &&
|
|
111
|
-
span.updateName(functionId);
|
|
59
|
+
const functionId = attributes[AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE];
|
|
60
|
+
if (functionId && typeof functionId === 'string' && name.split('.').length - 1 === 1) {
|
|
61
|
+
span.updateName(`${nameWthoutAi} ${functionId}`);
|
|
112
62
|
span.setAttribute('ai.pipeline.name', functionId);
|
|
113
63
|
}
|
|
114
64
|
|
|
115
|
-
if (attributes[
|
|
116
|
-
span.setAttribute('
|
|
65
|
+
if (attributes[AI_PROMPT_ATTRIBUTE]) {
|
|
66
|
+
span.setAttribute('gen_ai.prompt', attributes[AI_PROMPT_ATTRIBUTE]);
|
|
117
67
|
}
|
|
118
|
-
if (attributes[
|
|
119
|
-
span.setAttribute(
|
|
68
|
+
if (attributes[AI_MODEL_ID_ATTRIBUTE] && !attributes[GEN_AI_RESPONSE_MODEL_ATTRIBUTE]) {
|
|
69
|
+
span.setAttribute(GEN_AI_RESPONSE_MODEL_ATTRIBUTE, attributes[AI_MODEL_ID_ATTRIBUTE]);
|
|
120
70
|
}
|
|
121
71
|
span.setAttribute('ai.streaming', name.includes('stream'));
|
|
72
|
+
|
|
73
|
+
// Generate Spans
|
|
74
|
+
if (name === 'ai.generateText') {
|
|
75
|
+
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.generate_text');
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (name === 'ai.generateText.doGenerate') {
|
|
80
|
+
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'gen_ai.generate_text');
|
|
81
|
+
span.updateName(`generate_text ${attributes[AI_MODEL_ID_ATTRIBUTE]}`);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (name === 'ai.streamText') {
|
|
86
|
+
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.stream_text');
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (name === 'ai.streamText.doStream') {
|
|
91
|
+
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'gen_ai.stream_text');
|
|
92
|
+
span.updateName(`stream_text ${attributes[AI_MODEL_ID_ATTRIBUTE]}`);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (name === 'ai.generateObject') {
|
|
97
|
+
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.generate_object');
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (name === 'ai.generateObject.doGenerate') {
|
|
102
|
+
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'gen_ai.generate_object');
|
|
103
|
+
span.updateName(`generate_object ${attributes[AI_MODEL_ID_ATTRIBUTE]}`);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (name === 'ai.streamObject') {
|
|
108
|
+
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.stream_object');
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (name === 'ai.streamObject.doStream') {
|
|
113
|
+
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'gen_ai.stream_object');
|
|
114
|
+
span.updateName(`stream_object ${attributes[AI_MODEL_ID_ATTRIBUTE]}`);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (name === 'ai.embed') {
|
|
119
|
+
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.embed');
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (name === 'ai.embed.doEmbed') {
|
|
124
|
+
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'gen_ai.embed');
|
|
125
|
+
span.updateName(`embed ${attributes[AI_MODEL_ID_ATTRIBUTE]}`);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (name === 'ai.embedMany') {
|
|
130
|
+
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.embed_many');
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (name === 'ai.embedMany.doEmbed') {
|
|
135
|
+
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'gen_ai.embed_many');
|
|
136
|
+
span.updateName(`embed_many ${attributes[AI_MODEL_ID_ATTRIBUTE]}`);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (name.startsWith('ai.stream')) {
|
|
141
|
+
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run');
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
122
144
|
});
|
|
123
145
|
|
|
124
146
|
client.addEventProcessor(event => {
|
|
@@ -130,18 +152,20 @@ const _vercelAIIntegration = (() => {
|
|
|
130
152
|
continue;
|
|
131
153
|
}
|
|
132
154
|
|
|
133
|
-
if (attributes[
|
|
134
|
-
attributes[
|
|
155
|
+
if (attributes[AI_USAGE_COMPLETION_TOKENS_ATTRIBUTE] != undefined) {
|
|
156
|
+
attributes[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE] = attributes[AI_USAGE_COMPLETION_TOKENS_ATTRIBUTE];
|
|
157
|
+
delete attributes[AI_USAGE_COMPLETION_TOKENS_ATTRIBUTE];
|
|
135
158
|
}
|
|
136
|
-
if (attributes[
|
|
137
|
-
attributes[
|
|
159
|
+
if (attributes[AI_USAGE_PROMPT_TOKENS_ATTRIBUTE] != undefined) {
|
|
160
|
+
attributes[GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE] = attributes[AI_USAGE_PROMPT_TOKENS_ATTRIBUTE];
|
|
161
|
+
delete attributes[AI_USAGE_PROMPT_TOKENS_ATTRIBUTE];
|
|
138
162
|
}
|
|
139
163
|
if (
|
|
140
|
-
typeof attributes[
|
|
141
|
-
typeof attributes[
|
|
164
|
+
typeof attributes[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE] === 'number' &&
|
|
165
|
+
typeof attributes[GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE] === 'number'
|
|
142
166
|
) {
|
|
143
|
-
attributes['
|
|
144
|
-
attributes[
|
|
167
|
+
attributes['gen_ai.usage.total_tokens'] =
|
|
168
|
+
attributes[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE] + attributes[GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE];
|
|
145
169
|
}
|
|
146
170
|
}
|
|
147
171
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/vercelai/index.ts"],"sourcesContent":["/* eslint-disable complexity */\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration, SEMANTIC_ATTRIBUTE_SENTRY_OP, spanToJSON } from '@sentry/core';\nimport { generateInstrumentOnce } from '../../../otel/instrument';\nimport { addOriginToSpan } from '../../../utils/addOriginToSpan';\nimport { SentryVercelAiInstrumentation } from './instrumentation';\n\nconst INTEGRATION_NAME = 'VercelAI';\n\nexport const instrumentVercelAi = generateInstrumentOnce(INTEGRATION_NAME, () => new SentryVercelAiInstrumentation({}));\n\nconst _vercelAIIntegration = (() => {\n let instrumentation: undefined | SentryVercelAiInstrumentation;\n\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentation = instrumentVercelAi();\n },\n setup(client) {\n instrumentation?.callWhenPatched(() => {\n client.on('spanStart', span => {\n const { data: attributes, description: name } = spanToJSON(span);\n\n if (!name) {\n return;\n }\n\n // The id of the model\n const aiModelId = attributes['ai.model.id'];\n\n // the provider of the model\n const aiModelProvider = attributes['ai.model.provider'];\n\n // both of these must be defined for the integration to work\n if (typeof aiModelId !== 'string' || typeof aiModelProvider !== 'string' || !aiModelId || !aiModelProvider) {\n return;\n }\n\n let isPipelineSpan = false;\n\n switch (name) {\n case 'ai.generateText': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.generateText');\n isPipelineSpan = true;\n break;\n }\n case 'ai.generateText.doGenerate': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run.doGenerate');\n break;\n }\n case 'ai.streamText': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.streamText');\n isPipelineSpan = true;\n break;\n }\n case 'ai.streamText.doStream': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run.doStream');\n break;\n }\n case 'ai.generateObject': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.generateObject');\n isPipelineSpan = true;\n break;\n }\n case 'ai.generateObject.doGenerate': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run.doGenerate');\n break;\n }\n case 'ai.streamObject': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.streamObject');\n isPipelineSpan = true;\n break;\n }\n case 'ai.streamObject.doStream': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run.doStream');\n break;\n }\n case 'ai.embed': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.embed');\n isPipelineSpan = true;\n break;\n }\n case 'ai.embed.doEmbed': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.embeddings');\n break;\n }\n case 'ai.embedMany': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.embedMany');\n isPipelineSpan = true;\n break;\n }\n case 'ai.embedMany.doEmbed': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.embeddings');\n break;\n }\n case 'ai.toolCall':\n case 'ai.stream.firstChunk':\n case 'ai.stream.finish':\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run');\n break;\n }\n\n addOriginToSpan(span, 'auto.vercelai.otel');\n\n const nameWthoutAi = name.replace('ai.', '');\n span.setAttribute('ai.pipeline.name', nameWthoutAi);\n span.updateName(nameWthoutAi);\n\n // If a Telemetry name is set and it is a pipeline span, use that as the operation name\n const functionId = attributes['ai.telemetry.functionId'];\n if (functionId && typeof functionId === 'string' && isPipelineSpan) {\n span.updateName(functionId);\n span.setAttribute('ai.pipeline.name', functionId);\n }\n\n if (attributes['ai.prompt']) {\n span.setAttribute('ai.input_messages', attributes['ai.prompt']);\n }\n if (attributes['ai.model.id']) {\n span.setAttribute('ai.model_id', attributes['ai.model.id']);\n }\n span.setAttribute('ai.streaming', name.includes('stream'));\n });\n\n client.addEventProcessor(event => {\n if (event.type === 'transaction' && event.spans?.length) {\n for (const span of event.spans) {\n const { data: attributes, description: name } = span;\n\n if (!name || span.origin !== 'auto.vercelai.otel') {\n continue;\n }\n\n if (attributes['ai.usage.completionTokens'] != undefined) {\n attributes['ai.completion_tokens.used'] = attributes['ai.usage.completionTokens'];\n }\n if (attributes['ai.usage.promptTokens'] != undefined) {\n attributes['ai.prompt_tokens.used'] = attributes['ai.usage.promptTokens'];\n }\n if (\n typeof attributes['ai.usage.completionTokens'] == 'number' &&\n typeof attributes['ai.usage.promptTokens'] == 'number'\n ) {\n attributes['ai.total_tokens.used'] =\n attributes['ai.usage.completionTokens'] + attributes['ai.usage.promptTokens'];\n }\n }\n }\n\n return event;\n });\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [ai](https://www.npmjs.com/package/ai) library.\n *\n * For more information, see the [`ai` documentation](https://sdk.vercel.ai/docs/ai-sdk-core/telemetry).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.vercelAIIntegration()],\n * });\n * ```\n *\n * By default this integration adds tracing support to all `ai` function calls. If you need to disable\n * collecting spans for a specific call, you can do so by setting `experimental_telemetry.isEnabled` to\n * `false` in the first argument of the function call.\n *\n * ```javascript\n * const result = await generateText({\n * model: openai('gpt-4-turbo'),\n * experimental_telemetry: { isEnabled: false },\n * });\n * ```\n *\n * If you want to collect inputs and outputs for a specific call, you must specifically opt-in to each\n * function call by setting `experimental_telemetry.recordInputs` and `experimental_telemetry.recordOutputs`\n * to `true`.\n *\n * ```javascript\n * const result = await generateText({\n * model: openai('gpt-4-turbo'),\n * experimental_telemetry: { isEnabled: true, recordInputs: true, recordOutputs: true },\n * });\n */\nexport const vercelAIIntegration = defineIntegration(_vercelAIIntegration);\n"],"names":[],"mappings":";;;;;AAOA,MAAM,gBAAA,GAAmB,UAAU;;MAEtB,kBAAmB,GAAE,sBAAsB,CAAC,gBAAgB,EAAE,MAAM,IAAI,6BAA6B,CAAC,EAAE,CAAC;;AAEtH,MAAM,oBAAqB,IAAG,MAAM;AACpC,EAAE,IAAI,eAAe;;AAErB,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,eAAgB,GAAE,kBAAkB,EAAE;AAC5C,KAAK;AACL,IAAI,KAAK,CAAC,MAAM,EAAE;AAClB,MAAM,eAAe,EAAE,eAAe,CAAC,MAAM;AAC7C,QAAQ,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,QAAQ;AACvC,UAAU,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,IAAA,EAAO,GAAE,UAAU,CAAC,IAAI,CAAC;;AAE1E,UAAU,IAAI,CAAC,IAAI,EAAE;AACrB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B,gBAAgB,UAAU,CAAC,sBAAsB,CAAE;AACnD,kBAAkB,UAAU,CAAC,2BAA2B,CAAA,GAAI,UAAU,CAAC,uBAAuB,CAAC;AAC/F;AACA;AACA;;AAEA,UAAU,OAAO,KAAK;AACtB,SAAS,CAAC;AACV,OAAO,CAAC;AACR,KAAK;AACL,GAAG;AACH,CAAC,CAAE;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,mBAAoB,GAAE,iBAAiB,CAAC,oBAAoB;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/vercelai/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-dynamic-delete */\n/* eslint-disable complexity */\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration, SEMANTIC_ATTRIBUTE_SENTRY_OP, spanToJSON } from '@sentry/core';\nimport { generateInstrumentOnce } from '../../../otel/instrument';\nimport { addOriginToSpan } from '../../../utils/addOriginToSpan';\nimport {\n AI_MODEL_ID_ATTRIBUTE,\n AI_MODEL_PROVIDER_ATTRIBUTE,\n AI_PROMPT_ATTRIBUTE,\n AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE,\n AI_TOOL_CALL_ID_ATTRIBUTE,\n AI_TOOL_CALL_NAME_ATTRIBUTE,\n AI_USAGE_COMPLETION_TOKENS_ATTRIBUTE,\n AI_USAGE_PROMPT_TOKENS_ATTRIBUTE,\n GEN_AI_RESPONSE_MODEL_ATTRIBUTE,\n GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE,\n GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE,\n} from './ai_sdk_attributes';\nimport { INTEGRATION_NAME } from './constants';\nimport { SentryVercelAiInstrumentation } from './instrumentation';\nimport type { VercelAiOptions } from './types';\n\nexport const instrumentVercelAi = generateInstrumentOnce(INTEGRATION_NAME, () => new SentryVercelAiInstrumentation({}));\n\nconst _vercelAIIntegration = ((options: VercelAiOptions = {}) => {\n let instrumentation: undefined | SentryVercelAiInstrumentation;\n\n return {\n name: INTEGRATION_NAME,\n options,\n setupOnce() {\n instrumentation = instrumentVercelAi();\n },\n setup(client) {\n instrumentation?.callWhenPatched(() => {\n client.on('spanStart', span => {\n const { data: attributes, description: name } = spanToJSON(span);\n\n if (!name) {\n return;\n }\n\n // Tool call spans\n // https://ai-sdk.dev/docs/ai-sdk-core/telemetry#tool-call-spans\n if (\n attributes[AI_TOOL_CALL_NAME_ATTRIBUTE] &&\n attributes[AI_TOOL_CALL_ID_ATTRIBUTE] &&\n name === 'ai.toolCall'\n ) {\n addOriginToSpan(span, 'auto.vercelai.otel');\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'gen_ai.execute_tool');\n span.setAttribute('gen_ai.tool.call.id', attributes[AI_TOOL_CALL_ID_ATTRIBUTE]);\n span.setAttribute('gen_ai.tool.name', attributes[AI_TOOL_CALL_NAME_ATTRIBUTE]);\n span.updateName(`execute_tool ${attributes[AI_TOOL_CALL_NAME_ATTRIBUTE]}`);\n return;\n }\n\n // The AI and Provider must be defined for generate, stream, and embed spans.\n // The id of the model\n const aiModelId = attributes[AI_MODEL_ID_ATTRIBUTE];\n // the provider of the model\n const aiModelProvider = attributes[AI_MODEL_PROVIDER_ATTRIBUTE];\n if (typeof aiModelId !== 'string' || typeof aiModelProvider !== 'string' || !aiModelId || !aiModelProvider) {\n return;\n }\n\n addOriginToSpan(span, 'auto.vercelai.otel');\n\n const nameWthoutAi = name.replace('ai.', '');\n span.setAttribute('ai.pipeline.name', nameWthoutAi);\n span.updateName(nameWthoutAi);\n\n // If a Telemetry name is set and it is a pipeline span, use that as the operation name\n const functionId = attributes[AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE];\n if (functionId && typeof functionId === 'string' && name.split('.').length - 1 === 1) {\n span.updateName(`${nameWthoutAi} ${functionId}`);\n span.setAttribute('ai.pipeline.name', functionId);\n }\n\n if (attributes[AI_PROMPT_ATTRIBUTE]) {\n span.setAttribute('gen_ai.prompt', attributes[AI_PROMPT_ATTRIBUTE]);\n }\n if (attributes[AI_MODEL_ID_ATTRIBUTE] && !attributes[GEN_AI_RESPONSE_MODEL_ATTRIBUTE]) {\n span.setAttribute(GEN_AI_RESPONSE_MODEL_ATTRIBUTE, attributes[AI_MODEL_ID_ATTRIBUTE]);\n }\n span.setAttribute('ai.streaming', name.includes('stream'));\n\n // Generate Spans\n if (name === 'ai.generateText') {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.generate_text');\n return;\n }\n\n if (name === 'ai.generateText.doGenerate') {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'gen_ai.generate_text');\n span.updateName(`generate_text ${attributes[AI_MODEL_ID_ATTRIBUTE]}`);\n return;\n }\n\n if (name === 'ai.streamText') {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.stream_text');\n return;\n }\n\n if (name === 'ai.streamText.doStream') {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'gen_ai.stream_text');\n span.updateName(`stream_text ${attributes[AI_MODEL_ID_ATTRIBUTE]}`);\n return;\n }\n\n if (name === 'ai.generateObject') {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.generate_object');\n return;\n }\n\n if (name === 'ai.generateObject.doGenerate') {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'gen_ai.generate_object');\n span.updateName(`generate_object ${attributes[AI_MODEL_ID_ATTRIBUTE]}`);\n return;\n }\n\n if (name === 'ai.streamObject') {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.stream_object');\n return;\n }\n\n if (name === 'ai.streamObject.doStream') {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'gen_ai.stream_object');\n span.updateName(`stream_object ${attributes[AI_MODEL_ID_ATTRIBUTE]}`);\n return;\n }\n\n if (name === 'ai.embed') {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.embed');\n return;\n }\n\n if (name === 'ai.embed.doEmbed') {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'gen_ai.embed');\n span.updateName(`embed ${attributes[AI_MODEL_ID_ATTRIBUTE]}`);\n return;\n }\n\n if (name === 'ai.embedMany') {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.embed_many');\n return;\n }\n\n if (name === 'ai.embedMany.doEmbed') {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'gen_ai.embed_many');\n span.updateName(`embed_many ${attributes[AI_MODEL_ID_ATTRIBUTE]}`);\n return;\n }\n\n if (name.startsWith('ai.stream')) {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run');\n return;\n }\n });\n\n client.addEventProcessor(event => {\n if (event.type === 'transaction' && event.spans?.length) {\n for (const span of event.spans) {\n const { data: attributes, description: name } = span;\n\n if (!name || span.origin !== 'auto.vercelai.otel') {\n continue;\n }\n\n if (attributes[AI_USAGE_COMPLETION_TOKENS_ATTRIBUTE] != undefined) {\n attributes[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE] = attributes[AI_USAGE_COMPLETION_TOKENS_ATTRIBUTE];\n delete attributes[AI_USAGE_COMPLETION_TOKENS_ATTRIBUTE];\n }\n if (attributes[AI_USAGE_PROMPT_TOKENS_ATTRIBUTE] != undefined) {\n attributes[GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE] = attributes[AI_USAGE_PROMPT_TOKENS_ATTRIBUTE];\n delete attributes[AI_USAGE_PROMPT_TOKENS_ATTRIBUTE];\n }\n if (\n typeof attributes[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE] === 'number' &&\n typeof attributes[GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE] === 'number'\n ) {\n attributes['gen_ai.usage.total_tokens'] =\n attributes[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE] + attributes[GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE];\n }\n }\n }\n\n return event;\n });\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [ai](https://www.npmjs.com/package/ai) library.\n *\n * For more information, see the [`ai` documentation](https://sdk.vercel.ai/docs/ai-sdk-core/telemetry).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.vercelAIIntegration()],\n * });\n * ```\n *\n * By default this integration adds tracing support to all `ai` function calls. If you need to disable\n * collecting spans for a specific call, you can do so by setting `experimental_telemetry.isEnabled` to\n * `false` in the first argument of the function call.\n *\n * ```javascript\n * const result = await generateText({\n * model: openai('gpt-4-turbo'),\n * experimental_telemetry: { isEnabled: false },\n * });\n * ```\n *\n * If you want to collect inputs and outputs for a specific call, you must specifically opt-in to each\n * function call by setting `experimental_telemetry.recordInputs` and `experimental_telemetry.recordOutputs`\n * to `true`.\n *\n * ```javascript\n * const result = await generateText({\n * model: openai('gpt-4-turbo'),\n * experimental_telemetry: { isEnabled: true, recordInputs: true, recordOutputs: true },\n * });\n */\nexport const vercelAIIntegration = defineIntegration(_vercelAIIntegration);\n"],"names":[],"mappings":";;;;;;;MAuBa,kBAAmB,GAAE,sBAAsB,CAAC,gBAAgB,EAAE,MAAM,IAAI,6BAA6B,CAAC,EAAE,CAAC;;AAEtH,MAAM,oBAAA,IAAwB,CAAC,OAAO,GAAoB,EAAE,KAAK;AACjE,EAAE,IAAI,eAAe;;AAErB,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,OAAO;AACX,IAAI,SAAS,GAAG;AAChB,MAAM,eAAgB,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A,CAAA,GAAA,UAAA,CAAA,gCAAA,CAAA;AACA,gBAAA,OAAA,UAAA,CAAA,gCAAA,CAAA;AACA;AACA,cAAA;AACA,gBAAA,OAAA,UAAA,CAAA,oCAAA,CAAA,KAAA,QAAA;AACA,gBAAA,OAAA,UAAA,CAAA,mCAAA,CAAA,KAAA;AACA,gBAAA;AACA,gBAAA,UAAA,CAAA,2BAAA,CAAA;AACA,kBAAA,UAAA,CAAA,oCAAA,CAAA,GAAA,UAAA,CAAA,mCAAA,CAAA;AACA;AACA;AACA;;AAEA,UAAA,OAAA,KAAA;AACA,SAAA,CAAA;AACA,OAAA,CAAA;AACA,KAAA;AACA,GAAA;AACA,CAAA,CAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAA,mBAAA,GAAA,iBAAA,CAAA,oBAAA;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { InstrumentationBase, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation';
|
|
2
|
-
import { SDK_VERSION } from '@sentry/core';
|
|
2
|
+
import { SDK_VERSION, getCurrentScope } from '@sentry/core';
|
|
3
|
+
import { INTEGRATION_NAME } from './constants.js';
|
|
3
4
|
|
|
4
5
|
// List of patched methods
|
|
5
6
|
// From: https://sdk.vercel.ai/docs/ai-sdk-core/telemetry#collected-data
|
|
@@ -12,6 +13,42 @@ const INSTRUMENTED_METHODS = [
|
|
|
12
13
|
'embedMany',
|
|
13
14
|
] ;
|
|
14
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Determines whether to record inputs and outputs for Vercel AI telemetry based on the configuration hierarchy.
|
|
18
|
+
*
|
|
19
|
+
* The order of precedence is:
|
|
20
|
+
* 1. The vercel ai integration options
|
|
21
|
+
* 2. The experimental_telemetry options in the vercel ai method calls
|
|
22
|
+
* 3. When telemetry is explicitly enabled (isEnabled: true), default to recording
|
|
23
|
+
* 4. Otherwise, use the sendDefaultPii option from client options
|
|
24
|
+
*/
|
|
25
|
+
function determineRecordingSettings(
|
|
26
|
+
integrationRecordingOptions,
|
|
27
|
+
methodTelemetryOptions,
|
|
28
|
+
telemetryExplicitlyEnabled,
|
|
29
|
+
defaultRecordingEnabled,
|
|
30
|
+
) {
|
|
31
|
+
const recordInputs =
|
|
32
|
+
integrationRecordingOptions?.recordInputs !== undefined
|
|
33
|
+
? integrationRecordingOptions.recordInputs
|
|
34
|
+
: methodTelemetryOptions.recordInputs !== undefined
|
|
35
|
+
? methodTelemetryOptions.recordInputs
|
|
36
|
+
: telemetryExplicitlyEnabled === true
|
|
37
|
+
? true // When telemetry is explicitly enabled, default to recording inputs
|
|
38
|
+
: defaultRecordingEnabled;
|
|
39
|
+
|
|
40
|
+
const recordOutputs =
|
|
41
|
+
integrationRecordingOptions?.recordOutputs !== undefined
|
|
42
|
+
? integrationRecordingOptions.recordOutputs
|
|
43
|
+
: methodTelemetryOptions.recordOutputs !== undefined
|
|
44
|
+
? methodTelemetryOptions.recordOutputs
|
|
45
|
+
: telemetryExplicitlyEnabled === true
|
|
46
|
+
? true // When telemetry is explicitly enabled, default to recording inputs
|
|
47
|
+
: defaultRecordingEnabled;
|
|
48
|
+
|
|
49
|
+
return { recordInputs, recordOutputs };
|
|
50
|
+
}
|
|
51
|
+
|
|
15
52
|
/**
|
|
16
53
|
* This detects is added by the Sentry Vercel AI Integration to detect if the integration should
|
|
17
54
|
* be enabled.
|
|
@@ -59,16 +96,24 @@ class SentryVercelAiInstrumentation extends InstrumentationBase {
|
|
|
59
96
|
const existingExperimentalTelemetry = args[0].experimental_telemetry || {};
|
|
60
97
|
const isEnabled = existingExperimentalTelemetry.isEnabled;
|
|
61
98
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
99
|
+
const client = getCurrentScope().getClient();
|
|
100
|
+
const integration = client?.getIntegrationByName(INTEGRATION_NAME);
|
|
101
|
+
const integrationOptions = integration?.options;
|
|
102
|
+
const shouldRecordInputsAndOutputs = integration ? Boolean(client?.getOptions().sendDefaultPii) : false;
|
|
103
|
+
|
|
104
|
+
const { recordInputs, recordOutputs } = determineRecordingSettings(
|
|
105
|
+
integrationOptions,
|
|
106
|
+
existingExperimentalTelemetry,
|
|
107
|
+
isEnabled,
|
|
108
|
+
shouldRecordInputsAndOutputs,
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
args[0].experimental_telemetry = {
|
|
112
|
+
...existingExperimentalTelemetry,
|
|
113
|
+
isEnabled: isEnabled !== undefined ? isEnabled : true,
|
|
114
|
+
recordInputs,
|
|
115
|
+
recordOutputs,
|
|
116
|
+
};
|
|
72
117
|
|
|
73
118
|
// @ts-expect-error we know that the method exists
|
|
74
119
|
return originalMethod.apply(this, args);
|
|
@@ -97,5 +142,5 @@ class SentryVercelAiInstrumentation extends InstrumentationBase {
|
|
|
97
142
|
}
|
|
98
143
|
}
|
|
99
144
|
|
|
100
|
-
export { SentryVercelAiInstrumentation };
|
|
145
|
+
export { SentryVercelAiInstrumentation, determineRecordingSettings };
|
|
101
146
|
//# sourceMappingURL=instrumentation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.js","sources":["../../../../../src/integrations/tracing/vercelai/instrumentation.ts"],"sourcesContent":["import type { InstrumentationConfig, InstrumentationModuleDefinition } from '@opentelemetry/instrumentation';\nimport { InstrumentationBase, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation';\nimport { SDK_VERSION } from '@sentry/core';\nimport type { TelemetrySettings } from './types';\n\n// List of patched methods\n// From: https://sdk.vercel.ai/docs/ai-sdk-core/telemetry#collected-data\nconst INSTRUMENTED_METHODS = [\n 'generateText',\n 'streamText',\n 'generateObject',\n 'streamObject',\n 'embed',\n 'embedMany',\n] as const;\n\ninterface MethodFirstArg extends Record<string, unknown> {\n experimental_telemetry?: TelemetrySettings;\n}\n\ntype MethodArgs = [MethodFirstArg, ...unknown[]];\n\ntype PatchedModuleExports = Record<(typeof INSTRUMENTED_METHODS)[number], (...args: MethodArgs) => unknown> &\n Record<string, unknown>;\n\n/**\n * This detects is added by the Sentry Vercel AI Integration to detect if the integration should\n * be enabled.\n *\n * It also patches the `ai` module to enable Vercel AI telemetry automatically for all methods.\n */\nexport class SentryVercelAiInstrumentation extends InstrumentationBase {\n private _isPatched = false;\n private _callbacks: (() => void)[] = [];\n\n public constructor(config: InstrumentationConfig = {}) {\n super('@sentry/instrumentation-vercel-ai', SDK_VERSION, config);\n }\n\n /**\n * Initializes the instrumentation by defining the modules to be patched.\n */\n public init(): InstrumentationModuleDefinition {\n const module = new InstrumentationNodeModuleDefinition('ai', ['>=3.0.0 <5'], this._patch.bind(this));\n return module;\n }\n\n /**\n * Call the provided callback when the module is patched.\n * If it has already been patched, the callback will be called immediately.\n */\n public callWhenPatched(callback: () => void): void {\n if (this._isPatched) {\n callback();\n } else {\n this._callbacks.push(callback);\n }\n }\n\n /**\n * Patches module exports to enable Vercel AI telemetry.\n */\n private _patch(moduleExports: PatchedModuleExports): unknown {\n this._isPatched = true;\n\n this._callbacks.forEach(callback => callback());\n this._callbacks = [];\n\n function generatePatch(originalMethod: (...args: MethodArgs) => unknown) {\n return (...args: MethodArgs) => {\n const existingExperimentalTelemetry = args[0].experimental_telemetry || {};\n const isEnabled = existingExperimentalTelemetry.isEnabled;\n\n
|
|
1
|
+
{"version":3,"file":"instrumentation.js","sources":["../../../../../src/integrations/tracing/vercelai/instrumentation.ts"],"sourcesContent":["import type { InstrumentationConfig, InstrumentationModuleDefinition } from '@opentelemetry/instrumentation';\nimport { InstrumentationBase, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation';\nimport { getCurrentScope, SDK_VERSION } from '@sentry/core';\nimport { INTEGRATION_NAME } from './constants';\nimport type { TelemetrySettings, VercelAiIntegration } from './types';\n\n// List of patched methods\n// From: https://sdk.vercel.ai/docs/ai-sdk-core/telemetry#collected-data\nconst INSTRUMENTED_METHODS = [\n 'generateText',\n 'streamText',\n 'generateObject',\n 'streamObject',\n 'embed',\n 'embedMany',\n] as const;\n\ninterface MethodFirstArg extends Record<string, unknown> {\n experimental_telemetry?: TelemetrySettings;\n}\n\ntype MethodArgs = [MethodFirstArg, ...unknown[]];\n\ntype PatchedModuleExports = Record<(typeof INSTRUMENTED_METHODS)[number], (...args: MethodArgs) => unknown> &\n Record<string, unknown>;\n\ninterface RecordingOptions {\n recordInputs?: boolean;\n recordOutputs?: boolean;\n}\n\n/**\n * Determines whether to record inputs and outputs for Vercel AI telemetry based on the configuration hierarchy.\n *\n * The order of precedence is:\n * 1. The vercel ai integration options\n * 2. The experimental_telemetry options in the vercel ai method calls\n * 3. When telemetry is explicitly enabled (isEnabled: true), default to recording\n * 4. Otherwise, use the sendDefaultPii option from client options\n */\nexport function determineRecordingSettings(\n integrationRecordingOptions: RecordingOptions | undefined,\n methodTelemetryOptions: RecordingOptions,\n telemetryExplicitlyEnabled: boolean | undefined,\n defaultRecordingEnabled: boolean,\n): { recordInputs: boolean; recordOutputs: boolean } {\n const recordInputs =\n integrationRecordingOptions?.recordInputs !== undefined\n ? integrationRecordingOptions.recordInputs\n : methodTelemetryOptions.recordInputs !== undefined\n ? methodTelemetryOptions.recordInputs\n : telemetryExplicitlyEnabled === true\n ? true // When telemetry is explicitly enabled, default to recording inputs\n : defaultRecordingEnabled;\n\n const recordOutputs =\n integrationRecordingOptions?.recordOutputs !== undefined\n ? integrationRecordingOptions.recordOutputs\n : methodTelemetryOptions.recordOutputs !== undefined\n ? methodTelemetryOptions.recordOutputs\n : telemetryExplicitlyEnabled === true\n ? true // When telemetry is explicitly enabled, default to recording inputs\n : defaultRecordingEnabled;\n\n return { recordInputs, recordOutputs };\n}\n\n/**\n * This detects is added by the Sentry Vercel AI Integration to detect if the integration should\n * be enabled.\n *\n * It also patches the `ai` module to enable Vercel AI telemetry automatically for all methods.\n */\nexport class SentryVercelAiInstrumentation extends InstrumentationBase {\n private _isPatched = false;\n private _callbacks: (() => void)[] = [];\n\n public constructor(config: InstrumentationConfig = {}) {\n super('@sentry/instrumentation-vercel-ai', SDK_VERSION, config);\n }\n\n /**\n * Initializes the instrumentation by defining the modules to be patched.\n */\n public init(): InstrumentationModuleDefinition {\n const module = new InstrumentationNodeModuleDefinition('ai', ['>=3.0.0 <5'], this._patch.bind(this));\n return module;\n }\n\n /**\n * Call the provided callback when the module is patched.\n * If it has already been patched, the callback will be called immediately.\n */\n public callWhenPatched(callback: () => void): void {\n if (this._isPatched) {\n callback();\n } else {\n this._callbacks.push(callback);\n }\n }\n\n /**\n * Patches module exports to enable Vercel AI telemetry.\n */\n private _patch(moduleExports: PatchedModuleExports): unknown {\n this._isPatched = true;\n\n this._callbacks.forEach(callback => callback());\n this._callbacks = [];\n\n function generatePatch(originalMethod: (...args: MethodArgs) => unknown) {\n return (...args: MethodArgs) => {\n const existingExperimentalTelemetry = args[0].experimental_telemetry || {};\n const isEnabled = existingExperimentalTelemetry.isEnabled;\n\n const client = getCurrentScope().getClient();\n const integration = client?.getIntegrationByName<VercelAiIntegration>(INTEGRATION_NAME);\n const integrationOptions = integration?.options;\n const shouldRecordInputsAndOutputs = integration ? Boolean(client?.getOptions().sendDefaultPii) : false;\n\n const { recordInputs, recordOutputs } = determineRecordingSettings(\n integrationOptions,\n existingExperimentalTelemetry,\n isEnabled,\n shouldRecordInputsAndOutputs,\n );\n\n args[0].experimental_telemetry = {\n ...existingExperimentalTelemetry,\n isEnabled: isEnabled !== undefined ? isEnabled : true,\n recordInputs,\n recordOutputs,\n };\n\n // @ts-expect-error we know that the method exists\n return originalMethod.apply(this, args);\n };\n }\n\n // Is this an ESM module?\n // https://tc39.es/ecma262/#sec-module-namespace-objects\n if (Object.prototype.toString.call(moduleExports) === '[object Module]') {\n // In ESM we take the usual route and just replace the exports we want to instrument\n for (const method of INSTRUMENTED_METHODS) {\n moduleExports[method] = generatePatch(moduleExports[method]);\n }\n\n return moduleExports;\n } else {\n // In CJS we can't replace the exports in the original module because they\n // don't have setters, so we create a new object with the same properties\n const patchedModuleExports = INSTRUMENTED_METHODS.reduce((acc, curr) => {\n acc[curr] = generatePatch(moduleExports[curr]);\n return acc;\n }, {} as PatchedModuleExports);\n\n return { ...moduleExports, ...patchedModuleExports };\n }\n }\n}\n"],"names":[],"mappings":";;;;AAMA;AACA;AACA,MAAM,uBAAuB;AAC7B,EAAE,cAAc;AAChB,EAAE,YAAY;AACd,EAAE,gBAAgB;AAClB,EAAE,cAAc;AAChB,EAAE,OAAO;AACT,EAAE,WAAW;AACb,CAAE;;AAgBF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,0BAA0B;AAC1C,EAAE,2BAA2B;AAC7B,EAAE,sBAAsB;AACxB,EAAE,0BAA0B;AAC5B,EAAE,uBAAuB;AACzB,EAAqD;AACrD,EAAE,MAAM,YAAa;AACrB,IAAI,2BAA2B,EAAE,YAAA,KAAiB;AAClD,QAAQ,2BAA2B,CAAC;AACpC,QAAQ,sBAAsB,CAAC,YAAA,KAAiB;AAChD,UAAU,sBAAsB,CAAC;AACjC,UAAU,+BAA+B;AACzC,YAAY,IAAA;AACZ,YAAY,uBAAuB;;AAEnC,EAAE,MAAM,aAAc;AACtB,IAAI,2BAA2B,EAAE,aAAA,KAAkB;AACnD,QAAQ,2BAA2B,CAAC;AACpC,QAAQ,sBAAsB,CAAC,aAAA,KAAkB;AACjD,UAAU,sBAAsB,CAAC;AACjC,UAAU,+BAA+B;AACzC,YAAY,IAAA;AACZ,YAAY,uBAAuB;;AAEnC,EAAE,OAAO,EAAE,YAAY,EAAE,eAAe;AACxC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,6BAA8B,SAAQ,mBAAoB,CAAA;AACvE,GAAE,MAAA,GAA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,EAAE,EAAC,EAA0B;;AAEpC,MAAM,OAAO,EAAE,GAAG,aAAa,EAAE,GAAG,sBAAsB;AAC1D;AACA;AACA;;;;"}
|
package/build/esm/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"type":"module","version":"9.
|
|
1
|
+
{"type":"module","version":"9.28.0","sideEffects":false}
|
package/build/types/index.d.ts
CHANGED
|
@@ -43,6 +43,7 @@ export { createGetModuleFromFilename } from './utils/module';
|
|
|
43
43
|
export { makeNodeTransport } from './transports';
|
|
44
44
|
export { NodeClient } from './sdk/client';
|
|
45
45
|
export { cron } from './cron';
|
|
46
|
+
export { NODE_VERSION } from './nodeVersion';
|
|
46
47
|
export type { NodeOptions } from './types';
|
|
47
48
|
export { setOpenTelemetryContextAsyncContextStrategy as setNodeAsyncContextStrategy, } from '@sentry/opentelemetry';
|
|
48
49
|
export { addBreadcrumb, isInitialized, isEnabled, getGlobalScope, lastEventId, close, createTransport, flush, SDK_VERSION, getSpanStatusFromHttpCode, setHttpStatus, captureCheckIn, withMonitor, requestDataIntegration, functionToStringIntegration, inboundFiltersIntegration, eventFiltersIntegration, linkedErrorsIntegration, addEventProcessor, setContext, setExtra, setExtras, setTag, setTags, setUser, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, setCurrentClient, Scope, setMeasurement, getSpanDescendants, parameterize, getClient, getCurrentScope, getIsolationScope, getTraceData, getTraceMetaTags, continueTrace, withScope, withIsolationScope, captureException, captureEvent, captureMessage, captureFeedback, captureConsoleIntegration, dedupeIntegration, extraErrorDataIntegration, rewriteFramesIntegration, startSession, captureSession, endSession, addIntegration, startSpan, startSpanManual, startInactiveSpan, startNewTrace, suppressTracing, getActiveSpan, withActiveSpan, getRootSpan, spanToJSON, spanToTraceHeader, spanToBaggageHeader, trpcMiddleware, updateSpanName, supabaseIntegration, instrumentSupabaseClient, zodErrorsIntegration, profiler, consoleLoggingIntegration, consoleIntegration, wrapMcpServerWithSentry, } from '@sentry/core';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AAEzC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,8BAA8B,EAAE,MAAM,oCAAoC,CAAC;AACpF,OAAO,EAAE,+BAA+B,EAAE,MAAM,qCAAqC,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AAEpF,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AACnH,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC9F,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,M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