Raw source data: Formats, associations, and minimum requirements

Updated at:

Trace source data: OpenTelemetry Trace type

Spans in the same call chain use the same traceId, each span uses a different spanId, and parent-child calls are associated by using parentSpanId. To display Q&A, report recognizable GenAI operations and valid messages. To calculate latency and usage, report time and usage separately.

Common fields

Field

Logical type/Unit

Requirement

Meaning and purpose

traceId

string

Required

The current trace identifier, which is used as the whole-trace result's trace_id/trajectory_id

spanId

string

Required

The call identifier within the trace, used to locate source records

parentSpanId

string

Provided when a parent call exists

The parent span ID. It provides call chain evidence but is not directly equivalent to agent delegation.

attributes

object

Required for GenAI spans

Attributes such as the operation type, messages, model, tools, and usage

startTime

int64, Unix ns

Strongly recommended

The start of the source execution. If it is missing, the actual time and ordering are affected.

endTime

int64, Unix ns

Provided upon completion

The end of the source execution, which is not earlier than the start. It cannot be replaced by the collection time.

spanName

string

Recommended

The operation name, used for display and lookup

resources

object

Recommended

Resource attributes, such as service.name, service.version

serviceName

string

Optional

The service name. Compare it with resources["service.name"].

statusCode

Source status code

Optional

The status of the current span, which follows the collection format. It does not indicate the business success of a session.

statusMessage

string

Optional

The status description, used for error diagnosis

A minimal complete text example can be a single LLM span:

{
  "traceId": "4bf92f3577b34da6a3ce929d0e0e4736",
  "spanId": "00f067aa0ba902b7",
  "parentSpanId": "",
  "spanName": "chat example-chat-model",
  "startTime": "1767225600000000000",
  "endTime": "1767225601000000000",
  "resources": {"service.name": "order-service"},
  "attributes": {
    "gen_ai.operation.name": "chat",
    "gen_ai.conversation.id": "session-demo-001",
    "gen_ai.request.model": "example-chat-model",
    "gen_ai.response.model": "example-chat-model",
    "gen_ai.input.messages": [
      {"role": "user", "parts": [{"type": "text", "content": "Hello"}]}
    ],
    "gen_ai.output.messages": [
      {"role": "assistant", "parts": [{"type": "text", "content": "Hello!"}]}
    ],
    "gen_ai.response.finish_reasons": ["stop"],
    "gen_ai.usage.input_tokens": 10,
    "gen_ai.usage.output_tokens": 12
  }
}

The attributes/resources are expanded here for readability. In actual trace writes, attributes is JSON text, in which complex attributes such as gen_ai.input.messages, gen_ai.output.messages, and the finish array must each be stored as a JSON string value. Do not serialize only the outermost attributes once. For a direct reference, see Sample data and usage code.

Generate the attributes field from the expanded trace object on this page:

import json

def attribute_text(value):
    return value if isinstance(value, str) else json.dumps(value, ensure_ascii=False, separators=(",", ":"))

def encode_trace_attributes(expanded_attributes):
    values = {key: attribute_text(value) for key, value in expanded_attributes.items()
              if value is not None}
    return json.dumps(values, ensure_ascii=False)

LLM spans alone can express model interactions. However, if the agent identity is missing, the name and version of the business agent cannot be restored. Report the corresponding information.

Operation types

attributes["gen_ai.operation.name"] value

Semantic category

Facts provided

chat, generate_content, text_completion

LLM

Model input, output, model identity, and usage

invoke_agent

AGENT

The agent identity and the input and output of an agent execution

invoke_workflow

WORKFLOW

The overall workflow input and output, used for top-level summary selection

enter

ENTRY ingestion extension

The interaction entry and the input and output of the turn

execute_tool

TOOL

The actual execution, arguments, and result of the corresponding tool call

Use gen_ai.operation.name first to classify operations. Historical sources that lack this field are compatible with gen_ai.span.kind, such as LLM/AGENT/TOOL/ENTRY/STEP/CHAIN. It is different from the kind of a native span. Do not specify conflicting categories, and do not guess the operation based only on spanName.

