From 3fb427813f66e11f5b4a03e37bcdbb5046954df5 Mon Sep 17 00:00:00 2001 From: Fabian Schindler Date: Thu, 2 Apr 2026 10:12:19 +0200 Subject: [PATCH 1/4] feat(attributes): add `gen_ai.function_id` attribute --- .../sentry-conventions/src/attributes.ts | 33 +++++++++++++++++++ .../gen_ai/gen_ai__function_id.json | 17 ++++++++++ python/src/sentry_conventions/attributes.py | 25 ++++++++++++++ 3 files changed, 75 insertions(+) create mode 100644 model/attributes/gen_ai/gen_ai__function_id.json diff --git a/javascript/sentry-conventions/src/attributes.ts b/javascript/sentry-conventions/src/attributes.ts index 6e68f75d..108e16af 100644 --- a/javascript/sentry-conventions/src/attributes.ts +++ b/javascript/sentry-conventions/src/attributes.ts @@ -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` + * + * 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 /** @@ -10360,6 +10380,7 @@ export const ATTRIBUTE_TYPE: Record = { [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', @@ -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 @@ -13026,6 +13048,16 @@ export const ATTRIBUTE_METADATA: Record = { 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:"..."}`.', @@ -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; diff --git a/model/attributes/gen_ai/gen_ai__function_id.json b/model/attributes/gen_ai/gen_ai__function_id.json new file mode 100644 index 00000000..d7b47ba8 --- /dev/null +++ b/model/attributes/gen_ai/gen_ai__function_id.json @@ -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" + } + ] +} diff --git a/python/src/sentry_conventions/attributes.py b/python/src/sentry_conventions/attributes.py index a1602e9b..2c189bd5 100644 --- a/python/src/sentry_conventions/attributes.py +++ b/python/src/sentry_conventions/attributes.py @@ -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:"..."}`. @@ -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, @@ -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, From e9107eb99e4ac4bceb49c6ecc8e0e4473f298dc9 Mon Sep 17 00:00:00 2001 From: Fabian Schindler Date: Thu, 9 Apr 2026 14:17:51 +0200 Subject: [PATCH 2/4] Apply suggestions from code review Co-authored-by: Alex Alderman Webb --- javascript/sentry-conventions/src/attributes.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/javascript/sentry-conventions/src/attributes.ts b/javascript/sentry-conventions/src/attributes.ts index 108e16af..2cbf359a 100644 --- a/javascript/sentry-conventions/src/attributes.ts +++ b/javascript/sentry-conventions/src/attributes.ts @@ -3029,7 +3029,7 @@ 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` + * 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} * From b5872a9469717c191b64fe196180fa60ba3b0d4e Mon Sep 17 00:00:00 2001 From: Fabian Schindler Date: Mon, 13 Apr 2026 13:02:47 +0200 Subject: [PATCH 3/4] fix: linting issue --- javascript/sentry-conventions/src/attributes.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/javascript/sentry-conventions/src/attributes.ts b/javascript/sentry-conventions/src/attributes.ts index 2cbf359a..108e16af 100644 --- a/javascript/sentry-conventions/src/attributes.ts +++ b/javascript/sentry-conventions/src/attributes.ts @@ -3029,7 +3029,7 @@ export type GEN_AI_EMBEDDINGS_INPUT_TYPE = string; // Path: model/attributes/gen_ai/gen_ai__function_id.json /** - * Framework-specific tracing label for the execution of a function or other unit of execution in a generative AI system. + * The function identifier associated with the AI operation. `gen_ai.function_id` * * Attribute Value Type: `string` {@link GEN_AI_FUNCTION_ID_TYPE} * From 53e3e103f36c900ff2eaedff8e6dfe7f71235ec1 Mon Sep 17 00:00:00 2001 From: Fabian Schindler Date: Mon, 13 Apr 2026 14:15:25 +0200 Subject: [PATCH 4/4] fix: actually applying review comment --- javascript/sentry-conventions/src/attributes.ts | 5 +++-- model/attributes/gen_ai/gen_ai__function_id.json | 2 +- python/src/sentry_conventions/attributes.py | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/javascript/sentry-conventions/src/attributes.ts b/javascript/sentry-conventions/src/attributes.ts index 108e16af..5c4f5673 100644 --- a/javascript/sentry-conventions/src/attributes.ts +++ b/javascript/sentry-conventions/src/attributes.ts @@ -3029,7 +3029,7 @@ 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` + * Framework-specific tracing label for the execution of a function or other unit of execution in a generative AI system. `gen_ai.function_id` * * Attribute Value Type: `string` {@link GEN_AI_FUNCTION_ID_TYPE} * @@ -13049,7 +13049,8 @@ export const ATTRIBUTE_METADATA: Record = { changelog: [{ version: '0.3.1', prs: [195] }], }, [GEN_AI_FUNCTION_ID]: { - brief: 'The function identifier associated with the AI operation.', + brief: + 'Framework-specific tracing label for the execution of a function or other unit of execution in a generative AI system.', type: 'string', pii: { isPii: 'maybe', diff --git a/model/attributes/gen_ai/gen_ai__function_id.json b/model/attributes/gen_ai/gen_ai__function_id.json index d7b47ba8..5e4e8232 100644 --- a/model/attributes/gen_ai/gen_ai__function_id.json +++ b/model/attributes/gen_ai/gen_ai__function_id.json @@ -1,6 +1,6 @@ { "key": "gen_ai.function_id", - "brief": "The function identifier associated with the AI operation.", + "brief": "Framework-specific tracing label for the execution of a function or other unit of execution in a generative AI system.", "type": "string", "pii": { "key": "maybe" diff --git a/python/src/sentry_conventions/attributes.py b/python/src/sentry_conventions/attributes.py index 2c189bd5..42c8df54 100644 --- a/python/src/sentry_conventions/attributes.py +++ b/python/src/sentry_conventions/attributes.py @@ -1831,7 +1831,7 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta): # 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. + """Framework-specific tracing label for the execution of a function or other unit of execution in a generative AI system. Type: str Contains PII: maybe @@ -7476,7 +7476,7 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta): ], ), "gen_ai.function_id": AttributeMetadata( - brief="The function identifier associated with the AI operation.", + brief="Framework-specific tracing label for the execution of a function or other unit of execution in a generative AI system.", type=AttributeType.STRING, pii=PiiInfo(isPii=IsPii.MAYBE), is_in_otel=False,