Raw source data: Formats, associations, and minimum requirements
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 |
|
|
string |
Required |
The current trace identifier, which is used as the whole-trace result's |
|
|
string |
Required |
The call identifier within the trace, used to locate source records |
|
|
string |
Provided when a parent call exists |
The parent span ID. It provides call chain evidence but is not directly equivalent to agent delegation. |
|
|
object |
Required for GenAI spans |
Attributes such as the operation type, messages, model, tools, and usage |
|
|
int64, Unix ns |
Strongly recommended |
The start of the source execution. If it is missing, the actual time and ordering are affected. |
|
|
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. |
|
|
string |
Recommended |
The operation name, used for display and lookup |
|
|
object |
Recommended |
Resource attributes, such as |
|
|
string |
Optional |
The service name. Compare it with |
|
|
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. |
|
|
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
|
|
Semantic category |
Facts provided |
|
|
LLM |
Model input, output, model identity, and usage |
|
|
AGENT |
The agent identity and the input and output of an agent execution |
|
|
WORKFLOW |
The overall workflow input and output, used for top-level summary selection |
|
|
ENTRY ingestion extension |
The interaction entry and the input and output of the turn |
|
|
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 |
|
|
string |
Trace session candidates are resolved in this order. The same session should remain stable and avoid conflicts. |
|
|
string |
The application turn identifier. The top-level trace result does not directly output |
|
|
string |
The business agent identifier |
|
|
string |
The agent name and version. Do not use the probe version instead. |
|
|
string |
The description of the agent's responsibilities, used as a source attribute |
|
|
string |
The model service provider |
|
|
string |
The request and response models. Result statistics use the response model first and fall back to the request model if it is missing. |
|
|
string |
The model response ID, which assists tracing. It does not replace the trace and span identifiers. |
|
|
integer |
The generation limit of the request, not the actual consumption |
|
|
number |
The sampling parameter of the request, not a runtime result metric |
|
|
Message array |
The ordered messages actually received by the current call, including visible history |
|
|
Message array |
The output of this call. Retain the actual candidates and do not arbitrarily select one of multiple conflicting results. |
|
|
array |
Instruction messages or content fragments |
|
|
Array of objects |
The tool definitions available to the model. Compatible with |
|
|
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 |
|
|
string |
Consistent with the tool call ID in the model message |
|
|
string |
The tool name |
|
|
JSON value |
The actual execution arguments |
|
|
JSON value |
The content returned by the tool |
|
|
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 |
|
|
string |
Required |
One of the four standard event types in the following table |
|
|
string |
Required |
The event identity. Redeliveries of the same event keep the same ID, and different events must not share an ID. |
|
|
int64, Unix ns |
Required and positive |
The time when the source event occurred |
|
|
string |
Required and non-empty |
The business session. Use the actual business session identifier instead of a uniform placeholder value. |
|
|
string |
Required and non-empty |
A user turn. Multiple model calls share the ID of the turn. |
|
|
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. |
|
|
integer |
Recommended |
Source order evidence. Do not infer delegation relationships based on it. |
|
|
string |
Recommended |
Business agent metadata |
|
|
string |
Optional/Recommended upon failure |
Status and error information, which does not replace messages or pairing identities |
Four event types
|
|
Main content |
How to pair |
|
|
|
The response that has the same session, turn, and step |
|
|
|
The request that has the same session, turn, and step, with a different event ID |
|
|
The call ID, an optional exec ID, the tool name, and arguments |
The corresponding 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 |
|
|
|
Message |
|
Stores text, tools, or other content in order |
|
Message |
|
The optional name and the source finish reason |
|
text Part |
|
User-visible text |
|
reasoning Part |
|
Reported reasoning content. It is not equivalent to the final answer. |
|
tool call Part |
|
A tool call issued by the assistant |
|
tool result Part |
|
The corresponding tool result. |
[
{"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 |
|
|
integer |
The input tokens of this model call |
|
|
integer |
The output tokens of this model call |
|
|
integer |
The cache hit portion of the input |
|
|
integer |
The cache creation portion of the input |
|
|
integer |
The reasoning portion of the output |
|
|
string |
Optional. |
|
|
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 |
|
|
Source enumeration |
The native span category. It is not equal to the ATIF message role. |
|
|
string |
The trace propagation state |
|
|
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. |
|
|
string |
Source environment diagnostics. Not used as the session primary key. |
|
|
string |
A source-specific identifier. Do not assume that it is a numeric process ID based only on its name. |
|
|
Unix seconds/Formatted export time |
The log query window. It does not replace the span start time. |
|
|
integer |
The nanosecond part of the log time. It does not replace |
|
|
Unix seconds |
The receive time tag. It does not replace the business end time. |
|
|
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 |
|
|
string |
The service name and version. The name can be used for service-dimension retrieval of results. |
|
|
string |
The source host name |
|
|
string |
The name of the GenAI instrumentation SDK |
The attributes of a trace can also contain the following diagnostic attributes:
|
Field |
Type |
Purpose |
|
|
string |
The HTTP request method |
|
|
integer |
The HTTP response status code. It is not directly used as the business status of the entire session. |
|
|
string |
The request route, path, and URL |
|
|
string/integer |
The destination address and port |
|
|
string/integer |
The network peer address and port |
|
|
string |
The name and version of the instrumentation library. They are not equal to the business agent version. |
|
|
string |
The called function and namespace |
|
|
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.