AGENT/WORKFLOW/ENTRY can provide top-level input and output. If they have recognizable messages, they can also represent an execution. Avoid duplication if child calls already represent the same messages. Spans that contain only metadata such as names and versions do not generate message steps out of nothing. To display the specific execution process of models and tools, you still need to report the corresponding records.

Business and model attributes

The following fields are all located in the attributes of a trace. In logs, the corresponding fields are at the top level, and the session association rules are described in the next section.

Field

Logical type

Role from source to result

gen_ai.conversation.id, gen_ai.session.id, session.id

string

Trace session candidates are resolved in this order. The same session should remain stable and avoid conflicts.

gen_ai.turn.id

string

The application turn identifier. The top-level trace result does not directly output turn_id. Do not assume that turn mapping is automatically performed.

gen_ai.agent.id

string

The business agent identifier

gen_ai.agent.name, gen_ai.agent.version

string

The agent name and version. Do not use the probe version instead.

gen_ai.agent.description

string

The description of the agent's responsibilities, used as a source attribute

gen_ai.provider.name

string

The model service provider

gen_ai.request.model, gen_ai.response.model

string

The request and response models. Result statistics use the response model first and fall back to the request model if it is missing.

gen_ai.response.id

string

The model response ID, which assists tracing. It does not replace the trace and span identifiers.

gen_ai.request.max_tokens

integer

The generation limit of the request, not the actual consumption

gen_ai.request.temperature

number

The sampling parameter of the request, not a runtime result metric

gen_ai.input.messages

Message array

The ordered messages actually received by the current call, including visible history

gen_ai.output.messages

Message array

The output of this call. Retain the actual candidates and do not arbitrarily select one of multiple conflicting results.

gen_ai.system_instructions

array

Instruction messages or content fragments

gen_ai.tool.definitions

Array of objects

The tool definitions available to the model. Compatible with gen_ai.request.tools

gen_ai.response.finish_reasons

String array

The reasons why the model ended or handed off. A single model stop does not mean that the entire trace has permanently ended.

Tool execution attributes

Field

Logical type

Association rule

gen_ai.tool.call.id

string

Consistent with the tool call ID in the model message

gen_ai.tool.name

string

The tool name

gen_ai.tool.call.arguments

JSON value

The actual execution arguments

gen_ai.tool.call.result

JSON value

The content returned by the tool

gen_ai.skill.id, gen_ai.skill.name, gen_ai.skill.version

string

Explicitly identified skill metadata. Do not automatically identify a skill based on the tool name.

Tool intent comes from model messages, execution information comes from tool records, and tool results are associated by call ID. HTTP requests or network spans of model APIs are not automatically counted as business tool calls. To establish sub-agent delegation, explicit tool/action and sub-agent execution evidence is also required.

Log source data: OpenTelemetry Log eBPF and OpenTelemetry Log AI Gateway types

Common fields

Field

Logical type/Unit

Requirement

Meaning

event.name

string

Required

One of the four standard event types in the following table

event.id

string

Required

The event identity. Redeliveries of the same event keep the same ID, and different events must not share an ID.

time_unix_nano

int64, Unix ns

Required and positive

The time when the source event occurred

gen_ai.session.id

string

Required and non-empty

The business session. Use the actual business session identifier instead of a uniform placeholder value.

gen_ai.turn.id

string

Required and non-empty

A user turn. Multiple model calls share the ID of the turn.

gen_ai.step.id

string

Required for model request/response pairing

The request and response of the same model call use the same value. We recommend that you create a new ID for each call.

gen_ai.event.sequence

integer

Recommended

Source order evidence. Do not infer delegation relationships based on it.

gen_ai.agent.id, gen_ai.agent.name, gen_ai.agent.version

string

Recommended

Business agent metadata

status_code, error.type

string

Optional/Recommended upon failure

Status and error information, which does not replace messages or pairing identities

Four event types

event.name value

Main content

How to pair

gen_ai.model.request

