sentry-conventions

Gen_ai Attributes

Stable Attributes

gen_ai.prompt

The input messages sent to the model

Property Value
Type string
Has PII false
Exists in OpenTelemetry Yes
Example [{"role": "user", "message": "hello"}]

gen_ai.request.frequency_penalty

Used to reduce repetitiveness of generated tokens. The higher the value, the stronger a penalty is applied to previously present tokens, proportional to how many times they have already appeared in the prompt or prior generation.

Property Value
Type double
Has PII false
Exists in OpenTelemetry Yes
Example 0.5
Aliases ai.frequency_penalty

gen_ai.request.presence_penalty

Used to reduce repetitiveness of generated tokens. Similar to frequency_penalty, except that this penalty is applied equally to all tokens that have already appeared, regardless of their exact frequencies.

Property Value
Type double
Has PII false
Exists in OpenTelemetry Yes
Example 0.5
Aliases ai.presence_penalty

gen_ai.request.seed

The seed, ideally models given the same seed and same other parameters will produce the exact same output.

Property Value
Type string
Has PII false
Exists in OpenTelemetry Yes
Example 1234567890
Aliases ai.seed

gen_ai.request.temperature

For an AI model call, the temperature parameter. Temperature essentially means how random the output will be.

Property Value
Type double
Has PII false
Exists in OpenTelemetry Yes
Example 0.1
Aliases ai.temperature

gen_ai.request.top_k

Limits the model to only consider the K most likely next tokens, where K is an integer (e.g., top_k=20 means only the 20 highest probability tokens are considered).

Property Value
Type integer
Has PII false
Exists in OpenTelemetry Yes
Example 35
Aliases ai.top_k

gen_ai.request.top_p

Limits the model to only consider tokens whose cumulative probability mass adds up to p, where p is a float between 0 and 1 (e.g., top_p=0.7 means only tokens that sum up to 70% of the probability mass are considered).

Property Value
Type double
Has PII false
Exists in OpenTelemetry Yes
Example 0.7
Aliases ai.top_p

gen_ai.response.finish_reasons

The reason why the model stopped generating.

Property Value
Type string
Has PII false
Exists in OpenTelemetry Yes
Example COMPLETE
Aliases ai.finish_reason

gen_ai.response.id

Unique identifier for the completion.

Property Value
Type string
Has PII false
Exists in OpenTelemetry Yes
Example gen_123abc
Aliases ai.generation_id

gen_ai.response.model

The vendor-specific ID of the model used.

Property Value
Type string
Has PII false
Exists in OpenTelemetry Yes
Example gpt-4
Aliases ai.model_id

gen_ai.system

The provider of the model.

Property Value
Type string
Has PII false
Exists in OpenTelemetry Yes
Example openai
Aliases ai.model.provider

gen_ai.tool.name

Name of the tool utilized by the agent.

Property Value
Type string
Has PII false
Exists in OpenTelemetry Yes
Example Flights
Aliases ai.function_call

gen_ai.usage.input_tokens

The number of tokens used in the GenAI input (prompt).

Property Value
Type integer
Has PII false
Exists in OpenTelemetry Yes
Example 10
Aliases ai.prompt_tokens.used, gen_ai.usage.prompt_tokens

gen_ai.usage.output_tokens

The number of tokens used in the GenAI response (completion).

Property Value
Type integer
Has PII false
Exists in OpenTelemetry Yes
Example 10
Aliases ai.completion_tokens.used, gen_ai.usage.completion_tokens

gen_ai.usage.total_cost

The total cost for the tokens used.

Property Value
Type double
Has PII false
Exists in OpenTelemetry No
Example 12.34

gen_ai.usage.total_tokens

The total number of tokens used to process the prompt. (input tokens plus output todkens)

Property Value
Type integer
Has PII false
Exists in OpenTelemetry No
Example 20
Aliases ai.total_tokens.used

Deprecated Attributes

These attributes are deprecated and will be removed in a future version. Please use the recommended replacements.

gen_ai.usage.completion_tokens

The number of tokens used in the GenAI response (completion).

Property Value
Type integer
Has PII false
Exists in OpenTelemetry Yes
Example 10
Deprecated Yes, use gen_ai.usage.output_tokens instead
Aliases ai.completion_tokens.used, gen_ai.usage.output_tokens

gen_ai.usage.prompt_tokens

The number of tokens used in the GenAI input (prompt).

Property Value
Type integer
Has PII false
Exists in OpenTelemetry Yes
Example 20
Deprecated Yes, use gen_ai.usage.input_tokens instead
Aliases ai.prompt_tokens.used, gen_ai.usage.input_tokens