normalize_ai

Function normalize_ai 

Source
pub fn normalize_ai(
    attributes: &mut Annotated<Attributes>,
    duration: Option<Duration>,
    costs: Option<&ModelCosts>,
)
Expand description

Normalizes AI attributes.

This aggressively overwrites existing AI attributes, in order to guarantee a consistent data set for the AI product module.

As an example, an OTeL user may be manually instrumenting AI request costs on spans but in a local currency. Sentry’s AI model requires a consistent cost value, independent of local currencies.

Callers may choose to only run this normalization in processing mode to not have the normalization run multiple times.