Span object

AttributeDescriptionTypeLaminar representation (if different)Example
trace_idUnique identifier for the trace16-bytesUUID [1]01234567-89ab-4def-0123-456789abcdef
span_idUnique identifier for the span8-bytesUUID [1]00000000-0000-0000-0123-456789abcdef
parent_span_idUnique identifier for the parent span8-bytesUUID [1]00000000-0000-0000-0123-456789abcdef
nameName of the spanstringmy_function
events [2]Events associated with the spanArray<Event>
attributesAttributes associated with the span. Fully compatible with the gen_ai semantic conventionsKey-value pair. Key must comply to semantic conventions, value must be of AttributeType [3]{"gen_ai.usage.output_tokens": 369}
start_time_unix_nanoStart time of the span in nanoseconds [4]numbertimestamp with UTC timezone1630000000000000000
end_time_unix_nanoEnd time of the span in nanoseconds [4]numbertimestamp with UTC timezone1630000000000000000

[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] Learn more about event attributes in the Events Otel page

[3] AttributeType is a union of string, number, boolean, Array<string>, Array<number>, Array<boolean>

[4] 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:

AttributeDescriptionTypeExample
gen_ai.systemModel providerstringopenai
gen_ai.usage.output_tokensNumber of tokens the LLM producednumber369
gen_ai.usage.input_tokensNumber of tokens in the LLM inputnumber42
gen_ai.usage.total_tokensTotal number of tokens in the LLM input and output. If not specified, sum of input_tokens and output_tokensnumber411
gen_ai.usage.costCost of the LLM call. If not specified, system, input_tokens, and output_tokens are used to estimate the cost Laminar-side in the backgroundnumber0.012
gen_ai.usage.request_modelModel name specified in the requeststringgpt-4o
gen_ai.usage.response_modelModel name returned in the responsestringgpt-4o-2024-08-06
gen_ai.prompt.{i}.contentContent of the input message number i (starting from 0)stringwrite a poem about laminar flow
gen_ai.prompt.{i}.roleRole of the input message number i (starting from 0)stringuser

These and all other attributes are stored as key-value pairs in the attributes field of the span.