Skip to content

Commit

Permalink
Rename HttpB3Propagator to B3Propagator (#27)
Browse files Browse the repository at this point in the history
closes #9
  • Loading branch information
kichristensen authored and iredelmeier committed Dec 2, 2019
1 parent 5d54218 commit 8f5988a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! # HTTP B3 Propagator
//! # B3 Propagator
//!
//! The `HttpB3Propagator` facilitates `SpanContext` propagation using
//! The `B3Propagator` facilitates `SpanContext` propagation using
//! B3 Headers. This propagator supports both version of B3 headers,
//! 1. Single Header:
//! X-B3: {trace_id}-{span_id}-{sampling_state}-{parent_span_id}
Expand All @@ -24,14 +24,14 @@ static B3_PARENT_SPAN_ID_HEADER: &str = "X-B3-ParentSpanId";

/// Extracts and injects `SpanContext`s into `Carrier`s using B3 header format.
#[derive(Debug)]
pub struct HttpB3Propagator {
pub struct B3Propagator {
single_header: bool,
}

impl HttpB3Propagator {
impl B3Propagator {
/// Create a new `HttpB3Propagator`.
pub fn new(single_header: bool) -> Self {
HttpB3Propagator { single_header }
B3Propagator { single_header }
}

/// Extract trace id from hex encoded &str value.
Expand Down Expand Up @@ -125,7 +125,7 @@ impl HttpB3Propagator {
}
}

impl api::HttpTextFormat for HttpB3Propagator {
impl api::HttpTextFormat for B3Propagator {
/// Properly encodes the values of the `SpanContext` and injects them
/// into the `Carrier`.
fn inject(&self, context: api::SpanContext, carrier: &mut dyn api::Carrier) {
Expand Down Expand Up @@ -218,8 +218,8 @@ mod test {

#[test]
fn extract_b3() {
let single_header_propagator = HttpB3Propagator::new(true);
let multi_header_propagator = HttpB3Propagator::new(false);
let single_header_propagator = B3Propagator::new(true);
let multi_header_propagator = B3Propagator::new(false);

for (header, expected_context) in single_header_extract_data() {
let mut carrier: HashMap<&'static str, String> = HashMap::new();
Expand Down Expand Up @@ -251,8 +251,8 @@ mod test {

#[test]
fn inject_b3() {
let single_header_propagator = HttpB3Propagator::new(true);
let multi_header_propagator = HttpB3Propagator::new(false);
let single_header_propagator = B3Propagator::new(true);
let multi_header_propagator = B3Propagator::new(false);

for (expected_header, context) in single_header_inject_data() {
let mut carrier = HashMap::new();
Expand Down
2 changes: 1 addition & 1 deletion src/api/distributed_context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
//! - `HTTPTextFormat` which is used to inject and extract a value as text into
//! `Carrier`s that travel in-band across process boundaries.
pub mod binary_propagator;
pub mod http_b3_propagator;
pub mod b3_propagator;
pub mod trace_context_propagator;
2 changes: 1 addition & 1 deletion src/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub mod metrics;
pub mod trace;

pub use self::core::{Key, KeyValue, Unit, Value};
pub use distributed_context::http_b3_propagator::HttpB3Propagator;
pub use distributed_context::b3_propagator::B3Propagator;
pub use metrics::{
counter::{Counter, CounterHandle},
gauge::{Gauge, GaugeHandle},
Expand Down

0 comments on commit 8f5988a

Please sign in to comment.