Skip to content

Commit

Permalink
Move experimental features to separate folder
Browse files Browse the repository at this point in the history
  • Loading branch information
tensorchen committed Jun 11, 2020
1 parent 6f14587 commit b83826b
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/target
**/*.rs.bk
Cargo.lock

# IDEA
/.idea/
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ base64_format = ["base64"]
trace = ["futures", "rand", "pin-project"]
metrics = ["prometheus"]
serialize = ["serde", "bincode"]
binary_propagator = []

[workspace]
members = [
Expand Down
3 changes: 0 additions & 3 deletions src/api/context/propagation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,6 @@
use crate::api;
use std::collections::HashMap;

#[cfg(feature = "base64")]
pub mod base64_format;
pub mod binary_propagator;
pub mod composite_propagator;
pub mod text_propagator;

Expand Down
5 changes: 1 addition & 4 deletions src/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,9 @@ pub mod metrics;
pub mod trace;

pub use self::core::{Key, KeyValue, Unit, Value};
#[cfg(feature = "base64_format")]
pub use context::propagation::base64_format::Base64Format;
pub use context::{
propagation::{
binary_propagator::BinaryFormat, composite_propagator::HttpTextCompositePropagator,
text_propagator::HttpTextFormat, Carrier,
composite_propagator::HttpTextCompositePropagator, text_propagator::HttpTextFormat, Carrier,
},
Context,
};
Expand Down
3 changes: 3 additions & 0 deletions src/experimental/api/context/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//! # OpenTelemetry Experimental Context API
pub mod propagation;
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//! and deserializes values from base64 strings. There is a blanket implementation
//! for any implementors of `BinaryFormat`
use crate::api;
use crate::api::BinaryFormat;
use crate::experimental::api::BinaryFormat;
use base64::{decode, encode};

/// Used to serialize and deserialize `SpanContext`s to and from a base64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ impl BinaryFormat for BinaryPropagator {
#[cfg(test)]
mod tests {
use super::*;
use crate::api::BinaryFormat;

#[rustfmt::skip]
fn to_bytes_data() -> Vec<(api::SpanContext, [u8; 29])> {
Expand Down
38 changes: 38 additions & 0 deletions src/experimental/api/context/propagation/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//! # OpenTelemetry Experimental Propagator interface
//!
//! ## Binary Format
//!
//! `BinaryFormat` is a formatter to serialize and deserialize a value
//! into a binary format.
//!
//! `BinaryFormat` MUST expose the APIs that serializes values into bytes,
//! and deserializes values from bytes.
//!
//! ### ToBytes
//!
//! Serializes the given value into the on-the-wire representation.
//!
//! Required arguments:
//!
//! - the value to serialize, can be `SpanContext` or `DistributedContext`.
//!
//! Returns the on-the-wire byte representation of the value.
//!
//! ### FromBytes
//!
//! Creates a value from the given on-the-wire encoded representation.
//!
//! If the value could not be parsed, the underlying implementation
//! SHOULD decide to return ether an empty value, an invalid value, or
//! a valid value.
//!
//! Required arguments:
//!
//! - on-the-wire byte representation of the value.
//!
//! Returns a value deserialized from bytes.
//!
#[cfg(feature = "base64")]
pub mod base64_format;
pub mod binary_propagator;
8 changes: 8 additions & 0 deletions src/experimental/api/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//! ## OpenTelemetry Experimental API: What applications use and SDKs implement.
pub mod context;

#[cfg(feature = "base64_format")]
pub use context::propagation::base64_format::Base64Format;
#[cfg(feature = "binary_propagator")]
pub use context::propagation::binary_propagator::BinaryFormat;
3 changes: 3 additions & 0 deletions src/experimental/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//! # OpenTelemetry Experimental Features
pub mod api;
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@
#![cfg_attr(test, deny(warnings))]

pub mod api;
pub mod experimental;
pub mod exporter;
pub mod global;
pub mod sdk;

0 comments on commit b83826b

Please sign in to comment.