gen_ai.input.messages or gen_ai.input.messages_delta, the request model, and tool definitions

The response that has the same session, turn, and step

gen_ai.model.response

gen_ai.output.messages, finish, the response model, and usage

The request that has the same session, turn, and step, with a different event ID

gen_ai.tool.call

The call ID, an optional exec ID, the tool name, and arguments

The corresponding tool result

gen_ai.tool.result

The same call ID, the corresponding exec ID, and the result and errors

The corresponding tool call and the call ID in the messages

The compatible names llm.request/llm.response/tool.call/tool.result are mapped to the preceding four types respectively. For new ingestion, use the standard names in the table. If the input delta field has a value, the delta is used first. If you are not sure how to generate the delta, report only the complete gen_ai.input.messages. Do not write the complete history into the delta field.

The following two events constitute one model call:

[
  {
    "event.name": "gen_ai.model.request",
    "event.id": "request-demo-001",
    "time_unix_nano": "1767225600000000000",
    "gen_ai.session.id": "session-demo-001",
    "gen_ai.turn.id": "turn-001",
    "gen_ai.step.id": "model-call-001",
    "gen_ai.input.messages": [
      {"role": "user", "parts": [{"type": "text", "content": "Hello"}]}
    ],
    "gen_ai.request.model": "example-chat-model"
  },
  {
    "event.name": "gen_ai.model.response",
    "event.id": "response-demo-001",
    "time_unix_nano": "1767225601000000000",
    "gen_ai.session.id": "session-demo-001",
    "gen_ai.turn.id": "turn-001",
    "gen_ai.step.id": "model-call-001",
    "gen_ai.output.messages": [
      {"role": "assistant", "parts": [{"type": "text", "content": "Hello!"}]}
    ],
    "gen_ai.response.finish_reasons": ["stop"],
    "gen_ai.usage.input_tokens": 10,
    "gen_ai.usage.output_tokens": 12
  }
]

Tool events can provide gen_ai.tool.call.exec.id to distinguish multiple actual executions of a single call. If both call and result provide it, the values must be consistent. Tools with the same name, similar times, or a shared turn alone cannot eliminate association ambiguity.

A turn can contain multiple model stops, tool handoffs, or context changes. They do not split the stable logical trajectory ID. A valid model stop/end_turn can form a whole-turn snapshot in advance. length/max_tokens/max_output_tokens indicates that the output is restricted. gen_ai.turn.end=true indicates that the source explicitly declares the end of the turn. It cannot be automatically inferred from HTTP 200, EOF, or a model stop.

Message structure: Input differs from ATIF

Input messages of traces and logs use role and ordered parts. The dots in attribute keys are part of the key names, for example, attributes["gen_ai.input.messages"].

Location

Field

Semantics

Message

role

system/developer/user/assistant/tool and other source roles

Message

parts

Stores text, tools, or other content in order

Message

name, finish_reason

The optional name and the source finish reason

text Part

type="text", content

User-visible text

reasoning Part

type="reasoning", content

Reported reasoning content. It is not equivalent to the final answer.

tool call Part

type="tool_call", id, name, arguments

A tool call issued by the assistant

tool result Part

type="tool_call_response", id, response

The corresponding tool result. result is a compatibility field.

[
  {"role":"user","parts":[{"type":"text","content":"Query order 10001"}]},
  {"role":"assistant","parts":[{"type":"tool_call","id":"call-order-001","name":"get_order","arguments":{"order_id":"10001"}}]},
  {"role":"tool","parts":[{"type":"tool_call_response","id":"call-order-001","response":"Order 10001 has been shipped."}]}
]

Tool results are converted to observation.results in ATIF, and assistant is converted to source="agent". Each item in the input array is not guaranteed to become an independent ATIF step. For content such as images and audio, retain the content type and references provided by the source. OCR is not automatically performed, and arbitrary objects are not treated as text summaries.

Information required for tokens and costs

Traces place usage in the attributes of the actual LLM span, and logs place usage at the top level of the model response. Statistics that are repeatedly reported on a parent agent must not be added to those of the LLM.

