@@ -10,6 +10,7 @@ use prost::Message;
10
10
use snafu:: Snafu ;
11
11
use vector_common:: request_metadata:: RequestMetadata ;
12
12
use vector_core:: event:: { EventFinalizers , Finalizable } ;
13
+ use vrl:: event_path;
13
14
14
15
use super :: {
15
16
apm_stats:: { compute_apm_stats, Aggregator } ,
@@ -283,7 +284,7 @@ impl DatadogTracesEncoder {
283
284
284
285
fn vector_trace_into_dd_tracer_payload ( trace : & TraceEvent ) -> dd_proto:: TracerPayload {
285
286
let tags = trace
286
- . get ( "tags" )
287
+ . get ( event_path ! ( "tags" ) )
287
288
. and_then ( |m| m. as_object ( ) )
288
289
. map ( |m| {
289
290
m. iter ( )
@@ -292,7 +293,7 @@ impl DatadogTracesEncoder {
292
293
} )
293
294
. unwrap_or_default ( ) ;
294
295
295
- let spans = match trace. get ( "spans" ) {
296
+ let spans = match trace. get ( event_path ! ( "spans" ) ) {
296
297
Some ( Value :: Array ( v) ) => v
297
298
. iter ( )
298
299
. filter_map ( |s| s. as_object ( ) . map ( DatadogTracesEncoder :: convert_span) )
@@ -302,19 +303,19 @@ impl DatadogTracesEncoder {
302
303
303
304
let chunk = dd_proto:: TraceChunk {
304
305
priority : trace
305
- . get ( "priority" )
306
+ . get ( event_path ! ( "priority" ) )
306
307
. and_then ( |v| v. as_integer ( ) . map ( |v| v as i32 ) )
307
308
// This should not happen for Datadog originated traces, but in case this field is not populated
308
309
// we default to 1 (https://github.com/DataDog/datadog-agent/blob/eac2327/pkg/trace/sampler/sampler.go#L54-L55),
309
310
// which is what the Datadog trace-agent is doing for OTLP originated traces, as per
310
311
// https://github.com/DataDog/datadog-agent/blob/3ea2eb4/pkg/trace/api/otlp.go#L309.
311
312
. unwrap_or ( 1i32 ) ,
312
313
origin : trace
313
- . get ( "origin" )
314
+ . get ( event_path ! ( "origin" ) )
314
315
. map ( |v| v. to_string_lossy ( ) . into_owned ( ) )
315
316
. unwrap_or_default ( ) ,
316
317
dropped_trace : trace
317
- . get ( "dropped" )
318
+ . get ( event_path ! ( "dropped" ) )
318
319
. and_then ( |v| v. as_boolean ( ) )
319
320
. unwrap_or ( false ) ,
320
321
spans,
@@ -323,37 +324,37 @@ impl DatadogTracesEncoder {
323
324
324
325
dd_proto:: TracerPayload {
325
326
container_id : trace
326
- . get ( "container_id" )
327
+ . get ( event_path ! ( "container_id" ) )
327
328
. map ( |v| v. to_string_lossy ( ) . into_owned ( ) )
328
329
. unwrap_or_default ( ) ,
329
330
language_name : trace
330
- . get ( "language_name" )
331
+ . get ( event_path ! ( "language_name" ) )
331
332
. map ( |v| v. to_string_lossy ( ) . into_owned ( ) )
332
333
. unwrap_or_default ( ) ,
333
334
language_version : trace
334
- . get ( "language_version" )
335
+ . get ( event_path ! ( "language_version" ) )
335
336
. map ( |v| v. to_string_lossy ( ) . into_owned ( ) )
336
337
. unwrap_or_default ( ) ,
337
338
tracer_version : trace
338
- . get ( "tracer_version" )
339
+ . get ( event_path ! ( "tracer_version" ) )
339
340
. map ( |v| v. to_string_lossy ( ) . into_owned ( ) )
340
341
. unwrap_or_default ( ) ,
341
342
runtime_id : trace
342
- . get ( "runtime_id" )
343
+ . get ( event_path ! ( "runtime_id" ) )
343
344
. map ( |v| v. to_string_lossy ( ) . into_owned ( ) )
344
345
. unwrap_or_default ( ) ,
345
346
chunks : vec ! [ chunk] ,
346
347
tags,
347
348
env : trace
348
- . get ( "env" )
349
+ . get ( event_path ! ( "env" ) )
349
350
. map ( |v| v. to_string_lossy ( ) . into_owned ( ) )
350
351
. unwrap_or_default ( ) ,
351
352
hostname : trace
352
- . get ( "hostname" )
353
+ . get ( event_path ! ( "hostname" ) )
353
354
. map ( |v| v. to_string_lossy ( ) . into_owned ( ) )
354
355
. unwrap_or_default ( ) ,
355
356
app_version : trace
356
- . get ( "app_version" )
357
+ . get ( event_path ! ( "app_version" ) )
357
358
. map ( |v| v. to_string_lossy ( ) . into_owned ( ) )
358
359
. unwrap_or_default ( ) ,
359
360
}
0 commit comments