feat(event-normalization): Update is_ai_span and infer_ai_operation_type to use gen_ai.operation.name#5433
Conversation
…_name` in favor of unit tests for `is_ai_span`
…op` in `infer_ai_operation_type`
|
This should be merged and deployed after getsentry/sentry#104242 is deployed, otherwise we would get wrong |
is_ai_span and infer_ai_operation_type to use gen_ai.operation.name
…ai_span-use-gen_ai.operation.name
|
Okay, the dependent commit in Sentry seems deployed now, this is good to go. |
| @@ -258,15 +263,24 @@ fn infer_ai_operation_type(span: &mut Span, operation_type_map: &AiOperationType | |||
There was a problem hiding this comment.
Can be simplified to:
let op_type = data
.gen_ai_operation_name
.value()
.or(span.op.value())
.and_then(|op| operation_type_map.get_operation_type(op));
if let Some(operation_type) = op_type {
data.gen_ai_operation_type
.set_value(Some(operation_type.to_owned()));
}Also this is potentially a bug, it overwrites an existing type. If any SDK were to set this, it will be deleted. Generally we take the approach in Relay not to mess with existing data and only add data.
There was a problem hiding this comment.
The potential bug is unrelated, but as far as I know this was intentional. I'll discuss with @vgrozdanic.
There was a problem hiding this comment.
This was made by design, because this is not intended to be set by SDK.
We want to control this mapping, and not commit to doing this in SDKs because this is partially based on OTEL spec which is still in development phase and not yet stable
Co-authored-by: David Herberth <david.herberth@sentry.io>
…ai_span-use-gen_ai.operation.name
The
gen_ai.operation.nameshould be used in preference overspan.opin order to determine whether a span is an AI span.Closes https://linear.app/getsentry/issue/TET-1525/update-relay-logic-to-use-gen-aioperationname