Field

Logical type

Meaning

gen_ai.usage.input_tokens

integer

The input tokens of this model call

gen_ai.usage.output_tokens

integer

The output tokens of this model call

gen_ai.usage.cache_read.input_tokens

integer

The cache hit portion of the input

gen_ai.usage.cache_creation.input_tokens

integer

The cache creation portion of the input

gen_ai.usage.reasoning.output_tokens

integer

The reasoning portion of the output

gen_ai.request.cache_mode

string

Optional. implicit/explicit. Used to distinguish cache pricing when trusted evidence is available.

gen_ai.request.enable_thinking

boolean

Optional. The thinking mode of the actual request, used for pricing of applicable models.

All usage values are non-negative integers, and a missing value is not equal to zero. Cache is a subset of the input, and reasoning is a subset of the output. They are not additionally added to the total tokens. Costs also depend on model identification and the applicable static prices. A trajectory can still be generated for an unknown model, but its cost may not be calculable.

Collection, export, and quality

SLS fields are strings. Decoded objects, arrays, and numbers are logical types. You can first read log fields by using a JSON parser, and then decode message fields based on their explicit structures. For CSV exports, use a CSV parser to handle quotation marks and line breaks first. Do not split directly by commas.

Keep nanosecond time as strings or exact integers. Record missing fields, corrupted JSON, sampling gaps, and truncated results separately. Do not silently fill in empty messages or zero usage. Explicitly reported empty user text is also source evidence and must not be treated as a missing message. The current trace input selection retains such empty values and the original whitespace. The existence of a raw span does not guarantee that all content enters ATIF. Use Raw to look up the original evidence.

Other top-level fields in trace exports

Field

Logical type/Unit

Purpose

kind

Source enumeration

The native span category. It is not equal to the ATIF message role.

traceState

string

The trace propagation state

duration

int64, source time unit

The common collection format is ns. The actual source convention prevails. Do not add up the durations of all nested spans.

ip, hostname

string

Source environment diagnostics. Not used as the session primary key.

pid

string

A source-specific identifier. Do not assume that it is a numeric process ID based only on its name.

__time__

Unix seconds/Formatted export time

The log query window. It does not replace the span start time.

__time_ns_part__

integer

The nanosecond part of the log time. It does not replace startTime

__tag__:__receive_time__

Unix seconds

The receive time tag. It does not replace the business end time.

__topic__

string

The log topic

Source extensions such as multi_agent.agent.name, multi_agent.role, multi_agent.agent_count, gen_ai.workflow.name describe how the application organizes execution. They can assist diagnosis, but multi_agent.agent_count cannot replace the delegation group count of the result, and agent parent-child relationships cannot be established based only on these tags.

Common resource and diagnostic attributes

Resource and network attributes help locate the source of calls but do not determine user turns or agent delegation. Common attributes of resources are as follows:

Field

Type

Purpose

service.name, service.version

string

The service name and version. The name can be used for service-dimension retrieval of results.

host.name

string

The source host name

gen_ai.instrumentation.sdk.name

string

The name of the GenAI instrumentation SDK

The attributes of a trace can also contain the following diagnostic attributes:

Field

Type

Purpose

http.request.method

string

The HTTP request method

http.response.status_code

integer

The HTTP response status code. It is not directly used as the business status of the entire session.

http.route, url.path, url.full

string

The request route, path, and URL

server.address, server.port

string/integer

The destination address and port

network.peer.address, network.peer.port

string/integer

The network peer address and port

otel.scope.name, otel.scope.version

string

The name and version of the instrumentation library. They are not equal to the business agent version.

code.function, code.namespace

string

The called function and namespace

thread.id, thread.name

string

The execution thread identifier and name

The meanings of other extended attributes are defined by the collection SDK or the business application. When you use these attributes for troubleshooting, interpret them based on the source documentation. Not all of them are converted to outer trajectory fields with the same names. A network span is not counted as a business tool call just because HTTP attributes exist.