/*
* server
*
* ## Real-time data The only real-time path to get tracing data is to ingest via OpenTelemetry (`POST /api/public/otel/v1/traces`) and retrieve via Observations API v2 (`GET /api/public/v2/observations`) and Metrics API v2 (`GET /api/public/v2/metrics`). Other public API write and read endpoints can delay data by about 10 minutes. Direct OpenTelemetry exporters must send the `x-langfuse-ingestion-version: 4` header; current Python and JS SDKs already do. See the [Public API docs](https://langfuse.com/docs/api-and-data-platform/features/public-api) and [real-time ingestion](https://langfuse.com/integrations/native/opentelemetry.md#real-time-ingestion). ## 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 - Self-hosted deployments: interactive API reference at `/api/docs` and OpenAPI spec at `/api/openapi.yaml`
*
* 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<std::collections::HashMap<String, 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,
}
}
}