langfuse-client-base 0.12.0

Auto-generated Langfuse API client from OpenAPI specification
Documentation
/*
 * langfuse
 *
 * ## Authentication  Authenticate with the API using [Basic Auth](https://en.wikipedia.org/wiki/Basic_access_authentication), get API keys in the project settings:  - username: Langfuse Public Key - password: Langfuse Secret Key  ## Exports  - OpenAPI spec: https://cloud.langfuse.com/generated/api/openapi.yml
 *
 * The version of the OpenAPI document:
 *
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// OtelSpan : Individual span representing a unit of work or operation
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct OtelSpan {
    /// Trace ID (16 bytes, hex-encoded string in JSON or Buffer in binary)
    #[serde(
        rename = "traceId",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub trace_id: Option<Option<serde_json::Value>>,
    /// Span ID (8 bytes, hex-encoded string in JSON or Buffer in binary)
    #[serde(
        rename = "spanId",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub span_id: Option<Option<serde_json::Value>>,
    /// Parent span ID if this is a child span
    #[serde(
        rename = "parentSpanId",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub parent_span_id: Option<Option<serde_json::Value>>,
    /// Span name describing the operation
    #[serde(
        rename = "name",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub name: Option<Option<String>>,
    /// Span kind (1=INTERNAL, 2=SERVER, 3=CLIENT, 4=PRODUCER, 5=CONSUMER)
    #[serde(
        rename = "kind",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub kind: Option<Option<i32>>,
    /// Start time in nanoseconds since Unix epoch
    #[serde(
        rename = "startTimeUnixNano",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub start_time_unix_nano: Option<Option<serde_json::Value>>,
    /// End time in nanoseconds since Unix epoch
    #[serde(
        rename = "endTimeUnixNano",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub end_time_unix_nano: Option<Option<serde_json::Value>>,
    /// Span attributes including Langfuse-specific attributes (langfuse.observation.*)
    #[serde(
        rename = "attributes",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub attributes: Option<Option<Vec<models::OtelAttribute>>>,
    /// Span status object
    #[serde(
        rename = "status",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub status: Option<Option<serde_json::Value>>,
}

impl OtelSpan {
    /// Individual span representing a unit of work or operation
    pub fn new() -> OtelSpan {
        OtelSpan {
            trace_id: None,
            span_id: None,
            parent_span_id: None,
            name: None,
            kind: None,
            start_time_unix_nano: None,
            end_time_unix_nano: None,
            attributes: None,
            status: None,
        }
    }
}