Skip to content
Open
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
33 changes: 33 additions & 0 deletions javascript/sentry-conventions/src/attributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3026,6 +3026,26 @@ export const GEN_AI_EMBEDDINGS_INPUT = 'gen_ai.embeddings.input';
*/
export type GEN_AI_EMBEDDINGS_INPUT_TYPE = string;

// Path: model/attributes/gen_ai/gen_ai__function_id.json

/**
* The function identifier associated with the AI operation. `gen_ai.function_id`
Copy link
Copy Markdown

@alexander-alderman-webb alexander-alderman-webb Apr 2, 2026

Choose a reason for hiding this comment

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

We could use this attribute to capture other library-specific tracing labels.
For example, recording run_name in LangChain as gen_ai.function_id.
With the suggested description the attribute would not be limited to Vercel AI.

Suggested change
* The function identifier associated with the AI operation. `gen_ai.function_id`
* Framework-specific tracing label for the execution of a function or other unit of execution in a generative AI system.

*
* Attribute Value Type: `string` {@link GEN_AI_FUNCTION_ID_TYPE}
*
* Contains PII: maybe
*
* Attribute defined in OTEL: No
*
* @example "my-awesome-function"
*/
export const GEN_AI_FUNCTION_ID = 'gen_ai.function_id';

/**
* Type for {@link GEN_AI_FUNCTION_ID} gen_ai.function_id
*/
export type GEN_AI_FUNCTION_ID_TYPE = string;

// Path: model/attributes/gen_ai/gen_ai__input__messages.json

/**
Expand Down Expand Up @@ -10360,6 +10380,7 @@ export const ATTRIBUTE_TYPE: Record<string, AttributeType> = {
[GEN_AI_COST_OUTPUT_TOKENS]: 'double',
[GEN_AI_COST_TOTAL_TOKENS]: 'double',
[GEN_AI_EMBEDDINGS_INPUT]: 'string',
[GEN_AI_FUNCTION_ID]: 'string',
[GEN_AI_INPUT_MESSAGES]: 'string',
[GEN_AI_OPERATION_NAME]: 'string',
[GEN_AI_OPERATION_TYPE]: 'string',
Expand Down Expand Up @@ -10848,6 +10869,7 @@ export type AttributeName =
| typeof GEN_AI_COST_OUTPUT_TOKENS
| typeof GEN_AI_COST_TOTAL_TOKENS
| typeof GEN_AI_EMBEDDINGS_INPUT
| typeof GEN_AI_FUNCTION_ID
| typeof GEN_AI_INPUT_MESSAGES
| typeof GEN_AI_OPERATION_NAME
| typeof GEN_AI_OPERATION_TYPE
Expand Down Expand Up @@ -13026,6 +13048,16 @@ export const ATTRIBUTE_METADATA: Record<AttributeName, AttributeMetadata> = {
example: "What's the weather in Paris?",
changelog: [{ version: '0.3.1', prs: [195] }],
},
[GEN_AI_FUNCTION_ID]: {
brief: 'The function identifier associated with the AI operation.',
type: 'string',
pii: {
isPii: 'maybe',
},
isInOtel: false,
example: 'my-awesome-function',
changelog: [{ version: 'next', prs: [308], description: 'Added gen_ai.function_id attribute' }],
},
[GEN_AI_INPUT_MESSAGES]: {
brief:
'The messages passed to the model. It has to be a stringified version of an array of objects. The `role` attribute of each object must be `"user"`, `"assistant"`, `"tool"`, or `"system"`. For messages of the role `"tool"`, the `content` can be a string or an arbitrary object with information about the tool call. For other messages the `content` can be either a string or a list of objects in the format `{type: "text", text:"..."}`.',
Expand Down Expand Up @@ -17239,6 +17271,7 @@ export type Attributes = {
[GEN_AI_COST_OUTPUT_TOKENS]?: GEN_AI_COST_OUTPUT_TOKENS_TYPE;
[GEN_AI_COST_TOTAL_TOKENS]?: GEN_AI_COST_TOTAL_TOKENS_TYPE;
[GEN_AI_EMBEDDINGS_INPUT]?: GEN_AI_EMBEDDINGS_INPUT_TYPE;
[GEN_AI_FUNCTION_ID]?: GEN_AI_FUNCTION_ID_TYPE;
[GEN_AI_INPUT_MESSAGES]?: GEN_AI_INPUT_MESSAGES_TYPE;
[GEN_AI_OPERATION_NAME]?: GEN_AI_OPERATION_NAME_TYPE;
[GEN_AI_OPERATION_TYPE]?: GEN_AI_OPERATION_TYPE_TYPE;
Expand Down
17 changes: 17 additions & 0 deletions model/attributes/gen_ai/gen_ai__function_id.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"key": "gen_ai.function_id",
"brief": "The function identifier associated with the AI operation.",
"type": "string",
"pii": {
"key": "maybe"
},
"is_in_otel": false,
"example": "my-awesome-function",
"changelog": [
{
"version": "next",
"prs": [308],
"description": "Added gen_ai.function_id attribute"
}
]
}
25 changes: 25 additions & 0 deletions python/src/sentry_conventions/attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1829,6 +1829,16 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta):
Example: "What's the weather in Paris?"
"""

# Path: model/attributes/gen_ai/gen_ai__function_id.json
GEN_AI_FUNCTION_ID: Literal["gen_ai.function_id"] = "gen_ai.function_id"
"""The function identifier associated with the AI operation.

Type: str
Contains PII: maybe
Defined in OTEL: No
Example: "my-awesome-function"
"""

# Path: model/attributes/gen_ai/gen_ai__input__messages.json
GEN_AI_INPUT_MESSAGES: Literal["gen_ai.input.messages"] = "gen_ai.input.messages"
"""The messages passed to the model. It has to be a stringified version of an array of objects. The `role` attribute of each object must be `"user"`, `"assistant"`, `"tool"`, or `"system"`. For messages of the role `"tool"`, the `content` can be a string or an arbitrary object with information about the tool call. For other messages the `content` can be either a string or a list of objects in the format `{type: "text", text:"..."}`.
Expand Down Expand Up @@ -7465,6 +7475,20 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta):
ChangelogEntry(version="0.3.1", prs=[195]),
],
),
"gen_ai.function_id": AttributeMetadata(
brief="The function identifier associated with the AI operation.",
type=AttributeType.STRING,
pii=PiiInfo(isPii=IsPii.MAYBE),
is_in_otel=False,
example="my-awesome-function",
changelog=[
ChangelogEntry(
version="next",
prs=[308],
description="Added gen_ai.function_id attribute",
),
],
),
"gen_ai.input.messages": AttributeMetadata(
brief='The messages passed to the model. It has to be a stringified version of an array of objects. The `role` attribute of each object must be `"user"`, `"assistant"`, `"tool"`, or `"system"`. For messages of the role `"tool"`, the `content` can be a string or an arbitrary object with information about the tool call. For other messages the `content` can be either a string or a list of objects in the format `{type: "text", text:"..."}`.',
type=AttributeType.STRING,
Expand Down Expand Up @@ -11637,6 +11661,7 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta):
"gen_ai.cost.output_tokens": float,
"gen_ai.cost.total_tokens": float,
"gen_ai.embeddings.input": str,
"gen_ai.function_id": str,
"gen_ai.input.messages": str,
"gen_ai.operation.name": str,
"gen_ai.operation.type": str,
Expand Down
Loading