Skip to content
Closed
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
16 changes: 16 additions & 0 deletions bottlecap/src/config/trace_propagation_style.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
use std::{fmt::Display, str::FromStr};

use crate::traces::context::SpanContext;
use crate::traces::propagation::carrier::Extractor;
use crate::traces::propagation::text_map_propagator::extract_datadog;
use serde::{Deserialize, Deserializer};
use crate::traces::propagation::traceparent;

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum TracePropagationStyle {
Expand All @@ -11,6 +15,18 @@ pub enum TracePropagationStyle {
None,
}

impl TracePropagationStyle {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not happy with coupling this into the propagation module which is going to be a crate eventually

pub fn extract(&self, carrier: &dyn Extractor) -> Option<SpanContext> {
match self {
TracePropagationStyle::Datadog => extract_datadog(carrier),
TracePropagationStyle::B3Multi => todo!(),
TracePropagationStyle::B3 => todo!(),
TracePropagationStyle::TraceContext => traceparent::extract(carrier),
TracePropagationStyle::None => todo!(),
}
}
}

impl FromStr for TracePropagationStyle {
type Err = String;

Expand Down
Loading