Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions libdd-common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ pub mod header {
#![allow(clippy::declare_interior_mutable_const)]
use hyper::{header::HeaderName, http::HeaderValue};

// These strings are defined separately to be used in context where &str are used to represent
// headers (e.g. SendData) while keeping a single source of truth.
pub const DATADOG_SEND_REAL_HTTP_STATUS_STR: &str = "datadog-send-real-http-status";
pub const DATADOG_TRACE_COUNT_STR: &str = "x-datadog-trace-count";
pub const APPLICATION_MSGPACK_STR: &str = "application/msgpack";
pub const APPLICATION_PROTOBUF_STR: &str = "application/x-protobuf";

Expand All @@ -101,7 +97,7 @@ pub mod header {
/// If this is not set then the agent will always return a 200 regardless if the payload is
/// dropped.
pub const DATADOG_SEND_REAL_HTTP_STATUS: HeaderName =
HeaderName::from_static(DATADOG_SEND_REAL_HTTP_STATUS_STR);
HeaderName::from_static("datadog-send-real-http-status");
pub const DATADOG_API_KEY: HeaderName = HeaderName::from_static("dd-api-key");
pub const APPLICATION_JSON: HeaderValue = HeaderValue::from_static("application/json");
pub const APPLICATION_MSGPACK: HeaderValue = HeaderValue::from_static(APPLICATION_MSGPACK_STR);
Expand Down
4 changes: 2 additions & 2 deletions libdd-data-pipeline/src/stats_exporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ impl StatsExporter {
}
let body = rmp_serde::encode::to_vec_named(&payload)?;

let mut headers: HashMap<&'static str, String> = self.meta.borrow().into();
let mut headers: HashMap<http::HeaderName, String> = self.meta.borrow().into();

headers.insert(
http::header::CONTENT_TYPE.as_str(),
http::header::CONTENT_TYPE,
libdd_common::header::APPLICATION_MSGPACK_STR.to_string(),
);

Expand Down
4 changes: 3 additions & 1 deletion libdd-data-pipeline/src/trace_exporter/agent_response.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// Copyright 2024-Present Datadog, Inc. https://www.datadoghq.com/
// SPDX-License-Identifier: Apache-2.0

use http::HeaderName;
use std::sync::Arc;

use arc_swap::ArcSwap;

pub const DATADOG_RATES_PAYLOAD_VERSION_HEADER: &str = "datadog-rates-payload-version";
pub const DATADOG_RATES_PAYLOAD_VERSION: HeaderName =
HeaderName::from_static("datadog-rates-payload-version");

/// `AgentResponse` structure holds agent response information upon successful request.
#[derive(Debug, PartialEq)]
Expand Down
12 changes: 6 additions & 6 deletions libdd-data-pipeline/src/trace_exporter/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024-Present Datadog, Inc. https://www.datadoghq.com/

Check failure on line 1 in libdd-data-pipeline/src/trace_exporter/mod.rs

View workflow job for this annotation

GitHub Actions / [macos-15:] test report

libdd-data-pipeline/src/trace_exporter/mod.rs.trace_exporter::tests::test_from_tracer_tags_to_hashmap

trace_exporter::tests::test_from_tracer_tags_to_hashmap

Check failure on line 1 in libdd-data-pipeline/src/trace_exporter/mod.rs

View workflow job for this annotation

GitHub Actions / [ubuntu-latest:] test report

libdd-data-pipeline/src/trace_exporter/mod.rs.trace_exporter::tests::test_from_tracer_tags_to_hashmap

trace_exporter::tests::test_from_tracer_tags_to_hashmap

Check failure on line 1 in libdd-data-pipeline/src/trace_exporter/mod.rs

View workflow job for this annotation

GitHub Actions / [windows-latest:] test report

libdd-data-pipeline/src/trace_exporter/mod.rs.trace_exporter::tests::test_from_tracer_tags_to_hashmap

trace_exporter::tests::test_from_tracer_tags_to_hashmap
// SPDX-License-Identifier: Apache-2.0
pub mod agent_response;
pub mod builder;
Expand All @@ -19,7 +19,7 @@
use crate::stats_exporter::StatsExporter;
use crate::telemetry::{SendPayloadTelemetry, TelemetryClient};
use crate::trace_exporter::agent_response::{
AgentResponsePayloadVersion, DATADOG_RATES_PAYLOAD_VERSION_HEADER,
AgentResponsePayloadVersion, DATADOG_RATES_PAYLOAD_VERSION,
};
use crate::trace_exporter::error::{InternalErrorKind, RequestError, TraceExporterError};
use crate::{
Expand Down Expand Up @@ -148,8 +148,8 @@
}
}

impl<'a> From<&'a TracerMetadata> for HashMap<&'static str, String> {
fn from(tags: &'a TracerMetadata) -> HashMap<&'static str, String> {
impl<'a> From<&'a TracerMetadata> for HashMap<http::HeaderName, String> {
fn from(tags: &'a TracerMetadata) -> HashMap<http::HeaderName, String> {
TracerHeaderTags::from(tags).into()
}
}
Expand Down Expand Up @@ -563,7 +563,7 @@
&self,
endpoint: &Endpoint,
mp_payload: Vec<u8>,
headers: HashMap<&'static str, String>,
headers: HashMap<http::HeaderName, String>,
chunks: usize,
chunks_dropped_p0: usize,
) -> Result<AgentResponse, TraceExporterError> {
Expand Down Expand Up @@ -738,7 +738,7 @@
match (
status.is_success(),
self.agent_payload_response_version.as_ref(),
response.headers().get(DATADOG_RATES_PAYLOAD_VERSION_HEADER),
response.headers().get(DATADOG_RATES_PAYLOAD_VERSION),
) {
(false, _, _) => {
// If the status is not success, the rates are considered unchanged
Expand Down Expand Up @@ -909,7 +909,7 @@
}

#[test]
fn test_from_tracer_tags_to_hashmap() {

Check failure on line 912 in libdd-data-pipeline/src/trace_exporter/mod.rs

View workflow job for this annotation

GitHub Actions / [ubuntu-latest:${RUST_VERSION}] test report

/home/runner/work/libdatadog/libdatadog/libdd-data-pipeline/src/trace_exporter/mod.rs.trace_exporter::tests::test_from_tracer_tags_to_hashmap

thread 'trace_exporter::tests::test_from_tracer_tags_to_hashmap' panicked at libdd-data-pipeline/src/trace_exporter/mod.rs:925:63
Raw output
thread 'trace_exporter::tests::test_from_tracer_tags_to_hashmap' panicked at libdd-data-pipeline/src/trace_exporter/mod.rs:925:63:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0:     0x5590845a634a - std::backtrace_rs::backtrace::libunwind::trace::h886f3b0575353f6e
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:     0x5590845a634a - std::backtrace_rs::backtrace::trace_unsynchronized::h652d1041ec67eb09
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x5590845a634a - std::sys::backtrace::_print_fmt::hd0317245a04c3039
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/backtrace.rs:66:9
   3:     0x5590845a634a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h14b23c1989cbd5c2
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/backtrace.rs:39:26
   4:     0x5590845d1b33 - core::fmt::rt::Argument::fmt::h43c1e387827e30dc
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/fmt/rt.rs:177:76
   5:     0x5590845d1b33 - core::fmt::write::h346b5eee5ed4d7cc
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/fmt/mod.rs:1189:21
   6:     0x5590845a2113 - std::io::Write::write_fmt::heeb48dcd4a60b46b
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/io/mod.rs:1884:15
   7:     0x5590845a6192 - std::sys::backtrace::BacktraceLock::print::h48db11f3fd4983ff
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/backtrace.rs:42:9
   8:     0x5590845a77cd - std::panicking::default_hook::{{closure}}::h65db976b9c0d8674
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:268:22
   9:     0x5590845a7613 - std::panicking::default_hook::h6eb3a1192db1ae36
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:295:9
  10:     0x5590845a7da7 - std::panicking::rust_panic_with_hook::h370ee1901241e459
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:801:13
  11:     0x5590845a7c06 - std::panicking::begin_panic_handler::{{closure}}::heabfe92676d6d073
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:667:13
  12:     0x5590845a6829 - std::sys::backtrace::__rust_end_short_backtrace::h6e22d229d4fdf49e
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/backtrace.rs:170:18
  13:     0x5590845a78cc - rust_begin_unwind
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:665:5
  14:     0x5590832835c0 - core::panicking::panic_fmt::hfae270fab21da3e6
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/panicking.rs:76:14
  15:     0x55908328364c - core::panicking::panic::h5a760ca58d73b582
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/panicking.rs:148:5
  16:     0x559083283539 - core::option::unwrap_failed::h062988505853ed0d
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/option.rs:2009:5
  17:     0x559083435eeb - core::option::Option<T>::unwrap::h24460c622569279c
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/option.rs:972:21
  18:     0x559083435eeb - libdd_data_pipeline::trace_exporter::tests::test_from_tracer_tags_to_hashmap::h88d62bbbee21a64b
                               at /home/runner/work/libdatadog/libdatadog/libdd-data-pipeline/src/trace_exporter/mod.rs:925:20
  19:     0x559083435a97 - libdd_data_pipeline::trace_exporter::tests::test_from_tracer_tags_to_hashmap::{{closure}}::h65c95e5a0b9fdb51
                               at /home/runner/work/libdatadog/libdatadog/libdd-data-pipeline/src/trace_exporter/mod.rs:912:42
  20:     0x5590833a04b6 - core::ops::function::FnOnce::call_once::hed6ee09b82e03cfc
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/ops/function.rs:250:5
  21:     0x55908350d97b - core::ops::function::FnOnce::call_once::hcf459d49f817e971
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/ops/function.rs:250:5
  22:     0x55908350d97b - test::__rust_begin_short_backtrace::h812692078d2a7065
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/test/src/lib.rs:632:18
  23:     0x55908350d2f8 - test::run_test_in_process::{{closure}}::he383169452078072
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/test/src/lib.rs:655:60
  24:     0x55908350d2f8 - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::hfd3325d295001553
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/panic/unwind_safe.rs:272:9
  25:     0x55908350d2f8 - std::panicking::try::do_call::hd41329e64e1d34ac
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:557:40
  26:     0x55908350d2f8 - std::panicking::try::h7a44da38acd5f700
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:520:19
  27:     0x55908350d2f8 - std::panic::catch_unwind::h84ae8452b3d168cb
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panic.rs:358:14
  28:     0x55908350d2f8 - test::run_test_in_process::h0d23dc8c28915531
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/test/src/lib.rs:655:27
  29:     0x55908350d2f8 - test::run_test::{{closure}}::h427e5ada87ee2030
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/test/src/lib.rs:576:43
  30:     0x5590834d0dca - test::run_test::{{closure}}::hb864816fed1c6cd7
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/test/src/lib.rs:606:41
  31:     0x5590834d0dca - std::sys::backtrace::__rust_begin_short_backtrace::ha8680ce782bf69f7
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/backtrace.rs:154:18
  32:     0x5590834d4724 - std::thread::Builder::spawn_unchecked_::{{closure}}::{{closure}}::h05b53495b5672e29
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/thread/mod.rs:561:17
  33:     0x5590834d4724 - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h2a6a6bcc98d0706b
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/panic/unwind_safe.rs:272:9
  34:     0x5590834d4724 - std::panicking::try::do_call::hccc670c81fea40a7
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:557:40
  35:     0x5590834d4724 - std::panicking::try::h755e3c65d88973b7
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:520:19
  36:     0x5590834d4724 - std::panic::catch_unwind::hced8032a948c5bd0
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panic.rs:358:14
  37:     0x5590834d4724 - std::thread::Builder::spawn_unchecked_::{{closure}}::h3b9e5c9edd874915
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/thread/mod.rs:559:30
  38:     0x5590834d4724 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hbc1380969ae25c01
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/ops/function.rs:250:5
  39:     0x5590845ac52b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h0bbb114b77b490c1
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/alloc/src/boxed.rs:1972:9
  40:     0x5590845ac52b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h3673811012fc0688
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/alloc/src/boxed.rs:1972:9
  41:     0x5590845ac52b - std::sys::pal::unix::thread::Thread::new::thread_start::h0feaf4a9a4b2ecde
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/pal/unix/thread.rs:105:17
  42:     0x7f89c129caa4 - <unknown>
  43:     0x7f89c1329c6c - <unknown>
  44:                0x0 - <unknown>
let tracer_tags = TracerMetadata {
tracer_version: "v0.1".to_string(),
language: "rust".to_string(),
Expand All @@ -920,7 +920,7 @@
..Default::default()
};

let hashmap: HashMap<&'static str, String> = (&tracer_tags).into();
let hashmap: HashMap<http::HeaderName, String> = (&tracer_tags).into();

assert_eq!(hashmap.get("datadog-meta-tracer-version").unwrap(), "v0.1");
assert_eq!(hashmap.get("datadog-meta-lang").unwrap(), "rust");
Expand Down
47 changes: 27 additions & 20 deletions libdd-data-pipeline/src/trace_exporter/trace_serializer.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// Copyright 2024-Present Datadog, Inc. https://www.datadoghq.com/

Check failure on line 1 in libdd-data-pipeline/src/trace_exporter/trace_serializer.rs

View workflow job for this annotation

GitHub Actions / [macos-15:] test report

libdd-data-pipeline/src/trace_exporter/trace_serializer.rs.trace_exporter::trace_serializer::tests::test_build_traces_headers

trace_exporter::trace_serializer::tests::test_build_traces_headers

Check failure on line 1 in libdd-data-pipeline/src/trace_exporter/trace_serializer.rs

View workflow job for this annotation

GitHub Actions / [macos-15:] test report

libdd-data-pipeline/src/trace_exporter/trace_serializer.rs.trace_exporter::trace_serializer::tests::test_build_traces_headers_with_agent_version

trace_exporter::trace_serializer::tests::test_build_traces_headers_with_agent_version

Check failure on line 1 in libdd-data-pipeline/src/trace_exporter/trace_serializer.rs

View workflow job for this annotation

GitHub Actions / [macos-15:] test report

libdd-data-pipeline/src/trace_exporter/trace_serializer.rs.trace_exporter::trace_serializer::tests::test_header_tags_conversion

trace_exporter::trace_serializer::tests::test_header_tags_conversion

Check failure on line 1 in libdd-data-pipeline/src/trace_exporter/trace_serializer.rs

View workflow job for this annotation

GitHub Actions / [macos-15:] test report

libdd-data-pipeline/src/trace_exporter/trace_serializer.rs.trace_exporter::trace_serializer::tests::test_prepare_traces_payload_empty_traces

trace_exporter::trace_serializer::tests::test_prepare_traces_payload_empty_traces

Check failure on line 1 in libdd-data-pipeline/src/trace_exporter/trace_serializer.rs

View workflow job for this annotation

GitHub Actions / [macos-15:] test report

libdd-data-pipeline/src/trace_exporter/trace_serializer.rs.trace_exporter::trace_serializer::tests::test_prepare_traces_payload_v04

trace_exporter::trace_serializer::tests::test_prepare_traces_payload_v04

Check failure on line 1 in libdd-data-pipeline/src/trace_exporter/trace_serializer.rs

View workflow job for this annotation

GitHub Actions / [macos-15:] test report

libdd-data-pipeline/src/trace_exporter/trace_serializer.rs.trace_exporter::trace_serializer::tests::test_prepare_traces_payload_with_agent_version

trace_exporter::trace_serializer::tests::test_prepare_traces_payload_with_agent_version

Check failure on line 1 in libdd-data-pipeline/src/trace_exporter/trace_serializer.rs

View workflow job for this annotation

GitHub Actions / [ubuntu-latest:] test report

libdd-data-pipeline/src/trace_exporter/trace_serializer.rs.trace_exporter::trace_serializer::tests::test_build_traces_headers

trace_exporter::trace_serializer::tests::test_build_traces_headers

Check failure on line 1 in libdd-data-pipeline/src/trace_exporter/trace_serializer.rs

View workflow job for this annotation

GitHub Actions / [ubuntu-latest:] test report

libdd-data-pipeline/src/trace_exporter/trace_serializer.rs.trace_exporter::trace_serializer::tests::test_build_traces_headers_with_agent_version

trace_exporter::trace_serializer::tests::test_build_traces_headers_with_agent_version

Check failure on line 1 in libdd-data-pipeline/src/trace_exporter/trace_serializer.rs

View workflow job for this annotation

GitHub Actions / [ubuntu-latest:] test report

libdd-data-pipeline/src/trace_exporter/trace_serializer.rs.trace_exporter::trace_serializer::tests::test_header_tags_conversion

trace_exporter::trace_serializer::tests::test_header_tags_conversion

Check failure on line 1 in libdd-data-pipeline/src/trace_exporter/trace_serializer.rs

View workflow job for this annotation

GitHub Actions / [ubuntu-latest:] test report

libdd-data-pipeline/src/trace_exporter/trace_serializer.rs.trace_exporter::trace_serializer::tests::test_prepare_traces_payload_empty_traces

trace_exporter::trace_serializer::tests::test_prepare_traces_payload_empty_traces

Check failure on line 1 in libdd-data-pipeline/src/trace_exporter/trace_serializer.rs

View workflow job for this annotation

GitHub Actions / [ubuntu-latest:] test report

libdd-data-pipeline/src/trace_exporter/trace_serializer.rs.trace_exporter::trace_serializer::tests::test_prepare_traces_payload_v04

trace_exporter::trace_serializer::tests::test_prepare_traces_payload_v04

Check failure on line 1 in libdd-data-pipeline/src/trace_exporter/trace_serializer.rs

View workflow job for this annotation

GitHub Actions / [ubuntu-latest:] test report

libdd-data-pipeline/src/trace_exporter/trace_serializer.rs.trace_exporter::trace_serializer::tests::test_prepare_traces_payload_with_agent_version

trace_exporter::trace_serializer::tests::test_prepare_traces_payload_with_agent_version

Check failure on line 1 in libdd-data-pipeline/src/trace_exporter/trace_serializer.rs

View workflow job for this annotation

GitHub Actions / [windows-latest:] test report

libdd-data-pipeline/src/trace_exporter/trace_serializer.rs.trace_exporter::trace_serializer::tests::test_build_traces_headers

trace_exporter::trace_serializer::tests::test_build_traces_headers

Check failure on line 1 in libdd-data-pipeline/src/trace_exporter/trace_serializer.rs

View workflow job for this annotation

GitHub Actions / [windows-latest:] test report

libdd-data-pipeline/src/trace_exporter/trace_serializer.rs.trace_exporter::trace_serializer::tests::test_build_traces_headers_with_agent_version

trace_exporter::trace_serializer::tests::test_build_traces_headers_with_agent_version

Check failure on line 1 in libdd-data-pipeline/src/trace_exporter/trace_serializer.rs

View workflow job for this annotation

GitHub Actions / [windows-latest:] test report

libdd-data-pipeline/src/trace_exporter/trace_serializer.rs.trace_exporter::trace_serializer::tests::test_header_tags_conversion

trace_exporter::trace_serializer::tests::test_header_tags_conversion

Check failure on line 1 in libdd-data-pipeline/src/trace_exporter/trace_serializer.rs

View workflow job for this annotation

GitHub Actions / [windows-latest:] test report

libdd-data-pipeline/src/trace_exporter/trace_serializer.rs.trace_exporter::trace_serializer::tests::test_prepare_traces_payload_empty_traces

trace_exporter::trace_serializer::tests::test_prepare_traces_payload_empty_traces

Check failure on line 1 in libdd-data-pipeline/src/trace_exporter/trace_serializer.rs

View workflow job for this annotation

GitHub Actions / [windows-latest:] test report

libdd-data-pipeline/src/trace_exporter/trace_serializer.rs.trace_exporter::trace_serializer::tests::test_prepare_traces_payload_v04

trace_exporter::trace_serializer::tests::test_prepare_traces_payload_v04

Check failure on line 1 in libdd-data-pipeline/src/trace_exporter/trace_serializer.rs

View workflow job for this annotation

GitHub Actions / [windows-latest:] test report

libdd-data-pipeline/src/trace_exporter/trace_serializer.rs.trace_exporter::trace_serializer::tests::test_prepare_traces_payload_with_agent_version

trace_exporter::trace_serializer::tests::test_prepare_traces_payload_with_agent_version
// SPDX-License-Identifier: Apache-2.0

use crate::trace_exporter::agent_response::{
AgentResponsePayloadVersion, DATADOG_RATES_PAYLOAD_VERSION_HEADER,
AgentResponsePayloadVersion, DATADOG_RATES_PAYLOAD_VERSION,
};
use crate::trace_exporter::error::TraceExporterError;
use crate::trace_exporter::TraceExporterOutputFormat;
use http::header::CONTENT_TYPE;
use http::{header::CONTENT_TYPE, HeaderName};
use libdd_common::header::{
APPLICATION_MSGPACK_STR, DATADOG_SEND_REAL_HTTP_STATUS_STR, DATADOG_TRACE_COUNT_STR,
APPLICATION_MSGPACK_STR, DATADOG_SEND_REAL_HTTP_STATUS, DATADOG_TRACE_COUNT,
};
use libdd_trace_utils::msgpack_decoder::decode::error::DecodeError;
use libdd_trace_utils::msgpack_encoder;
Expand All @@ -22,7 +22,7 @@
/// Serialized msgpack payload
pub data: Vec<u8>,
/// HTTP headers for the request
pub headers: HashMap<&'static str, String>,
pub headers: HashMap<HeaderName, String>,
/// Number of trace chunks
pub chunk_count: usize,
}
Expand Down Expand Up @@ -82,14 +82,14 @@
&self,
header_tags: TracerHeaderTags,
chunk_count: usize,
) -> HashMap<&'static str, String> {
let mut headers: HashMap<&'static str, String> = header_tags.into();
headers.insert(DATADOG_SEND_REAL_HTTP_STATUS_STR, "1".to_string());
headers.insert(DATADOG_TRACE_COUNT_STR, chunk_count.to_string());
headers.insert(CONTENT_TYPE.as_str(), APPLICATION_MSGPACK_STR.to_string());
) -> HashMap<HeaderName, String> {
let mut headers: HashMap<HeaderName, String> = header_tags.into();
headers.insert(DATADOG_SEND_REAL_HTTP_STATUS, "1".to_string());
headers.insert(DATADOG_TRACE_COUNT, chunk_count.to_string());
headers.insert(CONTENT_TYPE, APPLICATION_MSGPACK_STR.to_string());
if let Some(agent_payload_response_version) = &self.agent_payload_response_version {
headers.insert(
DATADOG_RATES_PAYLOAD_VERSION_HEADER,
DATADOG_RATES_PAYLOAD_VERSION,
agent_payload_response_version.header_value(),
);
}
Expand All @@ -115,9 +115,7 @@
use super::*;
use crate::trace_exporter::agent_response::AgentResponsePayloadVersion;
use http::header::CONTENT_TYPE;
use libdd_common::header::{
APPLICATION_MSGPACK_STR, DATADOG_SEND_REAL_HTTP_STATUS_STR, DATADOG_TRACE_COUNT_STR,
};
use libdd_common::header::APPLICATION_MSGPACK_STR;
use libdd_tinybytes::BytesString;
use libdd_trace_utils::span::v04::SpanBytes;
use libdd_trace_utils::trace_utils::TracerHeaderTags;
Expand Down Expand Up @@ -173,14 +171,17 @@
}

#[test]
fn test_build_traces_headers() {

Check failure on line 174 in libdd-data-pipeline/src/trace_exporter/trace_serializer.rs

View workflow job for this annotation

GitHub Actions / [ubuntu-latest:${RUST_VERSION}] test report

/home/runner/work/libdatadog/libdatadog/libdd-data-pipeline/src/trace_exporter/trace_serializer.rs.trace_exporter::trace_serializer::tests::test_build_traces_headers

thread 'trace_exporter::trace_serializer::tests::test_build_traces_headers' panicked at libdd-data-pipeline/src/trace_exporter/trace_serializer.rs:181:65
Raw output
thread 'trace_exporter::trace_serializer::tests::test_build_traces_headers' panicked at libdd-data-pipeline/src/trace_exporter/trace_serializer.rs:181:65:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0:     0x5620534c434a - std::backtrace_rs::backtrace::libunwind::trace::h886f3b0575353f6e
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:     0x5620534c434a - std::backtrace_rs::backtrace::trace_unsynchronized::h652d1041ec67eb09
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x5620534c434a - std::sys::backtrace::_print_fmt::hd0317245a04c3039
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/backtrace.rs:66:9
   3:     0x5620534c434a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h14b23c1989cbd5c2
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/backtrace.rs:39:26
   4:     0x5620534efb33 - core::fmt::rt::Argument::fmt::h43c1e387827e30dc
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/fmt/rt.rs:177:76
   5:     0x5620534efb33 - core::fmt::write::h346b5eee5ed4d7cc
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/fmt/mod.rs:1189:21
   6:     0x5620534c0113 - std::io::Write::write_fmt::heeb48dcd4a60b46b
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/io/mod.rs:1884:15
   7:     0x5620534c4192 - std::sys::backtrace::BacktraceLock::print::h48db11f3fd4983ff
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/backtrace.rs:42:9
   8:     0x5620534c57cd - std::panicking::default_hook::{{closure}}::h65db976b9c0d8674
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:268:22
   9:     0x5620534c5613 - std::panicking::default_hook::h6eb3a1192db1ae36
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:295:9
  10:     0x5620534c5da7 - std::panicking::rust_panic_with_hook::h370ee1901241e459
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:801:13
  11:     0x5620534c5c06 - std::panicking::begin_panic_handler::{{closure}}::heabfe92676d6d073
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:667:13
  12:     0x5620534c4829 - std::sys::backtrace::__rust_end_short_backtrace::h6e22d229d4fdf49e
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/backtrace.rs:170:18
  13:     0x5620534c58cc - rust_begin_unwind
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:665:5
  14:     0x5620521a15c0 - core::panicking::panic_fmt::hfae270fab21da3e6
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/panicking.rs:76:14
  15:     0x5620521a164c - core::panicking::panic::h5a760ca58d73b582
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/panicking.rs:148:5
  16:     0x5620521a1539 - core::option::unwrap_failed::h062988505853ed0d
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/option.rs:2009:5
  17:     0x5620523be53d - core::option::Option<T>::unwrap::h24460c622569279c
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/option.rs:972:21
  18:     0x5620523be53d - libdd_data_pipeline::trace_exporter::trace_serializer::tests::test_build_traces_headers::hb4726d84bf7122ac
                               at /home/runner/work/libdatadog/libdatadog/libdd-data-pipeline/src/trace_exporter/trace_serializer.rs:181:13
  19:     0x5620523be3e7 - libdd_data_pipeline::trace_exporter::trace_serializer::tests::test_build_traces_headers::{{closure}}::hf38ac4dab066ba3a
                               at /home/runner/work/libdatadog/libdatadog/libdd-data-pipeline/src/trace_exporter/trace_serializer.rs:174:35
  20:     0x5620522bc4d6 - core::ops::function::FnOnce::call_once::h75fca09fbd2407da
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/ops/function.rs:250:5
  21:     0x56205242b97b - core::ops::function::FnOnce::call_once::hcf459d49f817e971
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/ops/function.rs:250:5
  22:     0x56205242b97b - test::__rust_begin_short_backtrace::h812692078d2a7065
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/test/src/lib.rs:632:18
  23:     0x56205242b2f8 - test::run_test_in_process::{{closure}}::he383169452078072
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/test/src/lib.rs:655:60
  24:     0x56205242b2f8 - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::hfd3325d295001553
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/panic/unwind_safe.rs:272:9
  25:     0x56205242b2f8 - std::panicking::try::do_call::hd41329e64e1d34ac
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:557:40
  26:     0x56205242b2f8 - std::panicking::try::h7a44da38acd5f700
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:520:19
  27:     0x56205242b2f8 - std::panic::catch_unwind::h84ae8452b3d168cb
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panic.rs:358:14
  28:     0x56205242b2f8 - test::run_test_in_process::h0d23dc8c28915531
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/test/src/lib.rs:655:27
  29:     0x56205242b2f8 - test::run_test::{{closure}}::h427e5ada87ee2030
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/test/src/lib.rs:576:43
  30:     0x5620523eedca - test::run_test::{{closure}}::hb864816fed1c6cd7
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/test/src/lib.rs:606:41
  31:     0x5620523eedca - std::sys::backtrace::__rust_begin_short_backtrace::ha8680ce782bf69f7
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/backtrace.rs:154:18
  32:     0x5620523f2724 - std::thread::Builder::spawn_unchecked_::{{closure}}::{{closure}}::h05b53495b5672e29
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/thread/mod.rs:561:17
  33:     0x5620523f2724 - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h2a6a6bcc98d0706b
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/panic/unwind_safe.rs:272:9
  34:     0x5620523f2724 - std::panicking::try::do_call::hccc670c81fea40a7
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:557:40
  35:     0x5620523f2724 - std::panicking::try::h755e3c65d88973b7
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:520:19
  36:     0x5620523f2724 - std::panic::catch_unwind::hced8032a948c5bd0
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panic.rs:358:14
  37:     0x5620523f2724 - std::thread::Builder::spawn_unchecked_::{{closure}}::h3b9e5c9edd874915
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/thread/mod.rs:559:30
  38:     0x5620523f2724 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hbc1380969ae25c01
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/ops/function.rs:250:5
  39:     0x5620534ca52b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h0bbb114b77b490c1
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/alloc/src/boxed.rs:1972:9
  40:     0x5620534ca52b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h3673811012fc0688
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/alloc/src/boxed.rs:1972:9
  41:     0x5620534ca52b - std::sys::pal::unix::thread::Thread::new::thread_start::h0feaf4a9a4b2ecde
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/pal/unix/thread.rs:105:17
  42:     0x7fd39da9caa4 - <unknown>
  43:     0x7fd39db29c6c - <unknown>
  44:                0x0 - <unknown>
let serializer = TraceSerializer::new(TraceExporterOutputFormat::V04, None);
let header_tags = create_test_header_tags();
let headers = serializer.build_traces_headers(header_tags, 3);

// Check basic headers are present
assert_eq!(headers.get(DATADOG_SEND_REAL_HTTP_STATUS_STR).unwrap(), "1");
assert_eq!(headers.get(DATADOG_TRACE_COUNT_STR).unwrap(), "3");
assert_eq!(
headers.get(DATADOG_SEND_REAL_HTTP_STATUS.as_str()).unwrap(),
"1"
);
assert_eq!(headers.get(DATADOG_TRACE_COUNT.as_str()).unwrap(), "3");
assert_eq!(
headers.get(CONTENT_TYPE.as_str()).unwrap(),
APPLICATION_MSGPACK_STR
Expand All @@ -205,15 +206,15 @@
}

#[test]
fn test_build_traces_headers_with_agent_version() {

Check failure on line 209 in libdd-data-pipeline/src/trace_exporter/trace_serializer.rs

View workflow job for this annotation

GitHub Actions / [ubuntu-latest:${RUST_VERSION}] test report

/home/runner/work/libdatadog/libdatadog/libdd-data-pipeline/src/trace_exporter/trace_serializer.rs.trace_exporter::trace_serializer::tests::test_build_traces_headers_with_agent_version

thread 'trace_exporter::trace_serializer::tests::test_build_traces_headers_with_agent_version' panicked at libdd-data-pipeline/src/trace_exporter/trace_serializer.rs:216:9
Raw output
thread 'trace_exporter::trace_serializer::tests::test_build_traces_headers_with_agent_version' panicked at libdd-data-pipeline/src/trace_exporter/trace_serializer.rs:216:9:
assertion failed: headers.contains_key(DATADOG_RATES_PAYLOAD_VERSION.as_str())
stack backtrace:
   0:     0x56446f30f34a - std::backtrace_rs::backtrace::libunwind::trace::h886f3b0575353f6e
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:     0x56446f30f34a - std::backtrace_rs::backtrace::trace_unsynchronized::h652d1041ec67eb09
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x56446f30f34a - std::sys::backtrace::_print_fmt::hd0317245a04c3039
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/backtrace.rs:66:9
   3:     0x56446f30f34a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h14b23c1989cbd5c2
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/backtrace.rs:39:26
   4:     0x56446f33ab33 - core::fmt::rt::Argument::fmt::h43c1e387827e30dc
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/fmt/rt.rs:177:76
   5:     0x56446f33ab33 - core::fmt::write::h346b5eee5ed4d7cc
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/fmt/mod.rs:1189:21
   6:     0x56446f30b113 - std::io::Write::write_fmt::heeb48dcd4a60b46b
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/io/mod.rs:1884:15
   7:     0x56446f30f192 - std::sys::backtrace::BacktraceLock::print::h48db11f3fd4983ff
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/backtrace.rs:42:9
   8:     0x56446f3107cd - std::panicking::default_hook::{{closure}}::h65db976b9c0d8674
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:268:22
   9:     0x56446f310613 - std::panicking::default_hook::h6eb3a1192db1ae36
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:295:9
  10:     0x56446f310da7 - std::panicking::rust_panic_with_hook::h370ee1901241e459
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:801:13
  11:     0x56446f310c06 - std::panicking::begin_panic_handler::{{closure}}::heabfe92676d6d073
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:667:13
  12:     0x56446f30f829 - std::sys::backtrace::__rust_end_short_backtrace::h6e22d229d4fdf49e
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/backtrace.rs:170:18
  13:     0x56446f3108cc - rust_begin_unwind
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:665:5
  14:     0x56446dfec5c0 - core::panicking::panic_fmt::hfae270fab21da3e6
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/panicking.rs:76:14
  15:     0x56446dfec64c - core::panicking::panic::h5a760ca58d73b582
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/panicking.rs:148:5
  16:     0x56446e20a032 - libdd_data_pipeline::trace_exporter::trace_serializer::tests::test_build_traces_headers_with_agent_version::h473327aa038a8dc2
                               at /home/runner/work/libdatadog/libdatadog/libdd-data-pipeline/src/trace_exporter/trace_serializer.rs:216:9
  17:     0x56446e209e77 - libdd_data_pipeline::trace_exporter::trace_serializer::tests::test_build_traces_headers_with_agent_version::{{closure}}::h038ca804500f3965
                               at /home/runner/work/libdatadog/libdatadog/libdd-data-pipeline/src/trace_exporter/trace_serializer.rs:209:54
  18:     0x56446e106706 - core::ops::function::FnOnce::call_once::h495f38284262e1e1
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/ops/function.rs:250:5
  19:     0x56446e27697b - core::ops::function::FnOnce::call_once::hcf459d49f817e971
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/ops/function.rs:250:5
  20:     0x56446e27697b - test::__rust_begin_short_backtrace::h812692078d2a7065
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/test/src/lib.rs:632:18
  21:     0x56446e2762f8 - test::run_test_in_process::{{closure}}::he383169452078072
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/test/src/lib.rs:655:60
  22:     0x56446e2762f8 - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::hfd3325d295001553
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/panic/unwind_safe.rs:272:9
  23:     0x56446e2762f8 - std::panicking::try::do_call::hd41329e64e1d34ac
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:557:40
  24:     0x56446e2762f8 - std::panicking::try::h7a44da38acd5f700
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:520:19
  25:     0x56446e2762f8 - std::panic::catch_unwind::h84ae8452b3d168cb
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panic.rs:358:14
  26:     0x56446e2762f8 - test::run_test_in_process::h0d23dc8c28915531
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/test/src/lib.rs:655:27
  27:     0x56446e2762f8 - test::run_test::{{closure}}::h427e5ada87ee2030
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/test/src/lib.rs:576:43
  28:     0x56446e239dca - test::run_test::{{closure}}::hb864816fed1c6cd7
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/test/src/lib.rs:606:41
  29:     0x56446e239dca - std::sys::backtrace::__rust_begin_short_backtrace::ha8680ce782bf69f7
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/backtrace.rs:154:18
  30:     0x56446e23d724 - std::thread::Builder::spawn_unchecked_::{{closure}}::{{closure}}::h05b53495b5672e29
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/thread/mod.rs:561:17
  31:     0x56446e23d724 - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h2a6a6bcc98d0706b
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/panic/unwind_safe.rs:272:9
  32:     0x56446e23d724 - std::panicking::try::do_call::hccc670c81fea40a7
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:557:40
  33:     0x56446e23d724 - std::panicking::try::h755e3c65d88973b7
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:520:19
  34:     0x56446e23d724 - std::panic::catch_unwind::hced8032a948c5bd0
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panic.rs:358:14
  35:     0x56446e23d724 - std::thread::Builder::spawn_unchecked_::{{closure}}::h3b9e5c9edd874915
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/thread/mod.rs:559:30
  36:     0x56446e23d724 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hbc1380969ae25c01
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/ops/function.rs:250:5
  37:     0x56446f31552b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h0bbb114b77b490c1
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/alloc/src/boxed.rs:1972:9
  38:     0x56446f31552b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h3673811012fc0688
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/alloc/src/boxed.rs:1972:9
  39:     0x56446f31552b - std::sys::pal::unix::thread::Thread::new::thread_start::h0feaf4a9a4b2ecde
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/pal/unix/thread.rs:105:17
  40:     0x7fe72909caa4 - <unknown>
  41:     0x7fe729129c6c - <unknown>
  42:                0x0 - <unknown>
let agent_version = AgentResponsePayloadVersion::new();
let serializer = TraceSerializer::new(TraceExporterOutputFormat::V04, Some(&agent_version));
let header_tags = create_test_header_tags();
let headers = serializer.build_traces_headers(header_tags, 2);

// Check that agent payload version header is included
assert!(headers.contains_key(DATADOG_RATES_PAYLOAD_VERSION_HEADER));
assert_eq!(headers.get(DATADOG_TRACE_COUNT_STR).unwrap(), "2");
assert!(headers.contains_key(DATADOG_RATES_PAYLOAD_VERSION.as_str()));
assert_eq!(headers.get(DATADOG_TRACE_COUNT.as_str()).unwrap(), "2");
}

#[test]
Expand Down Expand Up @@ -329,7 +330,7 @@
}

#[test]
fn test_prepare_traces_payload_v04() {

Check failure on line 333 in libdd-data-pipeline/src/trace_exporter/trace_serializer.rs

View workflow job for this annotation

GitHub Actions / [ubuntu-latest:${RUST_VERSION}] test report

/home/runner/work/libdatadog/libdatadog/libdd-data-pipeline/src/trace_exporter/trace_serializer.rs.trace_exporter::trace_serializer::tests::test_prepare_traces_payload_v04

thread 'trace_exporter::trace_serializer::tests::test_prepare_traces_payload_v04' panicked at libdd-data-pipeline/src/trace_exporter/trace_serializer.rs:351:64
Raw output
thread 'trace_exporter::trace_serializer::tests::test_prepare_traces_payload_v04' panicked at libdd-data-pipeline/src/trace_exporter/trace_serializer.rs:351:64:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0:     0x5653da39434a - std::backtrace_rs::backtrace::libunwind::trace::h886f3b0575353f6e
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:     0x5653da39434a - std::backtrace_rs::backtrace::trace_unsynchronized::h652d1041ec67eb09
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x5653da39434a - std::sys::backtrace::_print_fmt::hd0317245a04c3039
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/backtrace.rs:66:9
   3:     0x5653da39434a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h14b23c1989cbd5c2
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/backtrace.rs:39:26
   4:     0x5653da3bfb33 - core::fmt::rt::Argument::fmt::h43c1e387827e30dc
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/fmt/rt.rs:177:76
   5:     0x5653da3bfb33 - core::fmt::write::h346b5eee5ed4d7cc
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/fmt/mod.rs:1189:21
   6:     0x5653da390113 - std::io::Write::write_fmt::heeb48dcd4a60b46b
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/io/mod.rs:1884:15
   7:     0x5653da394192 - std::sys::backtrace::BacktraceLock::print::h48db11f3fd4983ff
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/backtrace.rs:42:9
   8:     0x5653da3957cd - std::panicking::default_hook::{{closure}}::h65db976b9c0d8674
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:268:22
   9:     0x5653da395613 - std::panicking::default_hook::h6eb3a1192db1ae36
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:295:9
  10:     0x5653da395da7 - std::panicking::rust_panic_with_hook::h370ee1901241e459
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:801:13
  11:     0x5653da395c06 - std::panicking::begin_panic_handler::{{closure}}::heabfe92676d6d073
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:667:13
  12:     0x5653da394829 - std::sys::backtrace::__rust_end_short_backtrace::h6e22d229d4fdf49e
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/backtrace.rs:170:18
  13:     0x5653da3958cc - rust_begin_unwind
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:665:5
  14:     0x5653d90715c0 - core::panicking::panic_fmt::hfae270fab21da3e6
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/panicking.rs:76:14
  15:     0x5653d907164c - core::panicking::panic::h5a760ca58d73b582
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/panicking.rs:148:5
  16:     0x5653d9071539 - core::option::unwrap_failed::h062988505853ed0d
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/option.rs:2009:5
  17:     0x5653d92929d3 - core::option::Option<T>::unwrap::h24460c622569279c
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/option.rs:972:21
  18:     0x5653d92929d3 - libdd_data_pipeline::trace_exporter::trace_serializer::tests::test_prepare_traces_payload_v04::h6657e1f2a86b1ca1
                               at /home/runner/work/libdatadog/libdatadog/libdd-data-pipeline/src/trace_exporter/trace_serializer.rs:351:13
  19:     0x5653d9292277 - libdd_data_pipeline::trace_exporter::trace_serializer::tests::test_prepare_traces_payload_v04::{{closure}}::h865a5900843f34e3
                               at /home/runner/work/libdatadog/libdatadog/libdd-data-pipeline/src/trace_exporter/trace_serializer.rs:333:41
  20:     0x5653d918d4e6 - core::ops::function::FnOnce::call_once::hadf13086daf71496
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/ops/function.rs:250:5
  21:     0x5653d92fb97b - core::ops::function::FnOnce::call_once::hcf459d49f817e971
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/ops/function.rs:250:5
  22:     0x5653d92fb97b - test::__rust_begin_short_backtrace::h812692078d2a7065
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/test/src/lib.rs:632:18
  23:     0x5653d92fb2f8 - test::run_test_in_process::{{closure}}::he383169452078072
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/test/src/lib.rs:655:60
  24:     0x5653d92fb2f8 - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::hfd3325d295001553
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/panic/unwind_safe.rs:272:9
  25:     0x5653d92fb2f8 - std::panicking::try::do_call::hd41329e64e1d34ac
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:557:40
  26:     0x5653d92fb2f8 - std::panicking::try::h7a44da38acd5f700
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:520:19
  27:     0x5653d92fb2f8 - std::panic::catch_unwind::h84ae8452b3d168cb
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panic.rs:358:14
  28:     0x5653d92fb2f8 - test::run_test_in_process::h0d23dc8c28915531
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/test/src/lib.rs:655:27
  29:     0x5653d92fb2f8 - test::run_test::{{closure}}::h427e5ada87ee2030
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/test/src/lib.rs:576:43
  30:     0x5653d92bedca - test::run_test::{{closure}}::hb864816fed1c6cd7
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/test/src/lib.rs:606:41
  31:     0x5653d92bedca - std::sys::backtrace::__rust_begin_short_backtrace::ha8680ce782bf69f7
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/backtrace.rs:154:18
  32:     0x5653d92c2724 - std::thread::Builder::spawn_unchecked_::{{closure}}::{{closure}}::h05b53495b5672e29
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/thread/mod.rs:561:17
  33:     0x5653d92c2724 - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h2a6a6bcc98d0706b
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/panic/unwind_safe.rs:272:9
  34:     0x5653d92c2724 - std::panicking::try::do_call::hccc670c81fea40a7
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:557:40
  35:     0x5653d92c2724 - std::panicking::try::h755e3c65d88973b7
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:520:19
  36:     0x5653d92c2724 - std::panic::catch_unwind::hced8032a948c5bd0
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panic.rs:358:14
  37:     0x5653d92c2724 - std::thread::Builder::spawn_unchecked_::{{closure}}::h3b9e5c9edd874915
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/thread/mod.rs:559:30
  38:     0x5653d92c2724 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hbc1380969ae25c01
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/ops/function.rs:250:5
  39:     0x5653da39a52b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h0bbb114b77b490c1
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/alloc/src/boxed.rs:1972:9
  40:     0x5653da39a52b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h3673811012fc0688
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/alloc/src/boxed.rs:1972:9
  41:     0x5653da39a52b - std::sys::pal::unix::thread::Thread::new::thread_start::h0feaf4a9a4b2ecde
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/pal/unix/thread.rs:105:17
  42:     0x7fd44729caa4 - <unknown>
  43:     0x7fd447329c6c - <unknown>
  44:                0x0 - <unknown>
let serializer = TraceSerializer::new(TraceExporterOutputFormat::V04, None);
let traces = vec![
vec![create_test_span()],
Expand All @@ -346,7 +347,10 @@
assert!(!prepared.headers.is_empty());

// Check headers
assert_eq!(prepared.headers.get(DATADOG_TRACE_COUNT_STR).unwrap(), "2");
assert_eq!(
prepared.headers.get(DATADOG_TRACE_COUNT.as_str()).unwrap(),
"2"
);
assert_eq!(prepared.headers.get("datadog-meta-lang").unwrap(), "rust");
}

Expand All @@ -366,7 +370,7 @@
}

#[test]
fn test_prepare_traces_payload_with_agent_version() {

Check failure on line 373 in libdd-data-pipeline/src/trace_exporter/trace_serializer.rs

View workflow job for this annotation

GitHub Actions / [ubuntu-latest:${RUST_VERSION}] test report

/home/runner/work/libdatadog/libdatadog/libdd-data-pipeline/src/trace_exporter/trace_serializer.rs.trace_exporter::trace_serializer::tests::test_prepare_traces_payload_with_agent_version

thread 'trace_exporter::trace_serializer::tests::test_prepare_traces_payload_with_agent_version' panicked at libdd-data-pipeline/src/trace_exporter/trace_serializer.rs:384:9
Raw output
thread 'trace_exporter::trace_serializer::tests::test_prepare_traces_payload_with_agent_version' panicked at libdd-data-pipeline/src/trace_exporter/trace_serializer.rs:384:9:
assertion failed: prepared.headers.contains_key(DATADOG_RATES_PAYLOAD_VERSION.as_str())
stack backtrace:
   0:     0x55db33bf234a - std::backtrace_rs::backtrace::libunwind::trace::h886f3b0575353f6e
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:     0x55db33bf234a - std::backtrace_rs::backtrace::trace_unsynchronized::h652d1041ec67eb09
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x55db33bf234a - std::sys::backtrace::_print_fmt::hd0317245a04c3039
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/backtrace.rs:66:9
   3:     0x55db33bf234a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h14b23c1989cbd5c2
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/backtrace.rs:39:26
   4:     0x55db33c1db33 - core::fmt::rt::Argument::fmt::h43c1e387827e30dc
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/fmt/rt.rs:177:76
   5:     0x55db33c1db33 - core::fmt::write::h346b5eee5ed4d7cc
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/fmt/mod.rs:1189:21
   6:     0x55db33bee113 - std::io::Write::write_fmt::heeb48dcd4a60b46b
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/io/mod.rs:1884:15
   7:     0x55db33bf2192 - std::sys::backtrace::BacktraceLock::print::h48db11f3fd4983ff
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/backtrace.rs:42:9
   8:     0x55db33bf37cd - std::panicking::default_hook::{{closure}}::h65db976b9c0d8674
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:268:22
   9:     0x55db33bf3613 - std::panicking::default_hook::h6eb3a1192db1ae36
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:295:9
  10:     0x55db33bf3da7 - std::panicking::rust_panic_with_hook::h370ee1901241e459
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:801:13
  11:     0x55db33bf3c06 - std::panicking::begin_panic_handler::{{closure}}::heabfe92676d6d073
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:667:13
  12:     0x55db33bf2829 - std::sys::backtrace::__rust_end_short_backtrace::h6e22d229d4fdf49e
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/backtrace.rs:170:18
  13:     0x55db33bf38cc - rust_begin_unwind
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:665:5
  14:     0x55db328cf5c0 - core::panicking::panic_fmt::hfae270fab21da3e6
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/panicking.rs:76:14
  15:     0x55db328cf64c - core::panicking::panic::h5a760ca58d73b582
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/panicking.rs:148:5
  16:     0x55db32af1739 - libdd_data_pipeline::trace_exporter::trace_serializer::tests::test_prepare_traces_payload_with_agent_version::hcd09808532194ace
                               at /home/runner/work/libdatadog/libdatadog/libdd-data-pipeline/src/trace_exporter/trace_serializer.rs:384:9
  17:     0x55db32af1177 - libdd_data_pipeline::trace_exporter::trace_serializer::tests::test_prepare_traces_payload_with_agent_version::{{closure}}::hdf252f666808dcf7
                               at /home/runner/work/libdatadog/libdatadog/libdd-data-pipeline/src/trace_exporter/trace_serializer.rs:373:56
  18:     0x55db329ec576 - core::ops::function::FnOnce::call_once::hf0166ef75dbaca35
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/ops/function.rs:250:5
  19:     0x55db32b5997b - core::ops::function::FnOnce::call_once::hcf459d49f817e971
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/ops/function.rs:250:5
  20:     0x55db32b5997b - test::__rust_begin_short_backtrace::h812692078d2a7065
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/test/src/lib.rs:632:18
  21:     0x55db32b592f8 - test::run_test_in_process::{{closure}}::he383169452078072
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/test/src/lib.rs:655:60
  22:     0x55db32b592f8 - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::hfd3325d295001553
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/panic/unwind_safe.rs:272:9
  23:     0x55db32b592f8 - std::panicking::try::do_call::hd41329e64e1d34ac
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:557:40
  24:     0x55db32b592f8 - std::panicking::try::h7a44da38acd5f700
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:520:19
  25:     0x55db32b592f8 - std::panic::catch_unwind::h84ae8452b3d168cb
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panic.rs:358:14
  26:     0x55db32b592f8 - test::run_test_in_process::h0d23dc8c28915531
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/test/src/lib.rs:655:27
  27:     0x55db32b592f8 - test::run_test::{{closure}}::h427e5ada87ee2030
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/test/src/lib.rs:576:43
  28:     0x55db32b1cdca - test::run_test::{{closure}}::hb864816fed1c6cd7
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/test/src/lib.rs:606:41
  29:     0x55db32b1cdca - std::sys::backtrace::__rust_begin_short_backtrace::ha8680ce782bf69f7
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/backtrace.rs:154:18
  30:     0x55db32b20724 - std::thread::Builder::spawn_unchecked_::{{closure}}::{{closure}}::h05b53495b5672e29
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/thread/mod.rs:561:17
  31:     0x55db32b20724 - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h2a6a6bcc98d0706b
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/panic/unwind_safe.rs:272:9
  32:     0x55db32b20724 - std::panicking::try::do_call::hccc670c81fea40a7
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:557:40
  33:     0x55db32b20724 - std::panicking::try::h755e3c65d88973b7
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:520:19
  34:     0x55db32b20724 - std::panic::catch_unwind::hced8032a948c5bd0
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panic.rs:358:14
  35:     0x55db32b20724 - std::thread::Builder::spawn_unchecked_::{{closure}}::h3b9e5c9edd874915
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/thread/mod.rs:559:30
  36:     0x55db32b20724 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hbc1380969ae25c01
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/ops/function.rs:250:5
  37:     0x55db33bf852b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h0bbb114b77b490c1
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/alloc/src/boxed.rs:1972:9
  38:     0x55db33bf852b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h3673811012fc0688
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/alloc/src/boxed.rs:1972:9
  39:     0x55db33bf852b - std::sys::pal::unix::thread::Thread::new::thread_start::h0feaf4a9a4b2ecde
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/pal/unix/thread.rs:105:17
  40:     0x7f8f4e89caa4 - <unknown>
  41:     0x7f8f4e929c6c - <unknown>
  42:                0x0 - <unknown>
let agent_version = AgentResponsePayloadVersion::new();
let serializer = TraceSerializer::new(TraceExporterOutputFormat::V04, Some(&agent_version));
let traces = vec![vec![create_test_span()]];
Expand All @@ -379,11 +383,11 @@
assert_eq!(prepared.chunk_count, 1);
assert!(prepared
.headers
.contains_key(DATADOG_RATES_PAYLOAD_VERSION_HEADER));
.contains_key(DATADOG_RATES_PAYLOAD_VERSION.as_str()));
}

#[test]
fn test_prepare_traces_payload_empty_traces() {

Check failure on line 390 in libdd-data-pipeline/src/trace_exporter/trace_serializer.rs

View workflow job for this annotation

GitHub Actions / [ubuntu-latest:${RUST_VERSION}] test report

/home/runner/work/libdatadog/libdatadog/libdd-data-pipeline/src/trace_exporter/trace_serializer.rs.trace_exporter::trace_serializer::tests::test_prepare_traces_payload_empty_traces

thread 'trace_exporter::trace_serializer::tests::test_prepare_traces_payload_empty_traces' panicked at libdd-data-pipeline/src/trace_exporter/trace_serializer.rs:402:64
Raw output
thread 'trace_exporter::trace_serializer::tests::test_prepare_traces_payload_empty_traces' panicked at libdd-data-pipeline/src/trace_exporter/trace_serializer.rs:402:64:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0:     0x560823b5d34a - std::backtrace_rs::backtrace::libunwind::trace::h886f3b0575353f6e
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:     0x560823b5d34a - std::backtrace_rs::backtrace::trace_unsynchronized::h652d1041ec67eb09
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x560823b5d34a - std::sys::backtrace::_print_fmt::hd0317245a04c3039
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/backtrace.rs:66:9
   3:     0x560823b5d34a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h14b23c1989cbd5c2
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/backtrace.rs:39:26
   4:     0x560823b88b33 - core::fmt::rt::Argument::fmt::h43c1e387827e30dc
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/fmt/rt.rs:177:76
   5:     0x560823b88b33 - core::fmt::write::h346b5eee5ed4d7cc
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/fmt/mod.rs:1189:21
   6:     0x560823b59113 - std::io::Write::write_fmt::heeb48dcd4a60b46b
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/io/mod.rs:1884:15
   7:     0x560823b5d192 - std::sys::backtrace::BacktraceLock::print::h48db11f3fd4983ff
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/backtrace.rs:42:9
   8:     0x560823b5e7cd - std::panicking::default_hook::{{closure}}::h65db976b9c0d8674
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:268:22
   9:     0x560823b5e613 - std::panicking::default_hook::h6eb3a1192db1ae36
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:295:9
  10:     0x560823b5eda7 - std::panicking::rust_panic_with_hook::h370ee1901241e459
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:801:13
  11:     0x560823b5ec06 - std::panicking::begin_panic_handler::{{closure}}::heabfe92676d6d073
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:667:13
  12:     0x560823b5d829 - std::sys::backtrace::__rust_end_short_backtrace::h6e22d229d4fdf49e
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/backtrace.rs:170:18
  13:     0x560823b5e8cc - rust_begin_unwind
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:665:5
  14:     0x56082283a5c0 - core::panicking::panic_fmt::hfae270fab21da3e6
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/panicking.rs:76:14
  15:     0x56082283a64c - core::panicking::panic::h5a760ca58d73b582
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/panicking.rs:148:5
  16:     0x56082283a539 - core::option::unwrap_failed::h062988505853ed0d
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/option.rs:2009:5
  17:     0x560822a5cbf6 - core::option::Option<T>::unwrap::h24460c622569279c
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/option.rs:972:21
  18:     0x560822a5cbf6 - libdd_data_pipeline::trace_exporter::trace_serializer::tests::test_prepare_traces_payload_empty_traces::h956aec19d4968caa
                               at /home/runner/work/libdatadog/libdatadog/libdd-data-pipeline/src/trace_exporter/trace_serializer.rs:402:13
  19:     0x560822a5c7d7 - libdd_data_pipeline::trace_exporter::trace_serializer::tests::test_prepare_traces_payload_empty_traces::{{closure}}::hbbae5a673de1d8d6
                               at /home/runner/work/libdatadog/libdatadog/libdd-data-pipeline/src/trace_exporter/trace_serializer.rs:390:50
  20:     0x5608229538d6 - core::ops::function::FnOnce::call_once::h2263a1d918f36f2a
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/ops/function.rs:250:5
  21:     0x560822ac497b - core::ops::function::FnOnce::call_once::hcf459d49f817e971
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/ops/function.rs:250:5
  22:     0x560822ac497b - test::__rust_begin_short_backtrace::h812692078d2a7065
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/test/src/lib.rs:632:18
  23:     0x560822ac42f8 - test::run_test_in_process::{{closure}}::he383169452078072
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/test/src/lib.rs:655:60
  24:     0x560822ac42f8 - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::hfd3325d295001553
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/panic/unwind_safe.rs:272:9
  25:     0x560822ac42f8 - std::panicking::try::do_call::hd41329e64e1d34ac
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:557:40
  26:     0x560822ac42f8 - std::panicking::try::h7a44da38acd5f700
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:520:19
  27:     0x560822ac42f8 - std::panic::catch_unwind::h84ae8452b3d168cb
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panic.rs:358:14
  28:     0x560822ac42f8 - test::run_test_in_process::h0d23dc8c28915531
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/test/src/lib.rs:655:27
  29:     0x560822ac42f8 - test::run_test::{{closure}}::h427e5ada87ee2030
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/test/src/lib.rs:576:43
  30:     0x560822a87dca - test::run_test::{{closure}}::hb864816fed1c6cd7
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/test/src/lib.rs:606:41
  31:     0x560822a87dca - std::sys::backtrace::__rust_begin_short_backtrace::ha8680ce782bf69f7
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/backtrace.rs:154:18
  32:     0x560822a8b724 - std::thread::Builder::spawn_unchecked_::{{closure}}::{{closure}}::h05b53495b5672e29
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/thread/mod.rs:561:17
  33:     0x560822a8b724 - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h2a6a6bcc98d0706b
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/panic/unwind_safe.rs:272:9
  34:     0x560822a8b724 - std::panicking::try::do_call::hccc670c81fea40a7
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:557:40
  35:     0x560822a8b724 - std::panicking::try::h755e3c65d88973b7
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:520:19
  36:     0x560822a8b724 - std::panic::catch_unwind::hced8032a948c5bd0
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panic.rs:358:14
  37:     0x560822a8b724 - std::thread::Builder::spawn_unchecked_::{{closure}}::h3b9e5c9edd874915
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/thread/mod.rs:559:30
  38:     0x560822a8b724 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hbc1380969ae25c01
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/ops/function.rs:250:5
  39:     0x560823b6352b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h0bbb114b77b490c1
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/alloc/src/boxed.rs:1972:9
  40:     0x560823b6352b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h3673811012fc0688
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/alloc/src/boxed.rs:1972:9
  41:     0x560823b6352b - std::sys::pal::unix::thread::Thread::new::thread_start::h0feaf4a9a4b2ecde
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/pal/unix/thread.rs:105:17
  42:     0x7f6558a9caa4 - <unknown>
  43:     0x7f6558b29c6c - <unknown>
  44:                0x0 - <unknown>
let serializer = TraceSerializer::new(TraceExporterOutputFormat::V04, None);
let traces: Vec<Vec<SpanBytes>> = vec![];
let header_tags = create_test_header_tags();
Expand All @@ -394,11 +398,14 @@
let prepared = result.unwrap();
assert_eq!(prepared.chunk_count, 0);
assert!(!prepared.data.is_empty()); // Even empty traces result in some serialized data
assert_eq!(prepared.headers.get(DATADOG_TRACE_COUNT_STR).unwrap(), "0");
assert_eq!(
prepared.headers.get(DATADOG_TRACE_COUNT.as_str()).unwrap(),
"0"
);
}

#[test]
fn test_header_tags_conversion() {

Check failure on line 408 in libdd-data-pipeline/src/trace_exporter/trace_serializer.rs

View workflow job for this annotation

GitHub Actions / [ubuntu-latest:${RUST_VERSION}] test report

/home/runner/work/libdatadog/libdatadog/libdd-data-pipeline/src/trace_exporter/trace_serializer.rs.trace_exporter::trace_serializer::tests::test_header_tags_conversion

thread 'trace_exporter::trace_serializer::tests::test_header_tags_conversion' panicked at libdd-data-pipeline/src/trace_exporter/trace_serializer.rs:423:53
Raw output
thread 'trace_exporter::trace_serializer::tests::test_header_tags_conversion' panicked at libdd-data-pipeline/src/trace_exporter/trace_serializer.rs:423:53:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0:     0x55762fff934a - std::backtrace_rs::backtrace::libunwind::trace::h886f3b0575353f6e
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:     0x55762fff934a - std::backtrace_rs::backtrace::trace_unsynchronized::h652d1041ec67eb09
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x55762fff934a - std::sys::backtrace::_print_fmt::hd0317245a04c3039
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/backtrace.rs:66:9
   3:     0x55762fff934a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h14b23c1989cbd5c2
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/backtrace.rs:39:26
   4:     0x557630024b33 - core::fmt::rt::Argument::fmt::h43c1e387827e30dc
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/fmt/rt.rs:177:76
   5:     0x557630024b33 - core::fmt::write::h346b5eee5ed4d7cc
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/fmt/mod.rs:1189:21
   6:     0x55762fff5113 - std::io::Write::write_fmt::heeb48dcd4a60b46b
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/io/mod.rs:1884:15
   7:     0x55762fff9192 - std::sys::backtrace::BacktraceLock::print::h48db11f3fd4983ff
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/backtrace.rs:42:9
   8:     0x55762fffa7cd - std::panicking::default_hook::{{closure}}::h65db976b9c0d8674
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:268:22
   9:     0x55762fffa613 - std::panicking::default_hook::h6eb3a1192db1ae36
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:295:9
  10:     0x55762fffada7 - std::panicking::rust_panic_with_hook::h370ee1901241e459
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:801:13
  11:     0x55762fffac06 - std::panicking::begin_panic_handler::{{closure}}::heabfe92676d6d073
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:667:13
  12:     0x55762fff9829 - std::sys::backtrace::__rust_end_short_backtrace::h6e22d229d4fdf49e
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/backtrace.rs:170:18
  13:     0x55762fffa8cc - rust_begin_unwind
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:665:5
  14:     0x55762ecd65c0 - core::panicking::panic_fmt::hfae270fab21da3e6
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/panicking.rs:76:14
  15:     0x55762ecd664c - core::panicking::panic::h5a760ca58d73b582
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/panicking.rs:148:5
  16:     0x55762ecd6539 - core::option::unwrap_failed::h062988505853ed0d
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/option.rs:2009:5
  17:     0x55762eef8f0d - core::option::Option<T>::unwrap::h24460c622569279c
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/option.rs:972:21
  18:     0x55762eef8f0d - libdd_data_pipeline::trace_exporter::trace_serializer::tests::test_header_tags_conversion::hd609f3b954403dd2
                               at /home/runner/work/libdatadog/libdatadog/libdd-data-pipeline/src/trace_exporter/trace_serializer.rs:423:20
  19:     0x55762eef8d27 - libdd_data_pipeline::trace_exporter::trace_serializer::tests::test_header_tags_conversion::{{closure}}::h7b44e20cc7dd8983
                               at /home/runner/work/libdatadog/libdatadog/libdd-data-pipeline/src/trace_exporter/trace_serializer.rs:408:37
  20:     0x55762edf2176 - core::ops::function::FnOnce::call_once::ha12531dd88eeca99
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/ops/function.rs:250:5
  21:     0x55762ef6097b - core::ops::function::FnOnce::call_once::hcf459d49f817e971
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/ops/function.rs:250:5
  22:     0x55762ef6097b - test::__rust_begin_short_backtrace::h812692078d2a7065
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/test/src/lib.rs:632:18
  23:     0x55762ef602f8 - test::run_test_in_process::{{closure}}::he383169452078072
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/test/src/lib.rs:655:60
  24:     0x55762ef602f8 - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::hfd3325d295001553
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/panic/unwind_safe.rs:272:9
  25:     0x55762ef602f8 - std::panicking::try::do_call::hd41329e64e1d34ac
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:557:40
  26:     0x55762ef602f8 - std::panicking::try::h7a44da38acd5f700
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:520:19
  27:     0x55762ef602f8 - std::panic::catch_unwind::h84ae8452b3d168cb
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panic.rs:358:14
  28:     0x55762ef602f8 - test::run_test_in_process::h0d23dc8c28915531
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/test/src/lib.rs:655:27
  29:     0x55762ef602f8 - test::run_test::{{closure}}::h427e5ada87ee2030
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/test/src/lib.rs:576:43
  30:     0x55762ef23dca - test::run_test::{{closure}}::hb864816fed1c6cd7
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/test/src/lib.rs:606:41
  31:     0x55762ef23dca - std::sys::backtrace::__rust_begin_short_backtrace::ha8680ce782bf69f7
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/backtrace.rs:154:18
  32:     0x55762ef27724 - std::thread::Builder::spawn_unchecked_::{{closure}}::{{closure}}::h05b53495b5672e29
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/thread/mod.rs:561:17
  33:     0x55762ef27724 - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h2a6a6bcc98d0706b
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/panic/unwind_safe.rs:272:9
  34:     0x55762ef27724 - std::panicking::try::do_call::hccc670c81fea40a7
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:557:40
  35:     0x55762ef27724 - std::panicking::try::h755e3c65d88973b7
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:520:19
  36:     0x55762ef27724 - std::panic::catch_unwind::hced8032a948c5bd0
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panic.rs:358:14
  37:     0x55762ef27724 - std::thread::Builder::spawn_unchecked_::{{closure}}::h3b9e5c9edd874915
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/thread/mod.rs:559:30
  38:     0x55762ef27724 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hbc1380969ae25c01
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/ops/function.rs:250:5
  39:     0x55762ffff52b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h0bbb114b77b490c1
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/alloc/src/boxed.rs:1972:9
  40:     0x55762ffff52b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h3673811012fc0688
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/alloc/src/boxed.rs:1972:9
  41:     0x55762ffff52b - std::sys::pal::unix::thread::Thread::new::thread_start::h0feaf4a9a4b2ecde
                               at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/pal/unix/thread.rs:105:17
  42:     0x7fd63a29caa4 - <unknown>
  43:     0x7fd63a329c6c - <unknown>
  44:                0x0 - <unknown>
let header_tags = TracerHeaderTags {
lang: "python",
lang_version: "3.9.0",
Expand Down
50 changes: 27 additions & 23 deletions libdd-trace-utils/src/send_data/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ use crate::tracer_payload::TracerPayloadCollection;
use anyhow::{anyhow, Context};
use futures::stream::FuturesUnordered;
use futures::StreamExt;
use http::header::CONTENT_TYPE;
use http::{header::CONTENT_TYPE, HeaderName};
use libdd_common::{
header::{
APPLICATION_MSGPACK_STR, APPLICATION_PROTOBUF_STR, DATADOG_SEND_REAL_HTTP_STATUS_STR,
DATADOG_TRACE_COUNT_STR,
APPLICATION_MSGPACK_STR, APPLICATION_PROTOBUF_STR, DATADOG_SEND_REAL_HTTP_STATUS,
DATADOG_TRACE_COUNT,
},
Connect, Endpoint, GenericHttpClient,
};
Expand Down Expand Up @@ -68,7 +68,7 @@ pub struct SendData {
pub(crate) tracer_payloads: TracerPayloadCollection,
pub(crate) size: usize, // have a rough size estimate to force flushing if it's large
target: Endpoint,
headers: HashMap<&'static str, String>,
headers: HashMap<HeaderName, String>,
retry_strategy: RetryStrategy,
#[cfg(feature = "compression")]
compression: Compression,
Expand All @@ -85,7 +85,7 @@ pub struct SendDataBuilder {
pub(crate) tracer_payloads: TracerPayloadCollection,
pub(crate) size: usize,
target: Endpoint,
headers: HashMap<&'static str, String>,
headers: HashMap<HeaderName, String>,
retry_strategy: RetryStrategy,
#[cfg(feature = "compression")]
compression: Compression,
Expand All @@ -98,8 +98,8 @@ impl SendDataBuilder {
tracer_header_tags: TracerHeaderTags,
target: &Endpoint,
) -> SendDataBuilder {
let mut headers: HashMap<&'static str, String> = tracer_header_tags.into();
headers.insert(DATADOG_SEND_REAL_HTTP_STATUS_STR, "1".to_string());
let mut headers: HashMap<HeaderName, String> = tracer_header_tags.into();
headers.insert(DATADOG_SEND_REAL_HTTP_STATUS, "1".to_string());
SendDataBuilder {
tracer_payloads: tracer_payload,
size,
Expand Down Expand Up @@ -160,8 +160,8 @@ impl SendData {
tracer_header_tags: TracerHeaderTags,
target: &Endpoint,
) -> SendData {
let mut headers: HashMap<&'static str, String> = tracer_header_tags.into();
headers.insert(DATADOG_SEND_REAL_HTTP_STATUS_STR, "1".to_string());
let mut headers: HashMap<HeaderName, String> = tracer_header_tags.into();
headers.insert(DATADOG_SEND_REAL_HTTP_STATUS, "1".to_string());
SendData {
tracer_payloads: tracer_payload,
size,
Expand Down Expand Up @@ -243,7 +243,7 @@ impl SendData {
&self,
chunks: u64,
payload: Vec<u8>,
headers: HashMap<&'static str, String>,
headers: HashMap<HeaderName, String>,
http_client: &GenericHttpClient<C>,
endpoint: Option<&Endpoint>,
) -> (SendWithRetryResult, u64, u64) {
Expand All @@ -268,7 +268,11 @@ impl SendData {
}

#[cfg(feature = "compression")]
fn compress_payload(&self, payload: Vec<u8>, headers: &mut HashMap<&str, String>) -> Vec<u8> {
fn compress_payload(
&self,
payload: Vec<u8>,
headers: &mut HashMap<HeaderName, String>,
) -> Vec<u8> {
match self.compression {
Compression::Zstd(level) => {
let result = (|| -> std::io::Result<Vec<u8>> {
Expand All @@ -279,7 +283,7 @@ impl SendData {

match result {
Ok(compressed_payload) => {
headers.insert("Content-Encoding", "zstd".to_string());
headers.insert(http::header::CONTENT_ENCODING, "zstd".to_string());
compressed_payload
}
Err(_) => payload,
Expand Down Expand Up @@ -317,7 +321,7 @@ impl SendData {
#[cfg(not(feature = "compression"))]
let final_payload = serialized_trace_payload;

request_headers.insert(CONTENT_TYPE.as_str(), APPLICATION_PROTOBUF_STR.to_string());
request_headers.insert(CONTENT_TYPE, APPLICATION_PROTOBUF_STR.to_string());

let (response, bytes_sent, chunks) = self
.send_payload(
Expand Down Expand Up @@ -351,8 +355,8 @@ impl SendData {
#[allow(clippy::unwrap_used)]
let chunks = u64::try_from(tracer_payload.chunks.len()).unwrap();
let mut headers = self.headers.clone();
headers.insert(DATADOG_TRACE_COUNT_STR, chunks.to_string());
headers.insert(CONTENT_TYPE.as_str(), APPLICATION_MSGPACK_STR.to_string());
headers.insert(DATADOG_TRACE_COUNT, chunks.to_string());
headers.insert(CONTENT_TYPE, APPLICATION_MSGPACK_STR.to_string());

let payload = match rmp_serde::to_vec_named(tracer_payload) {
Ok(p) => p,
Expand All @@ -372,8 +376,8 @@ impl SendData {
#[allow(clippy::unwrap_used)]
let chunks = u64::try_from(self.tracer_payloads.size()).unwrap();
let mut headers = self.headers.clone();
headers.insert(DATADOG_TRACE_COUNT_STR, chunks.to_string());
headers.insert(CONTENT_TYPE.as_str(), APPLICATION_MSGPACK_STR.to_string());
headers.insert(DATADOG_TRACE_COUNT, chunks.to_string());
headers.insert(CONTENT_TYPE, APPLICATION_MSGPACK_STR.to_string());

let payload = msgpack_encoder::v04::to_vec(payload);

Expand All @@ -389,8 +393,8 @@ impl SendData {
#[allow(clippy::unwrap_used)]
let chunks = u64::try_from(self.tracer_payloads.size()).unwrap();
let mut headers = self.headers.clone();
headers.insert(DATADOG_TRACE_COUNT_STR, chunks.to_string());
headers.insert(CONTENT_TYPE.as_str(), APPLICATION_MSGPACK_STR.to_string());
headers.insert(DATADOG_TRACE_COUNT, chunks.to_string());
headers.insert(CONTENT_TYPE, APPLICATION_MSGPACK_STR.to_string());

let payload = match rmp_serde::to_vec(payload) {
Ok(p) => p,
Expand Down Expand Up @@ -574,7 +578,7 @@ mod tests {
assert_eq!(data.target.url.path(), "/foo/bar");

for (key, value) in HashMap::from(header_tags) {
assert_eq!(data.headers.get(key).unwrap(), &value);
assert_eq!(data.headers.get(&key).unwrap(), &value);
}
}

Expand Down Expand Up @@ -679,7 +683,7 @@ mod tests {
let mock = server
.mock_async(|when, then| {
when.method(POST)
.header(DATADOG_TRACE_COUNT_STR, "1")
.header(DATADOG_TRACE_COUNT.as_str(), "1")
.header("Content-type", "application/msgpack")
.header("datadog-meta-lang", header_tags.lang)
.header(
Expand Down Expand Up @@ -739,7 +743,7 @@ mod tests {
let mock = server
.mock_async(|when, then| {
when.method(POST)
.header(DATADOG_TRACE_COUNT_STR, "1")
.header(DATADOG_TRACE_COUNT.as_str(), "1")
.header("Content-type", "application/msgpack")
.header("datadog-meta-lang", header_tags.lang)
.header(
Expand Down Expand Up @@ -928,7 +932,7 @@ mod tests {
let mock = server
.mock_async(|when, then| {
when.method(POST)
.header(DATADOG_TRACE_COUNT_STR, "2")
.header(DATADOG_TRACE_COUNT.as_str(), "2")
.header("Content-type", "application/msgpack")
.header("datadog-meta-lang", header_tags.lang)
.header(
Expand Down
Loading
Loading