@sentry/core
Advanced tools
Comparing version
@@ -145,2 +145,3 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
* @param monitorSlug The distinct slug of the monitor. | ||
* @param callback Callback to be monitored | ||
* @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want | ||
@@ -171,5 +172,6 @@ * to create a monitor automatically when sending a check in. | ||
if (is.isThenable(maybePromiseResult)) { | ||
Promise.resolve(maybePromiseResult).then( | ||
() => { | ||
return maybePromiseResult.then( | ||
r => { | ||
finishCheckIn('ok'); | ||
return r; | ||
}, | ||
@@ -180,6 +182,5 @@ e => { | ||
}, | ||
); | ||
} else { | ||
finishCheckIn('ok'); | ||
) ; | ||
} | ||
finishCheckIn('ok'); | ||
@@ -186,0 +187,0 @@ return maybePromiseResult; |
@@ -58,3 +58,3 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
const scope = currentScopes.getCurrentScope(); | ||
const parentSpan = getParentSpan(scope); | ||
const parentSpan = getParentSpan(scope, customParentSpan); | ||
@@ -117,3 +117,3 @@ const shouldSkipSpan = options.onlyIfParent && !parentSpan; | ||
const scope = currentScopes.getCurrentScope(); | ||
const parentSpan = getParentSpan(scope); | ||
const parentSpan = getParentSpan(scope, customParentSpan); | ||
@@ -178,3 +178,3 @@ const shouldSkipSpan = options.onlyIfParent && !parentSpan; | ||
const scope = currentScopes.getCurrentScope(); | ||
const parentSpan = getParentSpan(scope); | ||
const parentSpan = getParentSpan(scope, customParentSpan); | ||
@@ -488,3 +488,13 @@ const shouldSkipSpan = options.onlyIfParent && !parentSpan; | ||
function getParentSpan(scope) { | ||
function getParentSpan(scope, customParentSpan) { | ||
// always use the passed in span directly | ||
if (customParentSpan) { | ||
return customParentSpan ; | ||
} | ||
// This is different from `undefined` as it means the user explicitly wants no parent span | ||
if (customParentSpan === null) { | ||
return undefined; | ||
} | ||
const span = spanOnScope._getSpanForScope(scope) ; | ||
@@ -491,0 +501,0 @@ |
@@ -153,2 +153,20 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
/** | ||
* Tool call spans | ||
* `ai.toolCall` span | ||
* | ||
* The parameters of the tool call | ||
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#tool-call-spans | ||
*/ | ||
const AI_TOOL_CALL_ARGS_ATTRIBUTE = 'ai.toolCall.args'; | ||
/** | ||
* Tool call spans | ||
* `ai.toolCall` span | ||
* | ||
* The result of the tool call | ||
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#tool-call-spans | ||
*/ | ||
const AI_TOOL_CALL_RESULT_ATTRIBUTE = 'ai.toolCall.result'; | ||
exports.AI_MODEL_ID_ATTRIBUTE = AI_MODEL_ID_ATTRIBUTE; | ||
@@ -162,4 +180,6 @@ exports.AI_MODEL_PROVIDER_ATTRIBUTE = AI_MODEL_PROVIDER_ATTRIBUTE; | ||
exports.AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE = AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE; | ||
exports.AI_TOOL_CALL_ARGS_ATTRIBUTE = AI_TOOL_CALL_ARGS_ATTRIBUTE; | ||
exports.AI_TOOL_CALL_ID_ATTRIBUTE = AI_TOOL_CALL_ID_ATTRIBUTE; | ||
exports.AI_TOOL_CALL_NAME_ATTRIBUTE = AI_TOOL_CALL_NAME_ATTRIBUTE; | ||
exports.AI_TOOL_CALL_RESULT_ATTRIBUTE = AI_TOOL_CALL_RESULT_ATTRIBUTE; | ||
exports.AI_USAGE_COMPLETION_TOKENS_ATTRIBUTE = AI_USAGE_COMPLETION_TOKENS_ATTRIBUTE; | ||
@@ -166,0 +186,0 @@ exports.AI_USAGE_PROMPT_TOKENS_ATTRIBUTE = AI_USAGE_PROMPT_TOKENS_ATTRIBUTE; |
@@ -80,2 +80,5 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
renameAttributeKey(attributes, vercelAiAttributes.AI_PROMPT_TOOLS_ATTRIBUTE, 'gen_ai.request.available_tools'); | ||
renameAttributeKey(attributes, vercelAiAttributes.AI_TOOL_CALL_ARGS_ATTRIBUTE, 'gen_ai.tool.input'); | ||
renameAttributeKey(attributes, vercelAiAttributes.AI_TOOL_CALL_RESULT_ATTRIBUTE, 'gen_ai.tool.output'); | ||
} | ||
@@ -98,5 +101,12 @@ | ||
span.setAttribute(semanticAttributes.SEMANTIC_ATTRIBUTE_SENTRY_OP, 'gen_ai.execute_tool'); | ||
span.setAttribute('gen_ai.tool.call.id', attributes[vercelAiAttributes.AI_TOOL_CALL_ID_ATTRIBUTE]); | ||
span.setAttribute('gen_ai.tool.name', attributes[vercelAiAttributes.AI_TOOL_CALL_NAME_ATTRIBUTE]); | ||
span.updateName(`execute_tool ${attributes[vercelAiAttributes.AI_TOOL_CALL_NAME_ATTRIBUTE]}`); | ||
renameAttributeKey(attributes, vercelAiAttributes.AI_TOOL_CALL_NAME_ATTRIBUTE, 'gen_ai.tool.name'); | ||
renameAttributeKey(attributes, vercelAiAttributes.AI_TOOL_CALL_ID_ATTRIBUTE, 'gen_ai.tool.call.id'); | ||
// https://opentelemetry.io/docs/specs/semconv/registry/attributes/gen-ai/#gen-ai-tool-type | ||
if (!attributes['gen_ai.tool.type']) { | ||
span.setAttribute('gen_ai.tool.type', 'function'); | ||
} | ||
const toolName = attributes['gen_ai.tool.name']; | ||
if (toolName) { | ||
span.updateName(`execute_tool ${toolName}`); | ||
} | ||
} | ||
@@ -115,3 +125,3 @@ | ||
span.updateName(`${nameWthoutAi} ${functionId}`); | ||
span.setAttribute('ai.pipeline.name', functionId); | ||
span.setAttribute('gen_ai.function_id', functionId); | ||
} | ||
@@ -118,0 +128,0 @@ |
@@ -5,5 +5,5 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
const SDK_VERSION = "9.34.0" ; | ||
const SDK_VERSION = "9.35.0" ; | ||
exports.SDK_VERSION = SDK_VERSION; | ||
//# sourceMappingURL=version.js.map |
@@ -143,2 +143,3 @@ import { getCurrentScope, getClient, withIsolationScope, getIsolationScope } from './currentScopes.js'; | ||
* @param monitorSlug The distinct slug of the monitor. | ||
* @param callback Callback to be monitored | ||
* @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want | ||
@@ -169,5 +170,6 @@ * to create a monitor automatically when sending a check in. | ||
if (isThenable(maybePromiseResult)) { | ||
Promise.resolve(maybePromiseResult).then( | ||
() => { | ||
return maybePromiseResult.then( | ||
r => { | ||
finishCheckIn('ok'); | ||
return r; | ||
}, | ||
@@ -178,6 +180,5 @@ e => { | ||
}, | ||
); | ||
} else { | ||
finishCheckIn('ok'); | ||
) ; | ||
} | ||
finishCheckIn('ok'); | ||
@@ -184,0 +185,0 @@ return maybePromiseResult; |
@@ -1,1 +0,1 @@ | ||
{"type":"module","version":"9.34.0","sideEffects":false} | ||
{"type":"module","version":"9.35.0","sideEffects":false} |
@@ -56,3 +56,3 @@ import { getAsyncContextStrategy } from '../asyncContext/index.js'; | ||
const scope = getCurrentScope(); | ||
const parentSpan = getParentSpan(scope); | ||
const parentSpan = getParentSpan(scope, customParentSpan); | ||
@@ -115,3 +115,3 @@ const shouldSkipSpan = options.onlyIfParent && !parentSpan; | ||
const scope = getCurrentScope(); | ||
const parentSpan = getParentSpan(scope); | ||
const parentSpan = getParentSpan(scope, customParentSpan); | ||
@@ -176,3 +176,3 @@ const shouldSkipSpan = options.onlyIfParent && !parentSpan; | ||
const scope = getCurrentScope(); | ||
const parentSpan = getParentSpan(scope); | ||
const parentSpan = getParentSpan(scope, customParentSpan); | ||
@@ -486,3 +486,13 @@ const shouldSkipSpan = options.onlyIfParent && !parentSpan; | ||
function getParentSpan(scope) { | ||
function getParentSpan(scope, customParentSpan) { | ||
// always use the passed in span directly | ||
if (customParentSpan) { | ||
return customParentSpan ; | ||
} | ||
// This is different from `undefined` as it means the user explicitly wants no parent span | ||
if (customParentSpan === null) { | ||
return undefined; | ||
} | ||
const span = _getSpanForScope(scope) ; | ||
@@ -489,0 +499,0 @@ |
@@ -151,3 +151,21 @@ /** | ||
export { AI_MODEL_ID_ATTRIBUTE, AI_MODEL_PROVIDER_ATTRIBUTE, AI_PROMPT_ATTRIBUTE, AI_PROMPT_MESSAGES_ATTRIBUTE, AI_PROMPT_TOOLS_ATTRIBUTE, AI_RESPONSE_TEXT_ATTRIBUTE, AI_RESPONSE_TOOL_CALLS_ATTRIBUTE, AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE, AI_TOOL_CALL_ID_ATTRIBUTE, AI_TOOL_CALL_NAME_ATTRIBUTE, AI_USAGE_COMPLETION_TOKENS_ATTRIBUTE, AI_USAGE_PROMPT_TOKENS_ATTRIBUTE, GEN_AI_RESPONSE_MODEL_ATTRIBUTE, GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE, GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE }; | ||
/** | ||
* Tool call spans | ||
* `ai.toolCall` span | ||
* | ||
* The parameters of the tool call | ||
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#tool-call-spans | ||
*/ | ||
const AI_TOOL_CALL_ARGS_ATTRIBUTE = 'ai.toolCall.args'; | ||
/** | ||
* Tool call spans | ||
* `ai.toolCall` span | ||
* | ||
* The result of the tool call | ||
* @see https://ai-sdk.dev/docs/ai-sdk-core/telemetry#tool-call-spans | ||
*/ | ||
const AI_TOOL_CALL_RESULT_ATTRIBUTE = 'ai.toolCall.result'; | ||
export { AI_MODEL_ID_ATTRIBUTE, AI_MODEL_PROVIDER_ATTRIBUTE, AI_PROMPT_ATTRIBUTE, AI_PROMPT_MESSAGES_ATTRIBUTE, AI_PROMPT_TOOLS_ATTRIBUTE, AI_RESPONSE_TEXT_ATTRIBUTE, AI_RESPONSE_TOOL_CALLS_ATTRIBUTE, AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE, AI_TOOL_CALL_ARGS_ATTRIBUTE, AI_TOOL_CALL_ID_ATTRIBUTE, AI_TOOL_CALL_NAME_ATTRIBUTE, AI_TOOL_CALL_RESULT_ATTRIBUTE, AI_USAGE_COMPLETION_TOKENS_ATTRIBUTE, AI_USAGE_PROMPT_TOKENS_ATTRIBUTE, GEN_AI_RESPONSE_MODEL_ATTRIBUTE, GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE, GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE }; | ||
//# sourceMappingURL=vercel-ai-attributes.js.map |
import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../semanticAttributes.js'; | ||
import { spanToJSON } from './spanUtils.js'; | ||
import { GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE, GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE, AI_USAGE_COMPLETION_TOKENS_ATTRIBUTE, AI_USAGE_PROMPT_TOKENS_ATTRIBUTE, AI_PROMPT_MESSAGES_ATTRIBUTE, AI_RESPONSE_TEXT_ATTRIBUTE, AI_RESPONSE_TOOL_CALLS_ATTRIBUTE, AI_PROMPT_TOOLS_ATTRIBUTE, 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 } from './vercel-ai-attributes.js'; | ||
import { GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE, GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE, AI_USAGE_COMPLETION_TOKENS_ATTRIBUTE, AI_USAGE_PROMPT_TOKENS_ATTRIBUTE, AI_PROMPT_MESSAGES_ATTRIBUTE, AI_RESPONSE_TEXT_ATTRIBUTE, AI_RESPONSE_TOOL_CALLS_ATTRIBUTE, AI_PROMPT_TOOLS_ATTRIBUTE, AI_TOOL_CALL_ARGS_ATTRIBUTE, AI_TOOL_CALL_RESULT_ATTRIBUTE, 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 } from './vercel-ai-attributes.js'; | ||
@@ -78,2 +78,5 @@ function addOriginToSpan(span, origin) { | ||
renameAttributeKey(attributes, AI_PROMPT_TOOLS_ATTRIBUTE, 'gen_ai.request.available_tools'); | ||
renameAttributeKey(attributes, AI_TOOL_CALL_ARGS_ATTRIBUTE, 'gen_ai.tool.input'); | ||
renameAttributeKey(attributes, AI_TOOL_CALL_RESULT_ATTRIBUTE, 'gen_ai.tool.output'); | ||
} | ||
@@ -96,5 +99,12 @@ | ||
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'gen_ai.execute_tool'); | ||
span.setAttribute('gen_ai.tool.call.id', attributes[AI_TOOL_CALL_ID_ATTRIBUTE]); | ||
span.setAttribute('gen_ai.tool.name', attributes[AI_TOOL_CALL_NAME_ATTRIBUTE]); | ||
span.updateName(`execute_tool ${attributes[AI_TOOL_CALL_NAME_ATTRIBUTE]}`); | ||
renameAttributeKey(attributes, AI_TOOL_CALL_NAME_ATTRIBUTE, 'gen_ai.tool.name'); | ||
renameAttributeKey(attributes, AI_TOOL_CALL_ID_ATTRIBUTE, 'gen_ai.tool.call.id'); | ||
// https://opentelemetry.io/docs/specs/semconv/registry/attributes/gen-ai/#gen-ai-tool-type | ||
if (!attributes['gen_ai.tool.type']) { | ||
span.setAttribute('gen_ai.tool.type', 'function'); | ||
} | ||
const toolName = attributes['gen_ai.tool.name']; | ||
if (toolName) { | ||
span.updateName(`execute_tool ${toolName}`); | ||
} | ||
} | ||
@@ -113,3 +123,3 @@ | ||
span.updateName(`${nameWthoutAi} ${functionId}`); | ||
span.setAttribute('ai.pipeline.name', functionId); | ||
span.setAttribute('gen_ai.function_id', functionId); | ||
} | ||
@@ -116,0 +126,0 @@ |
// This is a magic string replaced by rollup | ||
const SDK_VERSION = "9.34.0" ; | ||
const SDK_VERSION = "9.35.0" ; | ||
export { SDK_VERSION }; | ||
//# sourceMappingURL=version.js.map |
@@ -100,2 +100,3 @@ import { CaptureContext } from './scope'; | ||
* @param monitorSlug The distinct slug of the monitor. | ||
* @param callback Callback to be monitored | ||
* @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want | ||
@@ -102,0 +103,0 @@ * to create a monitor automatically when sending a check in. |
@@ -9,5 +9,5 @@ import { Mechanism } from './mechanism'; | ||
module?: string; | ||
thread_id?: number; | ||
thread_id?: number | string; | ||
stacktrace?: Stacktrace; | ||
} | ||
//# sourceMappingURL=exception.d.ts.map |
import { Stacktrace } from './stacktrace'; | ||
/** JSDoc */ | ||
export interface Thread { | ||
id?: number; | ||
id?: number | string; | ||
name?: string; | ||
main?: boolean; | ||
stacktrace?: Stacktrace; | ||
@@ -7,0 +8,0 @@ crashed?: boolean; |
@@ -100,2 +100,3 @@ import type { CaptureContext } from './scope'; | ||
* @param monitorSlug The distinct slug of the monitor. | ||
* @param callback Callback to be monitored | ||
* @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want | ||
@@ -102,0 +103,0 @@ * to create a monitor automatically when sending a check in. |
@@ -9,5 +9,5 @@ import type { Mechanism } from './mechanism'; | ||
module?: string; | ||
thread_id?: number; | ||
thread_id?: number | string; | ||
stacktrace?: Stacktrace; | ||
} | ||
//# sourceMappingURL=exception.d.ts.map |
import type { Stacktrace } from './stacktrace'; | ||
/** JSDoc */ | ||
export interface Thread { | ||
id?: number; | ||
id?: number | string; | ||
name?: string; | ||
main?: boolean; | ||
stacktrace?: Stacktrace; | ||
@@ -7,0 +8,0 @@ crashed?: boolean; |
{ | ||
"name": "@sentry/core", | ||
"version": "9.34.0", | ||
"version": "9.35.0", | ||
"description": "Base implementation for all Sentry JavaScript SDKs", | ||
@@ -5,0 +5,0 @@ "repository": "git://github.com/getsentry/sentry-javascript.git", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
3753976
0.16%43986
0.17%