diff --git a/javascript/sentry-conventions/src/attributes.ts b/javascript/sentry-conventions/src/attributes.ts index 18bf08c31..dae85f6a4 100644 --- a/javascript/sentry-conventions/src/attributes.ts +++ b/javascript/sentry-conventions/src/attributes.ts @@ -8705,7 +8705,7 @@ export type GEN_AI_TOOL_TYPE_TYPE = string; * Attribute defined in OTEL: Yes * Visibility: public * - * Aliases: {@link GEN_AI_USAGE_INPUT_TOKENS_CACHE_WRITE} `gen_ai.usage.input_tokens.cache_write` + * Aliases: {@link GEN_AI_USAGE_INPUT_TOKENS_CACHE_WRITE} `gen_ai.usage.input_tokens.cache_write`, {@link _GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS} `gen_ai.usage.cache_creation_input_tokens` * * @example 100 */ @@ -8716,6 +8716,30 @@ export const GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS = 'gen_ai.usage.cache_crea */ export type GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS_TYPE = number; +// Path: model/attributes/gen_ai/gen_ai__usage__cache_creation_input_tokens.json + +/** + * The number of tokens written to the cache when processing the AI input (prompt). `gen_ai.usage.cache_creation_input_tokens` + * + * Attribute Value Type: `number` {@link _GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS_TYPE} + * + * Apply Scrubbing: manual + * + * Attribute defined in OTEL: No + * Visibility: public + * + * Aliases: {@link GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS} `gen_ai.usage.cache_creation.input_tokens`, {@link GEN_AI_USAGE_INPUT_TOKENS_CACHE_WRITE} `gen_ai.usage.input_tokens.cache_write` + * + * @deprecated Use {@link GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS} (gen_ai.usage.cache_creation.input_tokens) instead - This attribute is being deprecated in favor of gen_ai.usage.cache_creation.input_tokens. + * @example 100 + */ +export const _GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS = 'gen_ai.usage.cache_creation_input_tokens'; + +/** + * Type for {@link _GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS} gen_ai.usage.cache_creation_input_tokens + */ +export type _GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS_TYPE = number; + // Path: model/attributes/gen_ai/gen_ai__usage__cache_read__input_tokens.json /** @@ -8728,7 +8752,7 @@ export type GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS_TYPE = number; * Attribute defined in OTEL: Yes * Visibility: public * - * Aliases: {@link GEN_AI_USAGE_INPUT_TOKENS_CACHED} `gen_ai.usage.input_tokens.cached` + * Aliases: {@link GEN_AI_USAGE_INPUT_TOKENS_CACHED} `gen_ai.usage.input_tokens.cached`, {@link _GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS} `gen_ai.usage.cache_read_input_tokens` * * @example 50 */ @@ -8739,6 +8763,30 @@ export const GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS = 'gen_ai.usage.cache_read.inp */ export type GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS_TYPE = number; +// Path: model/attributes/gen_ai/gen_ai__usage__cache_read_input_tokens.json + +/** + * The number of cached tokens used to process the AI input (prompt). `gen_ai.usage.cache_read_input_tokens` + * + * Attribute Value Type: `number` {@link _GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS_TYPE} + * + * Apply Scrubbing: manual + * + * Attribute defined in OTEL: No + * Visibility: public + * + * Aliases: {@link GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS} `gen_ai.usage.cache_read.input_tokens`, {@link GEN_AI_USAGE_INPUT_TOKENS_CACHED} `gen_ai.usage.input_tokens.cached` + * + * @deprecated Use {@link GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS} (gen_ai.usage.cache_read.input_tokens) instead - This attribute is being deprecated in favor of gen_ai.usage.cache_read.input_tokens. + * @example 50 + */ +export const _GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS = 'gen_ai.usage.cache_read_input_tokens'; + +/** + * Type for {@link _GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS} gen_ai.usage.cache_read_input_tokens + */ +export type _GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS_TYPE = number; + // Path: model/attributes/gen_ai/gen_ai__usage__completion_tokens.json /** @@ -8798,7 +8846,7 @@ export type GEN_AI_USAGE_INPUT_TOKENS_TYPE = number; * Attribute defined in OTEL: No * Visibility: public * - * Aliases: {@link GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS} `gen_ai.usage.cache_read.input_tokens` + * Aliases: {@link GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS} `gen_ai.usage.cache_read.input_tokens`, {@link _GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS} `gen_ai.usage.cache_read_input_tokens` * * @deprecated Use {@link GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS} (gen_ai.usage.cache_read.input_tokens) instead * @example 50 @@ -8822,7 +8870,7 @@ export type GEN_AI_USAGE_INPUT_TOKENS_CACHED_TYPE = number; * Attribute defined in OTEL: No * Visibility: public * - * Aliases: {@link GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS} `gen_ai.usage.cache_creation.input_tokens` + * Aliases: {@link GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS} `gen_ai.usage.cache_creation.input_tokens`, {@link _GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS} `gen_ai.usage.cache_creation_input_tokens` * * @deprecated Use {@link GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS} (gen_ai.usage.cache_creation.input_tokens) instead * @example 100 @@ -19145,7 +19193,9 @@ export const ATTRIBUTE_TYPE: Record = { 'gen_ai.tool.output': 'string', 'gen_ai.tool.type': 'string', 'gen_ai.usage.cache_creation.input_tokens': 'integer', + 'gen_ai.usage.cache_creation_input_tokens': 'integer', 'gen_ai.usage.cache_read.input_tokens': 'integer', + 'gen_ai.usage.cache_read_input_tokens': 'integer', 'gen_ai.usage.completion_tokens': 'integer', 'gen_ai.usage.input_tokens': 'integer', 'gen_ai.usage.input_tokens.cached': 'integer', @@ -19984,7 +20034,9 @@ export type AttributeName = | typeof GEN_AI_TOOL_OUTPUT | typeof GEN_AI_TOOL_TYPE | typeof GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS + | typeof _GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS | typeof GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS + | typeof _GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS | typeof GEN_AI_USAGE_COMPLETION_TOKENS | typeof GEN_AI_USAGE_INPUT_TOKENS | typeof GEN_AI_USAGE_INPUT_TOKENS_CACHED @@ -26531,38 +26583,98 @@ export const ATTRIBUTE_METADATA: Record = { 'gen_ai.usage.cache_creation.input_tokens': { brief: 'The number of tokens written to the cache when processing the AI input (prompt).', type: 'integer', - keys: ['gen_ai.usage.cache_creation.input_tokens', 'gen_ai.usage.input_tokens.cache_write'], + keys: [ + 'gen_ai.usage.cache_creation.input_tokens', + 'gen_ai.usage.cache_creation_input_tokens', + 'gen_ai.usage.input_tokens.cache_write', + ], applyScrubbing: { key: 'manual', }, isInOtel: true, visibility: 'public', example: 100, - aliases: ['gen_ai.usage.input_tokens.cache_write'], + aliases: ['gen_ai.usage.input_tokens.cache_write', 'gen_ai.usage.cache_creation_input_tokens'], changelog: [ + { version: 'next', description: 'Added gen_ai.usage.cache_creation_input_tokens as an alias' }, { version: '0.11.0', prs: [418], description: 'Added gen_ai.usage.cache_creation.input_tokens attribute' }, ], additionalContext: [ 'This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to count tokens, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans.', ], }, + 'gen_ai.usage.cache_creation_input_tokens': { + brief: 'The number of tokens written to the cache when processing the AI input (prompt).', + type: 'integer', + keys: [ + 'gen_ai.usage.cache_creation.input_tokens', + 'gen_ai.usage.cache_creation_input_tokens', + 'gen_ai.usage.input_tokens.cache_write', + ], + applyScrubbing: { + key: 'manual', + }, + isInOtel: false, + visibility: 'public', + example: 100, + examples: [100], + deprecation: { + replacement: 'gen_ai.usage.cache_creation.input_tokens', + reason: 'This attribute is being deprecated in favor of gen_ai.usage.cache_creation.input_tokens.', + status: 'backfill', + }, + aliases: ['gen_ai.usage.cache_creation.input_tokens', 'gen_ai.usage.input_tokens.cache_write'], + changelog: [ + { version: 'next', prs: [582], description: 'Added gen_ai.usage.cache_creation_input_tokens attribute' }, + ], + }, 'gen_ai.usage.cache_read.input_tokens': { brief: 'The number of cached tokens used to process the AI input (prompt).', type: 'integer', - keys: ['gen_ai.usage.cache_read.input_tokens', 'gen_ai.usage.input_tokens.cached'], + keys: [ + 'gen_ai.usage.cache_read.input_tokens', + 'gen_ai.usage.cache_read_input_tokens', + 'gen_ai.usage.input_tokens.cached', + ], applyScrubbing: { key: 'manual', }, isInOtel: true, visibility: 'public', example: 50, - aliases: ['gen_ai.usage.input_tokens.cached'], - changelog: [{ version: '0.11.0', prs: [418], description: 'Added gen_ai.usage.cache_read.input_tokens attribute' }], + aliases: ['gen_ai.usage.input_tokens.cached', 'gen_ai.usage.cache_read_input_tokens'], + changelog: [ + { version: 'next', description: 'Added gen_ai.usage.cache_read_input_tokens as an alias' }, + { version: '0.11.0', prs: [418], description: 'Added gen_ai.usage.cache_read.input_tokens attribute' }, + ], additionalContext: [ 'This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to count tokens, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans.', 'This is a subset of gen_ai.usage.input_tokens, not an independent count. Do not sum this with gen_ai.usage.input_tokens — it is already included.', ], }, + 'gen_ai.usage.cache_read_input_tokens': { + brief: 'The number of cached tokens used to process the AI input (prompt).', + type: 'integer', + keys: [ + 'gen_ai.usage.cache_read.input_tokens', + 'gen_ai.usage.cache_read_input_tokens', + 'gen_ai.usage.input_tokens.cached', + ], + applyScrubbing: { + key: 'manual', + }, + isInOtel: false, + visibility: 'public', + example: 50, + examples: [50], + deprecation: { + replacement: 'gen_ai.usage.cache_read.input_tokens', + reason: 'This attribute is being deprecated in favor of gen_ai.usage.cache_read.input_tokens.', + status: 'backfill', + }, + aliases: ['gen_ai.usage.cache_read.input_tokens', 'gen_ai.usage.input_tokens.cached'], + changelog: [{ version: 'next', prs: [582], description: 'Added gen_ai.usage.cache_read_input_tokens attribute' }], + }, 'gen_ai.usage.completion_tokens': { brief: 'The number of tokens used in the GenAI response (completion).', type: 'integer', @@ -26619,7 +26731,11 @@ export const ATTRIBUTE_METADATA: Record = { 'gen_ai.usage.input_tokens.cached': { brief: 'The number of cached tokens used to process the AI input (prompt).', type: 'integer', - keys: ['gen_ai.usage.cache_read.input_tokens', 'gen_ai.usage.input_tokens.cached'], + keys: [ + 'gen_ai.usage.cache_read.input_tokens', + 'gen_ai.usage.cache_read_input_tokens', + 'gen_ai.usage.input_tokens.cached', + ], applyScrubbing: { key: 'manual', }, @@ -26630,8 +26746,9 @@ export const ATTRIBUTE_METADATA: Record = { replacement: 'gen_ai.usage.cache_read.input_tokens', status: 'backfill', }, - aliases: ['gen_ai.usage.cache_read.input_tokens'], + aliases: ['gen_ai.usage.cache_read.input_tokens', 'gen_ai.usage.cache_read_input_tokens'], changelog: [ + { version: 'next', description: 'Added gen_ai.usage.cache_read_input_tokens as an alias' }, { version: '0.11.0', prs: [418], description: 'Deprecate in favor of gen_ai.usage.cache_read.input_tokens' }, { version: '0.9.0', prs: [397], description: 'Add additional_context' }, { version: '0.4.0', prs: [228] }, @@ -26645,7 +26762,11 @@ export const ATTRIBUTE_METADATA: Record = { 'gen_ai.usage.input_tokens.cache_write': { brief: 'The number of tokens written to the cache when processing the AI input (prompt).', type: 'integer', - keys: ['gen_ai.usage.cache_creation.input_tokens', 'gen_ai.usage.input_tokens.cache_write'], + keys: [ + 'gen_ai.usage.cache_creation.input_tokens', + 'gen_ai.usage.cache_creation_input_tokens', + 'gen_ai.usage.input_tokens.cache_write', + ], applyScrubbing: { key: 'manual', }, @@ -26656,8 +26777,9 @@ export const ATTRIBUTE_METADATA: Record = { replacement: 'gen_ai.usage.cache_creation.input_tokens', status: 'backfill', }, - aliases: ['gen_ai.usage.cache_creation.input_tokens'], + aliases: ['gen_ai.usage.cache_creation.input_tokens', 'gen_ai.usage.cache_creation_input_tokens'], changelog: [ + { version: 'next', description: 'Added gen_ai.usage.cache_creation_input_tokens as an alias' }, { version: '0.11.0', prs: [418], description: 'Deprecate in favor of gen_ai.usage.cache_creation.input_tokens' }, { version: '0.9.0', prs: [397], description: 'Add additional_context' }, { version: '0.4.0', prs: [217, 228] }, @@ -34009,7 +34131,9 @@ export type Attributes = { [GEN_AI_TOOL_OUTPUT]?: GEN_AI_TOOL_OUTPUT_TYPE; [GEN_AI_TOOL_TYPE]?: GEN_AI_TOOL_TYPE_TYPE; [GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS]?: GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS_TYPE; + [_GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS]?: _GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS_TYPE; [GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS]?: GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS_TYPE; + [_GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS]?: _GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS_TYPE; [GEN_AI_USAGE_COMPLETION_TOKENS]?: GEN_AI_USAGE_COMPLETION_TOKENS_TYPE; [GEN_AI_USAGE_INPUT_TOKENS]?: GEN_AI_USAGE_INPUT_TOKENS_TYPE; [GEN_AI_USAGE_INPUT_TOKENS_CACHED]?: GEN_AI_USAGE_INPUT_TOKENS_CACHED_TYPE; diff --git a/javascript/sentry-conventions/src/search.ts b/javascript/sentry-conventions/src/search.ts index 41b14c275..8572a5695 100644 --- a/javascript/sentry-conventions/src/search.ts +++ b/javascript/sentry-conventions/src/search.ts @@ -2207,11 +2207,25 @@ export const SEARCH_GEN_AI__TOOL__TYPE = 'gen_ai.tool.type'; */ export const SEARCH_GEN_AI__USAGE__CACHE_CREATION__INPUT_TOKENS = 'gen_ai.usage.cache_creation.input_tokens'; +/** + * Search name for {@link attributes._GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS}. `gen_ai.usage.cache_creation_input_tokens` + * + * @deprecated Use {@link SEARCH_GEN_AI__USAGE__CACHE_CREATION__INPUT_TOKENS} (`gen_ai.usage.cache_creation.input_tokens`) instead + */ +export const SEARCH_GEN_AI__USAGE__CACHE_CREATION_INPUT_TOKENS = 'gen_ai.usage.cache_creation_input_tokens'; + /** * Search name for {@link attributes.GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS}. `gen_ai.usage.cache_read.input_tokens` */ export const SEARCH_GEN_AI__USAGE__CACHE_READ__INPUT_TOKENS = 'gen_ai.usage.cache_read.input_tokens'; +/** + * Search name for {@link attributes._GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS}. `gen_ai.usage.cache_read_input_tokens` + * + * @deprecated Use {@link SEARCH_GEN_AI__USAGE__CACHE_READ__INPUT_TOKENS} (`gen_ai.usage.cache_read.input_tokens`) instead + */ +export const SEARCH_GEN_AI__USAGE__CACHE_READ_INPUT_TOKENS = 'gen_ai.usage.cache_read_input_tokens'; + /** * Search name for {@link attributes.GEN_AI_USAGE_COMPLETION_TOKENS}. `gen_ai.usage.completion_tokens` * @@ -5213,7 +5227,9 @@ export type AttributeSearchName = | typeof SEARCH_GEN_AI__TOOL__OUTPUT | typeof SEARCH_GEN_AI__TOOL__TYPE | typeof SEARCH_GEN_AI__USAGE__CACHE_CREATION__INPUT_TOKENS + | typeof SEARCH_GEN_AI__USAGE__CACHE_CREATION_INPUT_TOKENS | typeof SEARCH_GEN_AI__USAGE__CACHE_READ__INPUT_TOKENS + | typeof SEARCH_GEN_AI__USAGE__CACHE_READ_INPUT_TOKENS | typeof SEARCH_GEN_AI__USAGE__COMPLETION_TOKENS | typeof SEARCH_GEN_AI__USAGE__INPUT_TOKENS | typeof SEARCH_GEN_AI__USAGE__INPUT_TOKENS__CACHE_WRITE @@ -8177,13 +8193,41 @@ export const ATTRIBUTE_SEARCH_METADATA: Record canonicalName: 'gen_ai.usage.cache_creation.input_tokens', type: 'integer', brief: 'The number of tokens written to the cache when processing the AI input (prompt).', - deprecationChain: ['gen_ai.usage.cache_creation.input_tokens', 'gen_ai.usage.input_tokens.cache_write'], + deprecationChain: [ + 'gen_ai.usage.cache_creation.input_tokens', + 'gen_ai.usage.cache_creation_input_tokens', + 'gen_ai.usage.input_tokens.cache_write', + ], + }, + 'gen_ai.usage.cache_creation_input_tokens': { + canonicalName: 'gen_ai.usage.cache_creation.input_tokens', + type: 'integer', + brief: 'The number of tokens written to the cache when processing the AI input (prompt).', + deprecationChain: [ + 'gen_ai.usage.cache_creation.input_tokens', + 'gen_ai.usage.cache_creation_input_tokens', + 'gen_ai.usage.input_tokens.cache_write', + ], }, 'gen_ai.usage.cache_read.input_tokens': { canonicalName: 'gen_ai.usage.cache_read.input_tokens', type: 'integer', brief: 'The number of cached tokens used to process the AI input (prompt).', - deprecationChain: ['gen_ai.usage.cache_read.input_tokens', 'gen_ai.usage.input_tokens.cached'], + deprecationChain: [ + 'gen_ai.usage.cache_read.input_tokens', + 'gen_ai.usage.cache_read_input_tokens', + 'gen_ai.usage.input_tokens.cached', + ], + }, + 'gen_ai.usage.cache_read_input_tokens': { + canonicalName: 'gen_ai.usage.cache_read.input_tokens', + type: 'integer', + brief: 'The number of cached tokens used to process the AI input (prompt).', + deprecationChain: [ + 'gen_ai.usage.cache_read.input_tokens', + 'gen_ai.usage.cache_read_input_tokens', + 'gen_ai.usage.input_tokens.cached', + ], }, 'gen_ai.usage.completion_tokens': { canonicalName: 'gen_ai.usage.output_tokens', @@ -8201,13 +8245,21 @@ export const ATTRIBUTE_SEARCH_METADATA: Record canonicalName: 'gen_ai.usage.cache_creation.input_tokens', type: 'integer', brief: 'The number of tokens written to the cache when processing the AI input (prompt).', - deprecationChain: ['gen_ai.usage.cache_creation.input_tokens', 'gen_ai.usage.input_tokens.cache_write'], + deprecationChain: [ + 'gen_ai.usage.cache_creation.input_tokens', + 'gen_ai.usage.cache_creation_input_tokens', + 'gen_ai.usage.input_tokens.cache_write', + ], }, 'gen_ai.usage.input_tokens.cached': { canonicalName: 'gen_ai.usage.cache_read.input_tokens', type: 'integer', brief: 'The number of cached tokens used to process the AI input (prompt).', - deprecationChain: ['gen_ai.usage.cache_read.input_tokens', 'gen_ai.usage.input_tokens.cached'], + deprecationChain: [ + 'gen_ai.usage.cache_read.input_tokens', + 'gen_ai.usage.cache_read_input_tokens', + 'gen_ai.usage.input_tokens.cached', + ], }, 'gen_ai.usage.output_tokens': { canonicalName: 'gen_ai.usage.output_tokens', diff --git a/model/attributes/gen_ai/gen_ai__usage__cache_creation__input_tokens.json b/model/attributes/gen_ai/gen_ai__usage__cache_creation__input_tokens.json index 9067c0d80..4fb10c274 100644 --- a/model/attributes/gen_ai/gen_ai__usage__cache_creation__input_tokens.json +++ b/model/attributes/gen_ai/gen_ai__usage__cache_creation__input_tokens.json @@ -1,18 +1,22 @@ { "key": "gen_ai.usage.cache_creation.input_tokens", "brief": "The number of tokens written to the cache when processing the AI input (prompt).", + "additional_context": [ + "This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to count tokens, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans." + ], "type": "integer", "apply_scrubbing": { "key": "manual" }, "is_in_otel": true, - "visibility": "public", "example": 100, - "additional_context": [ - "This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to count tokens, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans." - ], - "alias": ["gen_ai.usage.input_tokens.cache_write"], + "alias": ["gen_ai.usage.input_tokens.cache_write", "gen_ai.usage.cache_creation_input_tokens"], + "visibility": "public", "changelog": [ + { + "version": "next", + "description": "Added gen_ai.usage.cache_creation_input_tokens as an alias" + }, { "version": "0.11.0", "prs": [418], diff --git a/model/attributes/gen_ai/gen_ai__usage__cache_creation_input_tokens.json b/model/attributes/gen_ai/gen_ai__usage__cache_creation_input_tokens.json new file mode 100644 index 000000000..0f5f93d6e --- /dev/null +++ b/model/attributes/gen_ai/gen_ai__usage__cache_creation_input_tokens.json @@ -0,0 +1,24 @@ +{ + "key": "gen_ai.usage.cache_creation_input_tokens", + "brief": "The number of tokens written to the cache when processing the AI input (prompt).", + "type": "integer", + "apply_scrubbing": { + "key": "manual" + }, + "is_in_otel": false, + "examples": [100], + "alias": ["gen_ai.usage.cache_creation.input_tokens", "gen_ai.usage.input_tokens.cache_write"], + "deprecation": { + "_status": "backfill", + "replacement": "gen_ai.usage.cache_creation.input_tokens", + "reason": "This attribute is being deprecated in favor of gen_ai.usage.cache_creation.input_tokens." + }, + "visibility": "public", + "changelog": [ + { + "version": "next", + "prs": [582], + "description": "Added gen_ai.usage.cache_creation_input_tokens attribute" + } + ] +} diff --git a/model/attributes/gen_ai/gen_ai__usage__cache_read__input_tokens.json b/model/attributes/gen_ai/gen_ai__usage__cache_read__input_tokens.json index e7fe70599..23500c4fb 100644 --- a/model/attributes/gen_ai/gen_ai__usage__cache_read__input_tokens.json +++ b/model/attributes/gen_ai/gen_ai__usage__cache_read__input_tokens.json @@ -1,19 +1,23 @@ { "key": "gen_ai.usage.cache_read.input_tokens", "brief": "The number of cached tokens used to process the AI input (prompt).", + "additional_context": [ + "This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to count tokens, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans.", + "This is a subset of gen_ai.usage.input_tokens, not an independent count. Do not sum this with gen_ai.usage.input_tokens — it is already included." + ], "type": "integer", "apply_scrubbing": { "key": "manual" }, "is_in_otel": true, - "visibility": "public", "example": 50, - "additional_context": [ - "This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to count tokens, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans.", - "This is a subset of gen_ai.usage.input_tokens, not an independent count. Do not sum this with gen_ai.usage.input_tokens — it is already included." - ], - "alias": ["gen_ai.usage.input_tokens.cached"], + "alias": ["gen_ai.usage.input_tokens.cached", "gen_ai.usage.cache_read_input_tokens"], + "visibility": "public", "changelog": [ + { + "version": "next", + "description": "Added gen_ai.usage.cache_read_input_tokens as an alias" + }, { "version": "0.11.0", "prs": [418], diff --git a/model/attributes/gen_ai/gen_ai__usage__cache_read_input_tokens.json b/model/attributes/gen_ai/gen_ai__usage__cache_read_input_tokens.json new file mode 100644 index 000000000..c36d529b6 --- /dev/null +++ b/model/attributes/gen_ai/gen_ai__usage__cache_read_input_tokens.json @@ -0,0 +1,24 @@ +{ + "key": "gen_ai.usage.cache_read_input_tokens", + "brief": "The number of cached tokens used to process the AI input (prompt).", + "type": "integer", + "apply_scrubbing": { + "key": "manual" + }, + "is_in_otel": false, + "examples": [50], + "alias": ["gen_ai.usage.cache_read.input_tokens", "gen_ai.usage.input_tokens.cached"], + "deprecation": { + "_status": "backfill", + "replacement": "gen_ai.usage.cache_read.input_tokens", + "reason": "This attribute is being deprecated in favor of gen_ai.usage.cache_read.input_tokens." + }, + "visibility": "public", + "changelog": [ + { + "version": "next", + "prs": [582], + "description": "Added gen_ai.usage.cache_read_input_tokens attribute" + } + ] +} diff --git a/model/attributes/gen_ai/gen_ai__usage__input_tokens__cache_write.json b/model/attributes/gen_ai/gen_ai__usage__input_tokens__cache_write.json index bc9c601ac..d48cb9531 100644 --- a/model/attributes/gen_ai/gen_ai__usage__input_tokens__cache_write.json +++ b/model/attributes/gen_ai/gen_ai__usage__input_tokens__cache_write.json @@ -1,22 +1,26 @@ { "key": "gen_ai.usage.input_tokens.cache_write", "brief": "The number of tokens written to the cache when processing the AI input (prompt).", + "additional_context": [ + "This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to count tokens, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans." + ], "type": "integer", "apply_scrubbing": { "key": "manual" }, "is_in_otel": false, "example": 100, - "visibility": "public", - "additional_context": [ - "This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to count tokens, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans." - ], - "alias": ["gen_ai.usage.cache_creation.input_tokens"], + "alias": ["gen_ai.usage.cache_creation.input_tokens", "gen_ai.usage.cache_creation_input_tokens"], "deprecation": { "_status": "backfill", "replacement": "gen_ai.usage.cache_creation.input_tokens" }, + "visibility": "public", "changelog": [ + { + "version": "next", + "description": "Added gen_ai.usage.cache_creation_input_tokens as an alias" + }, { "version": "0.11.0", "prs": [418], diff --git a/model/attributes/gen_ai/gen_ai__usage__input_tokens__cached.json b/model/attributes/gen_ai/gen_ai__usage__input_tokens__cached.json index ddac88b5e..da5296cf3 100644 --- a/model/attributes/gen_ai/gen_ai__usage__input_tokens__cached.json +++ b/model/attributes/gen_ai/gen_ai__usage__input_tokens__cached.json @@ -1,23 +1,27 @@ { "key": "gen_ai.usage.input_tokens.cached", "brief": "The number of cached tokens used to process the AI input (prompt).", + "additional_context": [ + "This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to count tokens, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans.", + "This is a subset of gen_ai.usage.input_tokens, not an independent count. Do not sum this with gen_ai.usage.input_tokens — it is already included." + ], "type": "integer", "apply_scrubbing": { "key": "manual" }, "is_in_otel": false, "example": 50, - "visibility": "public", - "additional_context": [ - "This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to count tokens, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans.", - "This is a subset of gen_ai.usage.input_tokens, not an independent count. Do not sum this with gen_ai.usage.input_tokens — it is already included." - ], - "alias": ["gen_ai.usage.cache_read.input_tokens"], + "alias": ["gen_ai.usage.cache_read.input_tokens", "gen_ai.usage.cache_read_input_tokens"], "deprecation": { "_status": "backfill", "replacement": "gen_ai.usage.cache_read.input_tokens" }, + "visibility": "public", "changelog": [ + { + "version": "next", + "description": "Added gen_ai.usage.cache_read_input_tokens as an alias" + }, { "version": "0.11.0", "prs": [418], diff --git a/python/src/sentry_conventions/attributes.py b/python/src/sentry_conventions/attributes.py index 8814eb159..4b7caccd5 100644 --- a/python/src/sentry_conventions/attributes.py +++ b/python/src/sentry_conventions/attributes.py @@ -270,6 +270,8 @@ class _AttributeNamesMeta(type): "GEN_AI_TOOL_MESSAGE", "GEN_AI_TOOL_OUTPUT", "GEN_AI_TOOL_TYPE", + "_GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS", + "_GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS", "GEN_AI_USAGE_COMPLETION_TOKENS", "GEN_AI_USAGE_INPUT_TOKENS_CACHE_WRITE", "GEN_AI_USAGE_INPUT_TOKENS_CACHED", @@ -5303,7 +5305,22 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta): Apply Scrubbing: manual Defined in OTEL: Yes Visibility: public - Aliases: gen_ai.usage.input_tokens.cache_write + Aliases: gen_ai.usage.input_tokens.cache_write, gen_ai.usage.cache_creation_input_tokens + Example: 100 + """ + + # Path: model/attributes/gen_ai/gen_ai__usage__cache_creation_input_tokens.json + _GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS: Literal[ + "gen_ai.usage.cache_creation_input_tokens" + ] = "gen_ai.usage.cache_creation_input_tokens" + """The number of tokens written to the cache when processing the AI input (prompt). + + Type: int + Apply Scrubbing: manual + Defined in OTEL: No + Visibility: public + Aliases: gen_ai.usage.cache_creation.input_tokens, gen_ai.usage.input_tokens.cache_write + DEPRECATED: Use gen_ai.usage.cache_creation.input_tokens instead - This attribute is being deprecated in favor of gen_ai.usage.cache_creation.input_tokens. Example: 100 """ @@ -5317,7 +5334,22 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta): Apply Scrubbing: manual Defined in OTEL: Yes Visibility: public - Aliases: gen_ai.usage.input_tokens.cached + Aliases: gen_ai.usage.input_tokens.cached, gen_ai.usage.cache_read_input_tokens + Example: 50 + """ + + # Path: model/attributes/gen_ai/gen_ai__usage__cache_read_input_tokens.json + _GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS: Literal[ + "gen_ai.usage.cache_read_input_tokens" + ] = "gen_ai.usage.cache_read_input_tokens" + """The number of cached tokens used to process the AI input (prompt). + + Type: int + Apply Scrubbing: manual + Defined in OTEL: No + Visibility: public + Aliases: gen_ai.usage.cache_read.input_tokens, gen_ai.usage.input_tokens.cached + DEPRECATED: Use gen_ai.usage.cache_read.input_tokens instead - This attribute is being deprecated in favor of gen_ai.usage.cache_read.input_tokens. Example: 50 """ @@ -5360,7 +5392,7 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta): Apply Scrubbing: manual Defined in OTEL: No Visibility: public - Aliases: gen_ai.usage.cache_creation.input_tokens + Aliases: gen_ai.usage.cache_creation.input_tokens, gen_ai.usage.cache_creation_input_tokens DEPRECATED: Use gen_ai.usage.cache_creation.input_tokens instead Example: 100 """ @@ -5375,7 +5407,7 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta): Apply Scrubbing: manual Defined in OTEL: No Visibility: public - Aliases: gen_ai.usage.cache_read.input_tokens + Aliases: gen_ai.usage.cache_read.input_tokens, gen_ai.usage.cache_read_input_tokens DEPRECATED: Use gen_ai.usage.cache_read.input_tokens instead Example: 50 """ @@ -18125,14 +18157,22 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta): type=AttributeType.INTEGER, keys=( "gen_ai.usage.cache_creation.input_tokens", + "gen_ai.usage.cache_creation_input_tokens", "gen_ai.usage.input_tokens.cache_write", ), apply_scrubbing=ApplyScrubbingInfo(key=ApplyScrubbing.MANUAL), is_in_otel=True, visibility=Visibility.PUBLIC, example=100, - aliases=["gen_ai.usage.input_tokens.cache_write"], + aliases=[ + "gen_ai.usage.input_tokens.cache_write", + "gen_ai.usage.cache_creation_input_tokens", + ], changelog=[ + ChangelogEntry( + version="next", + description="Added gen_ai.usage.cache_creation_input_tokens as an alias", + ), ChangelogEntry( version="0.11.0", prs=[418], @@ -18143,19 +18183,57 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta): "This attribute appears on both agent parent spans (aggregated totals) and LLM child spans (per-call values). When using sum() to count tokens, filter to gen_ai.operation.type:ai_client to avoid double-counting hierarchical spans." ], ), + "gen_ai.usage.cache_creation_input_tokens": AttributeMetadata( + brief="The number of tokens written to the cache when processing the AI input (prompt).", + type=AttributeType.INTEGER, + keys=( + "gen_ai.usage.cache_creation.input_tokens", + "gen_ai.usage.cache_creation_input_tokens", + "gen_ai.usage.input_tokens.cache_write", + ), + apply_scrubbing=ApplyScrubbingInfo(key=ApplyScrubbing.MANUAL), + is_in_otel=False, + visibility=Visibility.PUBLIC, + example=100, + examples=[100], + deprecation=DeprecationInfo( + replacement="gen_ai.usage.cache_creation.input_tokens", + reason="This attribute is being deprecated in favor of gen_ai.usage.cache_creation.input_tokens.", + status=DeprecationStatus.BACKFILL, + ), + aliases=[ + "gen_ai.usage.cache_creation.input_tokens", + "gen_ai.usage.input_tokens.cache_write", + ], + changelog=[ + ChangelogEntry( + version="next", + prs=[582], + description="Added gen_ai.usage.cache_creation_input_tokens attribute", + ), + ], + ), "gen_ai.usage.cache_read.input_tokens": AttributeMetadata( brief="The number of cached tokens used to process the AI input (prompt).", type=AttributeType.INTEGER, keys=( "gen_ai.usage.cache_read.input_tokens", + "gen_ai.usage.cache_read_input_tokens", "gen_ai.usage.input_tokens.cached", ), apply_scrubbing=ApplyScrubbingInfo(key=ApplyScrubbing.MANUAL), is_in_otel=True, visibility=Visibility.PUBLIC, example=50, - aliases=["gen_ai.usage.input_tokens.cached"], + aliases=[ + "gen_ai.usage.input_tokens.cached", + "gen_ai.usage.cache_read_input_tokens", + ], changelog=[ + ChangelogEntry( + version="next", + description="Added gen_ai.usage.cache_read_input_tokens as an alias", + ), ChangelogEntry( version="0.11.0", prs=[418], @@ -18167,6 +18245,36 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta): "This is a subset of gen_ai.usage.input_tokens, not an independent count. Do not sum this with gen_ai.usage.input_tokens — it is already included.", ], ), + "gen_ai.usage.cache_read_input_tokens": AttributeMetadata( + brief="The number of cached tokens used to process the AI input (prompt).", + type=AttributeType.INTEGER, + keys=( + "gen_ai.usage.cache_read.input_tokens", + "gen_ai.usage.cache_read_input_tokens", + "gen_ai.usage.input_tokens.cached", + ), + apply_scrubbing=ApplyScrubbingInfo(key=ApplyScrubbing.MANUAL), + is_in_otel=False, + visibility=Visibility.PUBLIC, + example=50, + examples=[50], + deprecation=DeprecationInfo( + replacement="gen_ai.usage.cache_read.input_tokens", + reason="This attribute is being deprecated in favor of gen_ai.usage.cache_read.input_tokens.", + status=DeprecationStatus.BACKFILL, + ), + aliases=[ + "gen_ai.usage.cache_read.input_tokens", + "gen_ai.usage.input_tokens.cached", + ], + changelog=[ + ChangelogEntry( + version="next", + prs=[582], + description="Added gen_ai.usage.cache_read_input_tokens attribute", + ), + ], + ), "gen_ai.usage.completion_tokens": AttributeMetadata( brief="The number of tokens used in the GenAI response (completion).", type=AttributeType.INTEGER, @@ -18232,6 +18340,7 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta): type=AttributeType.INTEGER, keys=( "gen_ai.usage.cache_creation.input_tokens", + "gen_ai.usage.cache_creation_input_tokens", "gen_ai.usage.input_tokens.cache_write", ), apply_scrubbing=ApplyScrubbingInfo(key=ApplyScrubbing.MANUAL), @@ -18242,8 +18351,15 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta): replacement="gen_ai.usage.cache_creation.input_tokens", status=DeprecationStatus.BACKFILL, ), - aliases=["gen_ai.usage.cache_creation.input_tokens"], + aliases=[ + "gen_ai.usage.cache_creation.input_tokens", + "gen_ai.usage.cache_creation_input_tokens", + ], changelog=[ + ChangelogEntry( + version="next", + description="Added gen_ai.usage.cache_creation_input_tokens as an alias", + ), ChangelogEntry( version="0.11.0", prs=[418], @@ -18263,6 +18379,7 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta): type=AttributeType.INTEGER, keys=( "gen_ai.usage.cache_read.input_tokens", + "gen_ai.usage.cache_read_input_tokens", "gen_ai.usage.input_tokens.cached", ), apply_scrubbing=ApplyScrubbingInfo(key=ApplyScrubbing.MANUAL), @@ -18273,8 +18390,15 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta): replacement="gen_ai.usage.cache_read.input_tokens", status=DeprecationStatus.BACKFILL, ), - aliases=["gen_ai.usage.cache_read.input_tokens"], + aliases=[ + "gen_ai.usage.cache_read.input_tokens", + "gen_ai.usage.cache_read_input_tokens", + ], changelog=[ + ChangelogEntry( + version="next", + description="Added gen_ai.usage.cache_read_input_tokens as an alias", + ), ChangelogEntry( version="0.11.0", prs=[418], @@ -26641,7 +26765,9 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta): "gen_ai.tool.output": str, "gen_ai.tool.type": str, "gen_ai.usage.cache_creation.input_tokens": int, + "gen_ai.usage.cache_creation_input_tokens": int, "gen_ai.usage.cache_read.input_tokens": int, + "gen_ai.usage.cache_read_input_tokens": int, "gen_ai.usage.completion_tokens": int, "gen_ai.usage.input_tokens": int, "gen_ai.usage.input_tokens.cache_write": int,