Skip to main content

serialize_otlp_json

Function serialize_otlp_json 

Source
pub fn serialize_otlp_json<S: BuildHasher>(
    spans: &[SpanData],
    service_name: &str,
    trace_metadata: &HashMap<String, String, S>,
) -> String
Expand description

Serialize spans to OTLP JSON Protobuf encoding.

trace_metadata entries are appended as additional resource attributes after service.name. The reserved key service.name in trace_metadata is skipped to avoid duplication.

Format: https://opentelemetry.io/docs/specs/otlp/#json-protobuf-encoding