Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
838 changes: 776 additions & 62 deletions javascript/sentry-conventions/src/attributes.ts

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion model/attributes/ai/ai__generation_id.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@
},
"is_in_otel": false,
"example": "gen_123abc",
"alias": ["gen_ai.response.id"],
"alias": ["gen_ai.response.id", "ai.response.id"],
"deprecation": {
"_status": "backfill",
"replacement": "gen_ai.response.id"
},
"visibility": "public",
"changelog": [
{
"version": "next",
"description": "Added ai.response.id as an alias"
},
{
"version": "0.1.0",
"prs": [55, 57, 61, 108, 127]
Expand Down
24 changes: 24 additions & 0 deletions model/attributes/ai/ai__model__id.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"key": "ai.model.id",
"brief": "The id of the model used by the Vercel AI SDK.",
"type": "string",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": false,
"examples": ["gpt-4o"],
"alias": ["gen_ai.request.model", "ai.model_id"],
"deprecation": {
"_status": "backfill",
"replacement": "gen_ai.request.model",
"reason": "This attribute is being deprecated in favor of gen_ai.request.model."
},
"visibility": "public",
"changelog": [
{
"version": "next",
"prs": [583],
"description": "Added ai.model.id attribute"
}
]
}
6 changes: 5 additions & 1 deletion model/attributes/ai/ai__model_id.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@
},
"is_in_otel": false,
"example": "gpt-4",
"alias": ["gen_ai.request.model"],
"alias": ["gen_ai.request.model", "ai.model.id"],
"deprecation": {
"_status": "backfill",
"replacement": "gen_ai.request.model"
},
"visibility": "public",
"changelog": [
{
"version": "next",
"description": "Added ai.model.id as an alias"
},
{
"version": "0.1.0",
"prs": [57, 61, 127]
Expand Down
24 changes: 24 additions & 0 deletions model/attributes/ai/ai__prompt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"key": "ai.prompt",
"brief": "The prompt passed to the Vercel AI SDK, as a stringified object.",
"type": "string",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": false,
"examples": ["{\"prompt\":\"What is the weather in Paris?\"}"],
"alias": ["gen_ai.input.messages", "ai.texts", "ai.prompt.messages", "gen_ai.prompt"],
"deprecation": {
"_status": "backfill",
"replacement": "gen_ai.input.messages",
"reason": "This attribute is being deprecated in favor of gen_ai.input.messages."
},
"visibility": "public",
"changelog": [
{
"version": "next",
"prs": [583],
"description": "Added ai.prompt attribute"
}
]
}
8 changes: 6 additions & 2 deletions model/attributes/ai/ai__prompt__messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@
"key": "manual"
},
"is_in_otel": false,
"visibility": "public",
"example": "[{\"role\": \"user\", \"message\": \"hello\"}]",
"alias": ["gen_ai.input.messages", "ai.texts", "gen_ai.prompt"],
"alias": ["gen_ai.input.messages", "ai.texts", "gen_ai.prompt", "ai.prompt"],
"deprecation": {
"_status": "backfill",
"replacement": "gen_ai.input.messages"
},
"visibility": "public",
"changelog": [
{
"version": "next",
"description": "Added ai.prompt as an alias"
},
{
"version": "0.19.0",
"prs": [498],
Expand Down
23 changes: 23 additions & 0 deletions model/attributes/ai/ai__prompt__tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"key": "ai.prompt.tools",
"brief": "The tools made available to the model, as an array of stringified tool definitions.",
"type": "string[]",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": false,
"examples": [["{\"type\":\"function\",\"name\":\"get_weather\"}"]],
"deprecation": {
"_status": "backfill",
"replacement": "gen_ai.tool.definitions",
"reason": "This attribute is being deprecated in favor of gen_ai.tool.definitions."
},
"visibility": "public",
"changelog": [
{
"version": "next",
"prs": [583],
"description": "Added ai.prompt.tools attribute"
}
]
}
Comment on lines +13 to +23

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The attribute ai.prompt.tools (a string[]) is configured to backfill to gen_ai.tool.definitions (a string), but their types are incompatible for a direct copy, which will cause ingestion failures.
Severity: HIGH

Suggested Fix

To resolve the type mismatch, either change _status from backfill to null and add a reason documenting the incompatibility, or change _status to transform and define a transformation to correctly convert the string[] value into a string.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: model/attributes/ai/ai__prompt__tools.json#L1-L23

Potential issue: The configuration for `ai.prompt.tools` specifies `_status: "backfill"`
to migrate its value to the replacement attribute `gen_ai.tool.definitions`. However,
the source attribute is a `string[]` (array of strings) while the destination is a
`string`. The backfill process performs a direct value copy, which will fail due to this
type mismatch. This will cause the ingestion pipeline to fail or lead to data corruption
when processing spans containing the `ai.prompt.tools` attribute. Existing patterns in
the codebase for such type mismatches use `_status: null` with a reason or `_status:
"transform"` to handle the conversion.

24 changes: 24 additions & 0 deletions model/attributes/ai/ai__response__id.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"key": "ai.response.id",
"brief": "The id of the response returned by the model.",
"type": "string",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": false,
"examples": ["chatcmpl-BuKJgVSKAMTUYbBSjHTMUuNGKzOPY"],
"alias": ["gen_ai.response.id", "ai.generation_id"],
"deprecation": {
"_status": "backfill",
"replacement": "gen_ai.response.id",
"reason": "This attribute is being deprecated in favor of gen_ai.response.id."
},
"visibility": "public",
"changelog": [
{
"version": "next",
"prs": [583],
"description": "Added ai.response.id attribute"
}
]
}
24 changes: 24 additions & 0 deletions model/attributes/ai/ai__response__model.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"key": "ai.response.model",
"brief": "The id of the model that produced the response.",
"type": "string",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": false,
"examples": ["gpt-4o-2024-08-06"],
"alias": ["gen_ai.response.model"],
"deprecation": {
"_status": "backfill",
"replacement": "gen_ai.response.model",
"reason": "This attribute is being deprecated in favor of gen_ai.response.model."
},
"visibility": "public",
"changelog": [
{
"version": "next",
"prs": [583],
"description": "Added ai.response.model attribute"
}
]
}
22 changes: 22 additions & 0 deletions model/attributes/ai/ai__response__object.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"key": "ai.response.object",
"brief": "The type of the object returned by the model.",
"type": "string",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": false,
"examples": ["chat.completion"],
"deprecation": {
"_status": null,
"reason": "This attribute is deprecated. The Sentry conventions have no replacement for the raw Vercel AI response object type."
},
"visibility": "public",
"changelog": [
{
"version": "next",
"prs": [583],
"description": "Added ai.response.object attribute"
}
]
}
22 changes: 22 additions & 0 deletions model/attributes/ai/ai__response__timestamp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"key": "ai.response.timestamp",
"brief": "The ISO 8601 timestamp at which the response was produced.",
"type": "string",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": false,
"examples": ["2026-02-19T15:32:11.000Z"],
"deprecation": {
"_status": null,
"reason": "This attribute is deprecated. The span start and end timestamps carry the same information."
},
"visibility": "public",
"changelog": [
{
"version": "next",
"prs": [583],
"description": "Added ai.response.timestamp attribute"
}
]
}
22 changes: 22 additions & 0 deletions model/attributes/ai/ai__schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"key": "ai.schema",
"brief": "The stringified JSON schema the model output must conform to.",
"type": "string",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": false,
"examples": ["{\"type\":\"object\",\"properties\":{\"city\":{\"type\":\"string\"}}}"],
"deprecation": {
"_status": null,
"reason": "This attribute is deprecated. The Sentry conventions have no replacement for the requested output schema."
},
"visibility": "public",
"changelog": [
{
"version": "next",
"prs": [583],
"description": "Added ai.schema attribute"
}
]
}
6 changes: 5 additions & 1 deletion model/attributes/ai/ai__texts.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@
},
"is_in_otel": false,
"example": ["Hello, how are you?", "What is the capital of France?"],
"alias": ["gen_ai.input.messages", "ai.prompt.messages", "gen_ai.prompt"],
"alias": ["gen_ai.input.messages", "ai.prompt.messages", "gen_ai.prompt", "ai.prompt"],
"deprecation": {
"_status": "backfill",
"replacement": "gen_ai.input.messages"
},
"visibility": "public",
"changelog": [
{
"version": "next",
"description": "Added ai.prompt as an alias"
},
{
"version": "0.5.0",
"prs": [264]
Expand Down
6 changes: 5 additions & 1 deletion model/attributes/ai/ai__total_tokens__used.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@
},
"is_in_otel": false,
"example": 30,
"alias": ["gen_ai.usage.total_tokens"],
"alias": ["gen_ai.usage.total_tokens", "ai.usage.tokens"],
"deprecation": {
"_status": "backfill",
"replacement": "gen_ai.usage.total_tokens"
},
"visibility": "public",
"changelog": [
{
"version": "next",
"description": "Added ai.usage.tokens as an alias"
},
{
"version": "0.4.0",
"prs": [228]
Expand Down
24 changes: 24 additions & 0 deletions model/attributes/ai/ai__usage__tokens.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"key": "ai.usage.tokens",
"brief": "The total number of tokens used for the request and the response.",
"type": "integer",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": false,
"examples": [150],
"alias": ["gen_ai.usage.total_tokens", "ai.total_tokens.used"],
"deprecation": {
"_status": "backfill",
"replacement": "gen_ai.usage.total_tokens",
"reason": "This attribute is being deprecated in favor of gen_ai.usage.total_tokens."
},
"visibility": "public",
"changelog": [
{
"version": "next",
"prs": [583],
"description": "Added ai.usage.tokens attribute"
}
]
}
22 changes: 22 additions & 0 deletions model/attributes/ai/ai__values.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"key": "ai.values",
"brief": "The stringified values produced by a Vercel AI SDK object or array generation.",
"type": "string",
"apply_scrubbing": {
"key": "manual"
},
"is_in_otel": false,
"examples": ["[{\"city\":\"Paris\"}]"],
"deprecation": {
"_status": null,
"reason": "This attribute is deprecated. Use gen_ai.output.messages for model output instead."
},
"visibility": "public",
"changelog": [
{
"version": "next",
"prs": [583],
"description": "Added ai.values attribute"
}
]
}
6 changes: 5 additions & 1 deletion model/attributes/gen_ai/gen_ai__input__messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@
},
"is_in_otel": true,
"example": "[{\"role\": \"user\", \"parts\": [{\"type\": \"text\", \"content\": \"Weather in Paris?\"}]}, {\"role\": \"assistant\", \"parts\": [{\"type\": \"tool_call\", \"id\": \"call_VSPygqKTWdrhaFErNvMV18Yl\", \"name\": \"get_weather\", \"arguments\": {\"location\": \"Paris\"}}]}, {\"role\": \"tool\", \"parts\": [{\"type\": \"tool_call_response\", \"id\": \"call_VSPygqKTWdrhaFErNvMV18Yl\", \"result\": \"rainy, 57°F\"}]}]",
"alias": ["ai.texts", "ai.prompt.messages", "gen_ai.prompt"],
"alias": ["ai.texts", "ai.prompt.messages", "gen_ai.prompt", "ai.prompt"],
"visibility": "public",
"changelog": [
{
"version": "next",
"description": "Added ai.prompt as an alias"
},
{
"version": "0.5.0",
"prs": [264]
Expand Down
6 changes: 5 additions & 1 deletion model/attributes/gen_ai/gen_ai__prompt.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@
},
"is_in_otel": true,
"example": "[{\"role\": \"user\", \"message\": \"hello\"}]",
"alias": ["gen_ai.input.messages", "ai.texts", "ai.prompt.messages"],
"alias": ["gen_ai.input.messages", "ai.texts", "ai.prompt.messages", "ai.prompt"],
"deprecation": {
"_status": "backfill",
"replacement": "gen_ai.input.messages",
"reason": "Deprecated from OTEL, use gen_ai.input.messages with the new format instead."
},
"visibility": "public",
"changelog": [
{
"version": "next",
"description": "Added ai.prompt as an alias"
},
{
"version": "0.1.0",
"prs": [74, 108, 119]
Expand Down
6 changes: 5 additions & 1 deletion model/attributes/gen_ai/gen_ai__request__model.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@
},
"is_in_otel": true,
"example": "gpt-4-turbo-preview",
"alias": ["ai.model_id"],
"alias": ["ai.model_id", "ai.model.id"],
"visibility": "public",
"changelog": [
{
"version": "next",
"description": "Added ai.model.id as an alias"
},
{
"version": "0.1.0",
"prs": [62, 127]
Expand Down
Loading
Loading