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

V2 rain #5

Closed
wants to merge 5 commits into from
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
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@
**/*.rs.bk
Cargo.lock
honeycomb.key
tracing-honeycomb/proptest-regressions/*
.idea/*
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
members = [
"tracing-distributed",
"tracing-honeycomb",
]
]
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2020 Paul Kinsky (Inanna Malick)
Copyright 2020 Inanna Malick

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ See [`tracing-honeycomb`](tracing-honeycomb/README.md) for examples.
## License

This project is licensed under the terms of the MIT license

4 changes: 2 additions & 2 deletions tracing-distributed/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ tracing = "0.1.12"
tracing-core = "0.1.9"
tracing-subscriber = "0.2.0"
chrono = "0.4.9"
itertools = "0.8.1"
itertools = "0.9"

[dev-dependencies]
tracing-attributes = "0.1.5"
futures-preview = { version = "0.3.0-alpha.19", features = ["compat"] }
tokio = { version = "0.2", features = ["full"] }
tracing-futures = "0.2.1"
tracing-futures = "0.2.1"
2 changes: 1 addition & 1 deletion tracing-distributed/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![tracing-distributed on crates.io](https://img.shields.io/crates/v/tracing-distributed)](https://crates.io/crates/tracing-distributed) [![Documentation (latest release)](https://docs.rs/tracing-distributed/badge.svg)](https://docs.rs/tracing-distributed/) [![Documentation (master)](https://img.shields.io/badge/docs-master-brightgreen)](https://inanna-malick.github.io/honeycomb-tracing/tracing_distributed/)[![License](https://img.shields.io/badge/license-MIT-green.svg)](../LICENSE)
[![tracing-distributed on crates.io](https://img.shields.io/crates/v/tracing-distributed)](https://crates.io/crates/tracing-distributed) [![Documentation (latest release)](https://docs.rs/tracing-distributed/badge.svg)](https://docs.rs/tracing-distributed/) [![Documentation (master)](https://img.shields.io/badge/docs-master-brightgreen)](https://inanna-malick.github.io/honeycomb-tracing/tracing_distributed/)[![License](https://img.shields.io/badge/license-MIT-green.svg)](../LICENSE)[![CircleCI status](https://circleci.com/gh/inanna-malick/honeycomb-tracing.svg?style=svg)](https://app.circleci.com/pipelines/github/inanna-malick/honeycomb-tracing)

# tracing-distributed

Choose a reason for hiding this comment

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

link to the release docs, master docs, and crates.io here -- all of them have badges. See https://github.com/calibra/cargo-guppy/blob/master/guppy/README.md for an example


Expand Down
2 changes: 1 addition & 1 deletion tracing-distributed/README.tpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![tracing-distributed on crates.io](https://img.shields.io/crates/v/tracing-distributed)](https://crates.io/crates/tracing-distributed) [![Documentation (latest release)](https://docs.rs/tracing-distributed/badge.svg)](https://docs.rs/tracing-distributed/) [![Documentation (master)](https://img.shields.io/badge/docs-master-brightgreen)](https://inanna-malick.github.io/honeycomb-tracing/tracing_distributed/)[![License](https://img.shields.io/badge/license-MIT-green.svg)](../LICENSE)
[![tracing-distributed on crates.io](https://img.shields.io/crates/v/tracing-distributed)](https://crates.io/crates/tracing-distributed) [![Documentation (latest release)](https://docs.rs/tracing-distributed/badge.svg)](https://docs.rs/tracing-distributed/) [![Documentation (master)](https://img.shields.io/badge/docs-master-brightgreen)](https://inanna-malick.github.io/honeycomb-tracing/tracing_distributed/)[![License](https://img.shields.io/badge/license-MIT-green.svg)](../LICENSE)[![CircleCI status](https://circleci.com/gh/inanna-malick/honeycomb-tracing.svg?style=svg)](https://app.circleci.com/pipelines/github/inanna-malick/honeycomb-tracing)

# {{crate}}

Expand Down
1 change: 0 additions & 1 deletion tracing-distributed/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
//! This crate is primarily intended to be used by people implementing their own backends.
//! A concrete implementation using honeycomb.io as a backend is available in the [`tracing-honeycomb` crate](https://crates.io/crates/tracing-honeycomb).


mod telemetry;
mod telemetry_layer;
mod trace;
Expand Down
2 changes: 1 addition & 1 deletion tracing-honeycomb/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ futures-preview = { version = "0.3.0-alpha.19", features = ["compat"] }
tracing-subscriber = "0.2.0"
tokio = { version = "0.2", features = ["full"] }
tracing-futures = "0.2.1"
proptest = "0.9.5"
proptest = "0.9.5"
12 changes: 5 additions & 7 deletions tracing-honeycomb/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![tracing-honeycomb on crates.io](https://img.shields.io/crates/v/tracing-honeycomb)](https://crates.io/crates/tracing-honeycomb) [![Documentation (latest release)](https://docs.rs/tracing-honeycomb/badge.svg)](https://docs.rs/tracing-honeycomb/) [![Documentation (master)](https://img.shields.io/badge/docs-master-brightgreen)](https://inanna-malick.github.io/honeycomb-tracing/tracing_honeycomb/)[![License](https://img.shields.io/badge/license-MIT-green.svg)](../LICENSE)
[![tracing-honeycomb on crates.io](https://img.shields.io/crates/v/tracing-honeycomb)](https://crates.io/crates/tracing-honeycomb) [![Documentation (latest release)](https://docs.rs/tracing-honeycomb/badge.svg)](https://docs.rs/tracing-honeycomb/) [![Documentation (master)](https://img.shields.io/badge/docs-master-brightgreen)](https://inanna-malick.github.io/honeycomb-tracing/tracing_honeycomb/)[![License](https://img.shields.io/badge/license-MIT-green.svg)](../LICENSE)[![CircleCI status](https://circleci.com/gh/inanna-malick/honeycomb-tracing.svg?style=svg)](https://app.circleci.com/pipelines/github/inanna-malick/honeycomb-tracing)

# tracing-honeycomb

Expand All @@ -13,7 +13,7 @@ As a tracing layer, `TelemetryLayer` can be composed with other layers to provid
Add the following to your Cargo.toml to get started.

```toml
tracing-honeycomb = 0.1.0-alpha-1
tracing-honeycomb = "0.1.0-alpha-1"
```

### Propagating distributed tracing metadata
Expand Down Expand Up @@ -46,7 +46,7 @@ let telemetry_layer = mk_honeycomb_tracing_layer("my-service-name", honeycomb_co
// NOTE: the underlying subscriber MUST be the Registry subscriber
let subscriber = registry::Registry::default() // provide underlying span data store
.with(LevelFilter::INFO) // filter out low-level debug tracing (eg tokio executor)
.with(tracing_subscriber::fmt::Layer::builder().finish()) // log to stdout
.with(tracing_subscriber::fmt::Layer::default()) // log to stdout
.with(telemetry_layer); // publish to honeycomb backend


Expand All @@ -55,17 +55,15 @@ tracing::subscriber::set_global_default(subscriber).expect("setting global defau

### Testing

Since `TraceCtx::current_trace_ctx` and `TraceCtx::record_on_current_span` can be expected to return `Ok` as long as some `TelemetryLayer` has been registered as part of the layer/subscriber stack and the current span is active, it's valid to `.expect` them to always succeed & to panic if they do not. However, you probably don't want to publish telemetry while running unit or integration tests.

This library provides a `BlackholeTelemetry` `Telemetry` instance that discards spans and events without publishing them to any backend. Use as:
Since `TraceCtx::current_trace_ctx` and `TraceCtx::record_on_current_span` can be expected to return `Ok` as long as some `TelemetryLayer` has been registered as part of the layer/subscriber stack and the current span is active, it's valid to `.expect` them to always succeed & to panic if they do not. As a result, you may find yourself writing code that fails if no distributed tracing context is present. This means that unit and integration tests covering such code must provide a `TelemetryLayer`. However, you probably don't want to publish telemetry while running unit or integration tests. You can fix this problem by registering a `TelemetryLayer` constructed using `BlackholeTelemetry`. `BlackholeTelemetry` discards spans and events without publishing them to any backend.

```rust
let telemetry_layer = mk_honeycomb_blackhole_tracing_layer();

// NOTE: the underlying subscriber MUST be the Registry subscriber
let subscriber = registry::Registry::default() // provide underlying span data store
.with(LevelFilter::INFO) // filter out low-level debug tracing (eg tokio executor)
.with(tracing_subscriber::fmt::Layer::builder().finish()) // log to stdout
.with(tracing_subscriber::fmt::Layer::default()) // log to stdout
.with(telemetry_layer); // publish to blackhole backend

tracing::subscriber::set_global_default(subscriber).expect("setting global default failed");
Expand Down
12 changes: 5 additions & 7 deletions tracing-honeycomb/README.tpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![tracing-honeycomb on crates.io](https://img.shields.io/crates/v/tracing-honeycomb)](https://crates.io/crates/tracing-honeycomb) [![Documentation (latest release)](https://docs.rs/tracing-honeycomb/badge.svg)](https://docs.rs/tracing-honeycomb/) [![Documentation (master)](https://img.shields.io/badge/docs-master-brightgreen)](https://inanna-malick.github.io/honeycomb-tracing/tracing_honeycomb/)[![License](https://img.shields.io/badge/license-MIT-green.svg)](../LICENSE)
[![tracing-honeycomb on crates.io](https://img.shields.io/crates/v/tracing-honeycomb)](https://crates.io/crates/tracing-honeycomb) [![Documentation (latest release)](https://docs.rs/tracing-honeycomb/badge.svg)](https://docs.rs/tracing-honeycomb/) [![Documentation (master)](https://img.shields.io/badge/docs-master-brightgreen)](https://inanna-malick.github.io/honeycomb-tracing/tracing_honeycomb/)[![License](https://img.shields.io/badge/license-MIT-green.svg)](../LICENSE)[![CircleCI status](https://circleci.com/gh/inanna-malick/honeycomb-tracing.svg?style=svg)](https://app.circleci.com/pipelines/github/inanna-malick/honeycomb-tracing)

# {{crate}}

Expand All @@ -9,7 +9,7 @@
Add the following to your Cargo.toml to get started.

```toml
tracing-honeycomb = {{version}}
tracing-honeycomb = "{{version}}"
```

### Propagating distributed tracing metadata
Expand Down Expand Up @@ -42,7 +42,7 @@ let telemetry_layer = mk_honeycomb_tracing_layer("my-service-name", honeycomb_co
// NOTE: the underlying subscriber MUST be the Registry subscriber
let subscriber = registry::Registry::default() // provide underlying span data store
.with(LevelFilter::INFO) // filter out low-level debug tracing (eg tokio executor)
.with(tracing_subscriber::fmt::Layer::builder().finish()) // log to stdout
.with(tracing_subscriber::fmt::Layer::default()) // log to stdout
.with(telemetry_layer); // publish to honeycomb backend


Expand All @@ -51,17 +51,15 @@ tracing::subscriber::set_global_default(subscriber).expect("setting global defau

### Testing

Since `TraceCtx::current_trace_ctx` and `TraceCtx::record_on_current_span` can be expected to return `Ok` as long as some `TelemetryLayer` has been registered as part of the layer/subscriber stack and the current span is active, it's valid to `.expect` them to always succeed & to panic if they do not. However, you probably don't want to publish telemetry while running unit or integration tests.

This library provides a `BlackholeTelemetry` `Telemetry` instance that discards spans and events without publishing them to any backend. Use as:
Since `TraceCtx::current_trace_ctx` and `TraceCtx::record_on_current_span` can be expected to return `Ok` as long as some `TelemetryLayer` has been registered as part of the layer/subscriber stack and the current span is active, it's valid to `.expect` them to always succeed & to panic if they do not. As a result, you may find yourself writing code that fails if no distributed tracing context is present. This means that unit and integration tests covering such code must provide a `TelemetryLayer`. However, you probably don't want to publish telemetry while running unit or integration tests. You can fix this problem by registering a `TelemetryLayer` constructed using `BlackholeTelemetry`. `BlackholeTelemetry` discards spans and events without publishing them to any backend.

```rust
let telemetry_layer = mk_honeycomb_blackhole_tracing_layer();

// NOTE: the underlying subscriber MUST be the Registry subscriber
let subscriber = registry::Registry::default() // provide underlying span data store
.with(LevelFilter::INFO) // filter out low-level debug tracing (eg tokio executor)
.with(tracing_subscriber::fmt::Layer::builder().finish()) // log to stdout
.with(tracing_subscriber::fmt::Layer::default()) // log to stdout
.with(telemetry_layer); // publish to blackhole backend

tracing::subscriber::set_global_default(subscriber).expect("setting global default failed");
Expand Down
2 changes: 1 addition & 1 deletion tracing-honeycomb/examples/async_tracing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ fn register_global_subscriber() {

let subscriber = registry::Registry::default() // provide underlying span data store
.with(LevelFilter::INFO) // filter out low-level debug tracing (eg tokio executor)
.with(tracing_subscriber::fmt::Layer::builder().finish()) // log to stdout
.with(tracing_subscriber::fmt::Layer::default()) // log to stdout
.with(telemetry_layer); // publish to honeycomb backend

tracing::subscriber::set_global_default(subscriber).expect("setting global default failed");
Expand Down
1 change: 1 addition & 0 deletions tracing-honeycomb/src/honeycomb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ mod test {
use proptest::prelude::*;
proptest! {
#[test]
// ua is [1..] and not [0..] because 0 is not a valid tracing::Id (tracing::from_u64 throws on 0)
fn span_id_round_trip(ua in 1u64.., ub in 1u64..) {
inanna-malick marked this conversation as resolved.
Show resolved Hide resolved
let span_id = SpanId {
tracing_id: tracing::Id::from_u64(ua),
Expand Down