File tree Expand file tree Collapse file tree 3 files changed +14
-3
lines changed
opentelemetry-datadog/src/exporter Expand file tree Collapse file tree 3 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,10 @@ const DEFAULT_AGENT_ENDPOINT: &str = "http://127.0.0.1:8126";
3434/// Header name used to inform the Datadog agent of the number of traces in the payload
3535const DATADOG_TRACE_COUNT_HEADER : & str = "X-Datadog-Trace-Count" ;
3636
37+ /// Header name use to inform datadog as to what version
38+ const DATADOG_META_LANG_HEADER : & str = "Datadog-Meta-Lang" ;
39+ const DATADOG_META_TRACER_VERSION_HEADER : & str = "Datadog-Meta-Tracer-Version" ;
40+
3741// Struct to hold the mapping between Opentelemetry spans and datadog spans.
3842pub struct Mapping {
3943 resource : Option < FieldMapping > ,
@@ -101,6 +105,11 @@ impl DatadogExporter {
101105 . uri ( self . request_url . clone ( ) )
102106 . header ( http:: header:: CONTENT_TYPE , self . api_version . content_type ( ) )
103107 . header ( DATADOG_TRACE_COUNT_HEADER , trace_count)
108+ . header ( DATADOG_META_LANG_HEADER , "rust" )
109+ . header (
110+ DATADOG_META_TRACER_VERSION_HEADER ,
111+ env ! ( "CARGO_PKG_VERSION" ) ,
112+ )
104113 . body ( data)
105114 . map_err :: < Error , _ > ( Into :: into) ?;
106115
Original file line number Diff line number Diff line change @@ -282,7 +282,7 @@ pub(crate) mod tests {
282282
283283 assert_eq ! ( encoded. as_str( ) , "kp6jd2VirHNlcnZpY2VfbmFtZaljb21wb25lbnSocmVzb3VyY2WpaG9zdC5uYW\
284284 1lpHRlc3Snc2VydmljZax0ZXN0LXNlcnZpY2WjZW52qHRlc3QtZW52p3ZlcnNpb26sdGVzdC12ZXJzaW9uqXNwYW4udH\
285- lwZbVfc2FtcGxpbmdfcHJpb3JpdHlfdjGRkZ3OAAAAAc4AAAACzgAAAAPPAAAAAAAAAAfPAAAAAAAAAGPPAAAAAAAAAA \
285+ lwZbVfc2FtcGxpbmdfcHJpb3JpdHlfdjGRkZzOAAAAAc4AAAACzgAAAAPPAAAAAAAAAAfPAAAAAAAAAGPPAAAAAAAAAA \
286286 HTAAAAAAAAAADTAAAAADuaygDSAAAAAIXOAAAABM4AAAAFzgAAAAbOAAAAB84AAAAIzgAAAAnOAAAACs4AAAALzgAAAA\
287287 zOAAAAAIHOAAAADcsAAAAAAAAAAM4AAAAA") ;
288288
Original file line number Diff line number Diff line change @@ -9,9 +9,11 @@ use std::time::SystemTime;
99
1010use super :: unified_tags:: { UnifiedTagField , UnifiedTags } ;
1111
12+ const SPAN_NUM_ELEMENTS : u32 = 12 ;
13+
1214// Protocol documentation sourced from https://github.com/DataDog/datadog-agent/blob/c076ea9a1ffbde4c76d35343dbc32aecbbf99cb9/pkg/trace/api/version.go
1315//
14- // The payload is an array containing exactly 2 elements:
16+ // The payload is an array containing exactly 12 elements:
1517//
1618// 1. An array of all unique strings present in the payload (a dictionary referred to by index).
1719// 2. An array of traces, where each trace is an array of spans. A span is encoded as an array having
@@ -154,7 +156,7 @@ where
154156 } ;
155157
156158 // Datadog span name is OpenTelemetry component name - see module docs for more information
157- rmp:: encode:: write_array_len ( & mut encoded, 13 ) ?;
159+ rmp:: encode:: write_array_len ( & mut encoded, SPAN_NUM_ELEMENTS ) ?;
158160 rmp:: encode:: write_u32 (
159161 & mut encoded,
160162 interner. intern ( get_service_name ( & span, model_config) ) ,
You can’t perform that action at this time.
0 commit comments