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
12 changes: 11 additions & 1 deletion javascript/sentry-conventions/src/attributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7819,6 +7819,8 @@ export type GEN_AI_PROVIDER_NAME_TYPE = string;
* Attribute defined in OTEL: No
* Visibility: public
*
* Aliases: {@link GEN_AI_TOOL_DEFINITIONS} `gen_ai.tool.definitions`
*
* @deprecated Use {@link GEN_AI_TOOL_DEFINITIONS} (gen_ai.tool.definitions) instead
* @example "[{\"name\": \"get_weather\", \"description\": \"Get the weather for a given location\"}, {\"name\": \"get_news\", \"description\": \"Get the news for a given topic\"}]"
*/
Expand Down Expand Up @@ -8476,6 +8478,8 @@ export type GEN_AI_TOOL_CALL_RESULT_TYPE = string;
* Attribute defined in OTEL: Yes
* Visibility: public
*
* Aliases: {@link GEN_AI_REQUEST_AVAILABLE_TOOLS} `gen_ai.request.available_tools`
*
* @example "[{\"type\": \"function\", \"name\": \"get_current_weather\", \"description\": \"Get the current weather in a given location\", \"parameters\": {\"type\": \"object\", \"properties\": {\"location\": {\"type\": \"string\", \"description\": \"The city and state, e.g. San Francisco, CA\"}, \"unit\": {\"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"]}}, \"required\": [\"location\", \"unit\"]}}]"
*/
export const GEN_AI_TOOL_DEFINITIONS = 'gen_ai.tool.definitions';
Expand Down Expand Up @@ -25748,7 +25752,9 @@ export const ATTRIBUTE_METADATA: Record<AttributeName, AttributeMetadata> = {
replacement: 'gen_ai.tool.definitions',
status: 'normalize',
},
aliases: ['gen_ai.tool.definitions'],
changelog: [
{ version: 'next', description: 'Added gen_ai.tool.definitions as an alias' },
{ version: '0.4.0', prs: [221] },
{ version: '0.1.0', prs: [63, 127] },
],
Expand Down Expand Up @@ -26233,7 +26239,11 @@ export const ATTRIBUTE_METADATA: Record<AttributeName, AttributeMetadata> = {
visibility: 'public',
example:
'[{"type": "function", "name": "get_current_weather", "description": "Get the current weather in a given location", "parameters": {"type": "object", "properties": {"location": {"type": "string", "description": "The city and state, e.g. San Francisco, CA"}, "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}}, "required": ["location", "unit"]}}]',
changelog: [{ version: '0.4.0', prs: [221] }],
aliases: ['gen_ai.request.available_tools'],
changelog: [
{ version: 'next', description: 'Added gen_ai.request.available_tools as an alias' },
{ version: '0.4.0', prs: [221] },
],
},
'gen_ai.tool.description': {
brief: 'The description of the tool being used.',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@
},
"is_in_otel": false,
"example": "[{\"name\": \"get_weather\", \"description\": \"Get the weather for a given location\"}, {\"name\": \"get_news\", \"description\": \"Get the news for a given topic\"}]",
"alias": [],
"alias": ["gen_ai.tool.definitions"],
"deprecation": {
"_status": "normalize",
"replacement": "gen_ai.tool.definitions"
},
"visibility": "public",
"changelog": [
{
"version": "next",
"description": "Added gen_ai.tool.definitions as an alias"
},
{
"version": "0.4.0",
"prs": [221]
Expand Down
5 changes: 5 additions & 0 deletions model/attributes/gen_ai/gen_ai__tool__definitions.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@
},
"is_in_otel": true,
"example": "[{\"type\": \"function\", \"name\": \"get_current_weather\", \"description\": \"Get the current weather in a given location\", \"parameters\": {\"type\": \"object\", \"properties\": {\"location\": {\"type\": \"string\", \"description\": \"The city and state, e.g. San Francisco, CA\"}, \"unit\": {\"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"]}}, \"required\": [\"location\", \"unit\"]}}]",
"alias": ["gen_ai.request.available_tools"],
"visibility": "public",
"changelog": [
{
Comment thread
sentry[bot] marked this conversation as resolved.
Comment on lines 7 to +13

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 logic in deriveAttributeKeyChains filters out deprecated aliases, creating an asymmetric chain expansion despite symmetric alias definitions in the JSON, causing inconsistent attribute chains.
Severity: MEDIUM

Suggested Fix

The logic in deriveAttributeKeyChains should be adjusted to handle symmetric aliases involving deprecated attributes correctly. The filtering that removes deprecated aliases from a stable attribute's alias expansion should be re-evaluated to ensure that chain membership remains consistent across all members of an alias group, regardless of their deprecation status.

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/gen_ai/gen_ai__tool__definitions.json#L7-L13

Potential issue: The introduction of a symmetric alias between the stable attribute
`gen_ai.tool.definitions` and the deprecated attribute `gen_ai.request.available_tools`
creates an inconsistency in how attribute chains are generated. The
`deriveAttributeKeyChains` function filters out deprecated aliases when expanding the
chain for a stable attribute. As a result, the chain for `gen_ai.tool.definitions` will
not include `gen_ai.request.available_tools`. Conversely,
`gen_ai.request.available_tools`, being a rewriting deprecation, will join the chain of
its replacement, `gen_ai.tool.definitions`. This asymmetry means the two attributes will
not agree on their chain membership, which is expected to cause the test 'agrees on
chain membership between every pair of chained attributes' to fail.

"version": "next",
"description": "Added gen_ai.request.available_tools as an alias"
},
{
"version": "0.4.0",
"prs": [221]
Expand Down
11 changes: 11 additions & 0 deletions python/src/sentry_conventions/attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4791,6 +4791,7 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta):
Apply Scrubbing: manual
Defined in OTEL: No
Visibility: public
Aliases: gen_ai.tool.definitions
DEPRECATED: Use gen_ai.tool.definitions instead
Example: "[{\"name\": \"get_weather\", \"description\": \"Get the weather for a given location\"}, {\"name\": \"get_news\", \"description\": \"Get the news for a given topic\"}]"
"""
Expand Down Expand Up @@ -5175,6 +5176,7 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta):
Apply Scrubbing: manual
Defined in OTEL: Yes
Visibility: public
Aliases: gen_ai.request.available_tools
Example: "[{\"type\": \"function\", \"name\": \"get_current_weather\", \"description\": \"Get the current weather in a given location\", \"parameters\": {\"type\": \"object\", \"properties\": {\"location\": {\"type\": \"string\", \"description\": \"The city and state, e.g. San Francisco, CA\"}, \"unit\": {\"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"]}}, \"required\": [\"location\", \"unit\"]}}]"
"""

Expand Down Expand Up @@ -17309,7 +17311,11 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta):
deprecation=DeprecationInfo(
replacement="gen_ai.tool.definitions", status=DeprecationStatus.NORMALIZE
),
aliases=["gen_ai.tool.definitions"],
changelog=[
ChangelogEntry(
version="next", description="Added gen_ai.tool.definitions as an alias"
),
ChangelogEntry(version="0.4.0", prs=[221]),
ChangelogEntry(version="0.1.0", prs=[63, 127]),
],
Expand Down Expand Up @@ -17850,7 +17856,12 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta):
is_in_otel=True,
visibility=Visibility.PUBLIC,
example='[{"type": "function", "name": "get_current_weather", "description": "Get the current weather in a given location", "parameters": {"type": "object", "properties": {"location": {"type": "string", "description": "The city and state, e.g. San Francisco, CA"}, "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}}, "required": ["location", "unit"]}}]',
aliases=["gen_ai.request.available_tools"],
changelog=[
ChangelogEntry(
version="next",
description="Added gen_ai.request.available_tools as an alias",
),
ChangelogEntry(version="0.4.0", prs=[221]),
],
),
Expand Down
Loading