Otel objects
Details on Spans and attributes in OpenTelemetry-compatible tracing with Laminar
This page is solely for information purposes. As a user of Laminar, you don’t have to deal with the internals of OpenTelemetry.
Span object
Attribute | Description | Type | Laminar representation (if different) | Example |
---|---|---|---|---|
trace_id | Unique identifier for the trace | 16-bytes | UUID [1] | 01234567-89ab-4def-0123-456789abcdef |
span_id | Unique identifier for the span | 8-bytes | UUID [1] | 00000000-0000-0000-0123-456789abcdef |
parent_span_id | Unique identifier for the parent span | 8-bytes | UUID [1] | 00000000-0000-0000-0123-456789abcdef |
name | Name of the span | string | my_function | |
events | Events associated with the span | Array<Event> | ||
attributes | Attributes associated with the span. Fully compatible with the gen_ai semantic conventions | Key-value pair. Key must comply to semantic conventions, value must be of AttributeType [2] | {"gen_ai.usage.output_tokens": 369} | |
start_time_unix_nano | Start time of the span in nanoseconds [3] | number | timestamp with UTC timezone | 1630000000000000000 |
end_time_unix_nano | End time of the span in nanoseconds [3] | number | timestamp with UTC timezone | 1630000000000000000 |
[1] 13th digit in hex UUID depends on UUID version, so technically converting OTel/WC3’s 16-byte and, especially, 8-byte IDs to UUIDs is not exactly UUID.
[2] AttributeType
is a union of string
, number
, boolean
, Array<string>
, Array<number>
, Array<boolean>
[3] In most OpenTelemetry client implementations, you don’t have to convert the timestamp to nanoseconds manually,
you can simply pass the Date
/ datetime
object and the client will convert it to nanoseconds.
Span attributes
Span attribute values that Laminar bases some of its functionality on:
Attribute | Description | Type | Example |
---|---|---|---|
lmnr.span.type | Type of the span | string (LLM or DEFAULT ) | LLM |
lmnr.span.path | Path of the span | string | agent.generate.openai.chat |
gen_ai.system | Model provider | string | openai |
gen_ai.usage.output_tokens | Number of tokens the LLM produced | number | 369 |
gen_ai.usage.input_tokens | Number of tokens in the LLM input | number | 42 |
llm.usage.total_tokens | Total number of tokens in the LLM input and output. If not specified, sum of input_tokens and output_tokens | number | 411 |
gen_ai.usage.cost | Cost of the LLM call. If not specified, system , input_tokens , and output_tokens are used to estimate the cost Laminar-side in the background | number | 0.012 |
gen_ai.usage.input_cost | Cost of the inputs to the LLM call. If not specified, system and input_tokens are used to estimate the cost Laminar-side in the background | number | 0.003 |
gen_ai.usage.output_cost | Cost of the outputs of the LLM call. If not specified, system , and output_tokens are used to estimate the cost Laminar-side in the background | number | 0.009 |
gen_ai.usage.request_model | Model name specified in the request | string | gpt-4o |
gen_ai.usage.response_model | Model name returned in the response | string | gpt-4o-2024-08-06 |
gen_ai.prompt.{i}.content | Content of the input message number i (starting from 0) | string | write a poem about laminar flow |
gen_ai.prompt.{i}.role | Role of the input message number i (starting from 0) | string | user |
These and all other attributes are stored as key-value pairs in the attributes
field of the span.