pub fn encode( service_name: &str, trace_type: &str, resource: &str, error_code: i32, trace_id: u64, root_parent_span_id: u64, span_id_prefix: u32, spans: &[SpanRecord]) -> Result<Vec<u8>, Box<dyn Error + Send + Sync + 'static>>