Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tracing-distributed@0.4.0, tracing-honeycomb@0.4.3 - tracing-subscriber 0.3 compatibility + Error impls #14

Merged
merged 11 commits into from
Dec 27, 2021
5 changes: 1 addition & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,11 @@ jobs:
- name: update clippy
run: rustup toolchain update stable

- name: install nightly
run: rustup toolchain install nightly

- name: clippy
run: cargo clippy --workspace --all-targets

- name: fmt
run: cargo fmt --all -- --check

- name: docs
run: cargo +nightly doc --no-deps
jfhbrook-at-work marked this conversation as resolved.
Show resolved Hide resolved
run: cargo doc --no-deps
4 changes: 2 additions & 2 deletions tracing-distributed/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tracing-distributed"
version = "0.3.1"
version = "0.4.0"
authors = [
"Inanna Malick <inanna@recursion.wtf>",
"Jeremiah Senkpiel <fishrock123@rocketmail.com>"
Expand All @@ -18,7 +18,7 @@ use_parking_lot = ["parking_lot"]
[dependencies]
tracing = "0.1.12"
tracing-core = "0.1.9"
tracing-subscriber = "0.2.0"
tracing-subscriber = "0.3"
jfhbrook-at-work marked this conversation as resolved.
Show resolved Hide resolved
itertools = "0.9"
parking_lot = { version = "0.11", optional = true }

Expand Down
4 changes: 2 additions & 2 deletions tracing-distributed/src/telemetry_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ where
V: 'static + tracing::field::Visit + Send + Sync,
T: 'static + Telemetry<Visitor = V, TraceId = TraceId, SpanId = SpanId>,
{
fn new_span(&self, attrs: &Attributes, id: &Id, ctx: Context<S>) {
jfhbrook-at-work marked this conversation as resolved.
Show resolved Hide resolved
fn on_new_span(&self, attrs: &Attributes, id: &Id, ctx: Context<S>) {
let span = ctx.span(id).expect("span data not found during new_span");
let mut extensions_mut = span.extensions_mut();
extensions_mut.insert(SpanInitAt::new());
Expand Down Expand Up @@ -237,7 +237,7 @@ where
parent_id: Some(self.trace_ctx_registry.promote_span_id(parent_id)),
initialized_at,
meta: event.metadata(),
service_name: &self.service_name,
service_name: self.service_name,
jfhbrook-at-work marked this conversation as resolved.
Show resolved Hide resolved
values: visitor,
};

Expand Down
15 changes: 15 additions & 0 deletions tracing-distributed/src/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,21 @@ pub enum TraceCtxError {
NoParentNodeHasTraceCtx,
}

impl std::fmt::Display for TraceCtxError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
use TraceCtxError::*;
write!(f, "{}",
match self {
TelemetryLayerNotRegistered => "`TelemetryLayer` is not a registered subscriber of the current Span",
RegistrySubscriberNotRegistered => "no `tracing_subscriber::Registry` is a registered subscriber of the current Span",
NoEnabledSpan => "the span is not enabled with an associated subscriber",
NoParentNodeHasTraceCtx => "unable to evaluate trace context; assert `register_dist_tracing_root` is called in some parent span",
})
}
}

impl std::error::Error for TraceCtxError {}

/// A `Span` holds ready-to-publish information gathered during the lifetime of a `tracing::Span`.
#[derive(Debug, Clone)]
pub struct Span<Visitor, SpanId, TraceId> {
Expand Down
6 changes: 3 additions & 3 deletions tracing-honeycomb/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tracing-honeycomb"
version = "0.4.2"
version = "0.4.3"
authors = [
"Inanna Malick <inanna@recursion.wtf>",
"Jeremiah Senkpiel <fishrock123@rocketmail.com>"
Expand All @@ -18,7 +18,7 @@ use_parking_lot = ["parking_lot", "tracing-distributed/use_parking_lot"]
[dependencies]
tracing = "0.1.12"
tracing-core = "0.1.9"
tracing-distributed = { path = "../tracing-distributed", version = "0.3" }
tracing-distributed = { path = "../tracing-distributed", version = ">= 0.3, < 0.5" }
libhoney-rust = "0.1.3"
rand = "0.7"
chrono = "0.4"
Expand All @@ -31,7 +31,7 @@ serde_json = "1"
[dev-dependencies]
tracing-attributes = "0.1.5"
futures-preview = { version = "0.3.0-alpha.19", features = ["compat"] }
tracing-subscriber = "0.2.0"
tracing-subscriber = "0.3.0"
tokio = { version = "0.2", features = ["full"] }
tracing-futures = "0.2.1"
proptest = "0.9.5"
2 changes: 2 additions & 0 deletions tracing-honeycomb/src/span_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ impl From<TryFromIntError> for ParseSpanIdError {
}
}

impl std::error::Error for ParseSpanIdError {}

impl FromStr for SpanId {
type Err = ParseSpanIdError;

Expand Down