Skip to content

Commit

Permalink
chore: bump 0.6.4 (#205)
Browse files Browse the repository at this point in the history
* chore: refactor things

Signed-off-by: Andy Lok <[email protected]>

* fix

Signed-off-by: Andy Lok <[email protected]>

* fix

Signed-off-by: Andy Lok <[email protected]>

* bump 0.6.4

Signed-off-by: Andy Lok <[email protected]>

---------

Signed-off-by: Andy Lok <[email protected]>
  • Loading branch information
andylokandy authored Feb 8, 2024
1 parent 9194409 commit 71b8010
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 38 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

## Unreleased

## v0.6.4

- Add `LocalSpan::add_property` and `LocalSpan::add_properties`.
- Add `Config::report_before_root_finish`.
- Add new crate `minitrace-futures`.

## v0.6.3

Expand Down
11 changes: 11 additions & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
Thanks to the following for their help and contributions to minitrace-rust:

0xd34d10cc
Andy Lok
Brian Anderson
Dotan Simha
iGxnon
Jiang Yinzuo
Jonathan Chuang
Mark Van de Vyver
piercetrey-figure
Renkai Ge
Stephen Cirner
shota kizawa
TennyZhuang
Wenxuan
Xuanwo
xxchan
Yilin Chen
Zhenchi
4 changes: 2 additions & 2 deletions minitrace-datadog/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "minitrace-datadog"
version = "0.6.3"
version = "0.6.4"
authors = ["The TiKV Project Authors"]
license = "Apache-2.0"
edition = "2021"
Expand All @@ -14,7 +14,7 @@ keywords = ["tracing", "span", "datadog", "jaeger", "opentelemetry"]

[dependencies]
log = "0.4"
minitrace = { version = "0.6.3", path = "../minitrace" }
minitrace = { version = "0.6.4", path = "../minitrace" }
reqwest = { version = "0.11", features = ["blocking"] }
rmp-serde = "1"
serde = { version = "1", features = ["derive"] }
Expand Down
11 changes: 6 additions & 5 deletions minitrace-futures/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
[package]
name = "minitrace-futures"
version = "0.6.3"
edition = "2021"
version = "0.6.4"
authors = ["The TiKV Project Authors"]
license = "Apache-2.0"
description = "Utilities for instrumenting `futures` with minitrace-rust"
edition = "2021"
description = "Utilities for tracing `futures` with minitrace-rust"
homepage = "https://github.com/tikv/minitrace-rust"
repository = "https://github.com/tikv/minitrace-rust"
documentation = "https://docs.rs/minitrace-futures"
readme = "README.md"
categories = ["development-tools::debugging"]
keywords = ["tracing", "span", "datadog", "jaeger", "opentelemetry"]
keywords = ["tracing", "span", "futures", "jaeger", "opentelemetry"]

[dependencies]
futures = "0.3"
minitrace = { version = "0.6.3", path = "../minitrace" }
minitrace = { version = "0.6.4", path = "../minitrace" }
pin-project-lite = "0.2.13"

[dev-dependencies]
Expand Down
1 change: 1 addition & 0 deletions minitrace-futures/LICENSE
2 changes: 1 addition & 1 deletion minitrace-futures/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
[![Crates.io](https://img.shields.io/crates/v/minitrace-futures.svg)](https://crates.io/crates/minitrace-futures)
[![LICENSE](https://img.shields.io/github/license/tikv/minitrace-rust.svg)](https://github.com/tikv/minitrace-rust/blob/master/LICENSE)

Some utilities for instrumenting `futures` with [`minitrace`](https://crates.io/crates/minitrace).
Some utilities for tracing `futures` with [`minitrace`](https://crates.io/crates/minitrace).
44 changes: 25 additions & 19 deletions minitrace-futures/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright 2024 TiKV Project Authors. Licensed under Apache-2.0.

#![doc = include_str!("../README.md")]

use std::pin::Pin;
Expand All @@ -9,14 +11,8 @@ use futures::Stream;
use minitrace::Span;
use pin_project_lite::pin_project;

// There is no boundary in order to support types that
// implement both stream and sink.
impl<T> Instrumented for T {}

/// Instrument [`futures::Stream`]s and [`futures::Sink`]s.
pub trait Instrumented: Sized {
/// For [`Stream`]s :
///
/// An extension trait for [`futures::Stream`] that provides tracing instrument adapters.
pub trait StreamExt: futures::Stream + Sized {
/// Binds a [`Span`] to the [`Stream`] that continues to record until the stream is **finished**.
///
/// In addition, it sets the span as the local parent at every poll so that [`minitrace::local::LocalSpan`]
Expand All @@ -31,28 +27,36 @@ pub trait Instrumented: Sized {
/// use async_stream::stream;
/// use futures::StreamExt;
/// use minitrace::prelude::*;
/// use minitrace_futures::*;
/// use minitrace_futures::StreamExt as _;
///
/// let root = Span::root("Root", SpanContext::random());
/// let root = Span::root("root", SpanContext::random());
/// let s = stream! {
/// for i in 0..2 {
/// yield i;
/// }
/// }
/// .in_span(Span::enter_with_parent("Task", &root));
/// .in_span(Span::enter_with_parent("task", &root));
///
/// tokio::pin!(s);
///
/// assert_eq!(s.next().await.unwrap(), 0);
/// assert_eq!(s.next().await.unwrap(), 1);
/// assert_eq!(s.next().await, None);
/// // span ends here.
///
/// # }
/// ```
///
/// For [`Sink`]s :
///
fn in_span(self, span: Span) -> InSpan<Self> {
InSpan {
inner: self,
span: Some(span),
}
}
}

impl<T> StreamExt for T where T: futures::Stream {}

/// An extension trait for [`futures::Sink`] that provides tracing instrument adapters.
pub trait SinkExt<Item>: futures::Sink<Item> + Sized {
/// Binds a [`Span`] to the [`Sink`] that continues to record until the sink is **closed**.
///
/// In addition, it sets the span as the local parent at every poll so that [`minitrace::local::LocalSpan`]
Expand All @@ -67,17 +71,16 @@ pub trait Instrumented: Sized {
/// use futures::sink;
/// use futures::sink::SinkExt;
/// use minitrace::prelude::*;
/// use minitrace_futures::*;
/// use minitrace_futures::SinkExt as _;
///
/// let root = Span::root("Root", SpanContext::random());
/// let root = Span::root("root", SpanContext::random());
///
/// let mut drain = sink::drain().in_span(Span::enter_with_parent("Task", &root));
/// let mut drain = sink::drain().in_span(Span::enter_with_parent("task", &root));
///
/// drain.send(1).await.unwrap();
/// drain.send(2).await.unwrap();
/// drain.close().await.unwrap();
/// // span ends here.
///
/// # }
/// ```
fn in_span(self, span: Span) -> InSpan<Self> {
Expand All @@ -88,7 +91,10 @@ pub trait Instrumented: Sized {
}
}

impl<T, Item> SinkExt<Item> for T where T: futures::Sink<Item> {}

pin_project! {
/// Adapter for [`StreamExt::in_span()`](StreamExt::in_span) and [`SinkExt::in_span()`](SinkExt::in_span).
pub struct InSpan<T> {
#[pin]
inner: T,
Expand Down
4 changes: 2 additions & 2 deletions minitrace-jaeger/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "minitrace-jaeger"
version = "0.6.3"
version = "0.6.4"
authors = ["The TiKV Project Authors"]
license = "Apache-2.0"
edition = "2021"
Expand All @@ -14,7 +14,7 @@ keywords = ["tracing", "span", "datadog", "jaeger", "opentelemetry"]

[dependencies]
log = "0.4"
minitrace = { version = "0.6.3", path = "../minitrace" }
minitrace = { version = "0.6.4", path = "../minitrace" }
thrift_codec = "0.2"

[dev-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions minitrace-macro/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "minitrace-macro"
version = "0.6.3"
version = "0.6.4"
authors = ["The TiKV Project Authors"]
license = "Apache-2.0"
edition = "2021"
Expand All @@ -24,7 +24,7 @@ syn = { version = "1.0.84", features = ["full", "parsing", "extra-traits", "proc

[dev-dependencies]
logcall = "0.1.4"
minitrace = { version = "0.6.3", path = "../minitrace" }
minitrace = { version = "0.6.4", path = "../minitrace" }
tokio = { version = "1", features = ["full"] }
trybuild = "1"
# The procedural macro `trace` only supports async-trait higher than 0.1.52
Expand Down
4 changes: 2 additions & 2 deletions minitrace-opentelemetry/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "minitrace-opentelemetry"
version = "0.6.3"
version = "0.6.4"
authors = ["The TiKV Project Authors"]
license = "Apache-2.0"
edition = "2021"
Expand All @@ -15,7 +15,7 @@ keywords = ["tracing", "span", "datadog", "jaeger", "opentelemetry"]
[dependencies]
futures = { version = "0.3", features = ["executor"] }
log = "0.4"
minitrace = { version = "0.6.3", path = "../minitrace" }
minitrace = { version = "0.6.4", path = "../minitrace" }
opentelemetry = { version = "0.21", features = ["trace"] }
opentelemetry_sdk = { version = "0.21", features = ["trace"] }

Expand Down
10 changes: 5 additions & 5 deletions minitrace/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "minitrace"
version = "0.6.3"
version = "0.6.4"
authors = ["The TiKV Project Authors"]
license = "Apache-2.0"
edition = "2021"
Expand All @@ -17,7 +17,7 @@ enable = []

[dependencies]
futures = "0.3"
minitrace-macro = { version = "0.6.3", path = "../minitrace-macro" }
minitrace-macro = { version = "0.6.4", path = "../minitrace-macro" }
minstant = "0.1"
parking_lot = "0.12"
pin-project = "1"
Expand All @@ -37,9 +37,9 @@ futures-timer = "3"
log = "0.4"
logcall = "0.1.4"
minitrace = { path = ".", features = ["enable"] }
minitrace-datadog = { version = "0.6.3", path = "../minitrace-datadog" }
minitrace-jaeger = { version = "0.6.3", path = "../minitrace-jaeger" }
minitrace-opentelemetry = { version = "0.6.3", path = "../minitrace-opentelemetry" }
minitrace-datadog = { version = "0.6.4", path = "../minitrace-datadog" }
minitrace-jaeger = { version = "0.6.4", path = "../minitrace-jaeger" }
minitrace-opentelemetry = { version = "0.6.4", path = "../minitrace-opentelemetry" }
mockall = "0.11"
once_cell = "1"
opentelemetry = { version = "0.21", features = ["trace"] }
Expand Down

0 comments on commit 71b8010

Please sign in to comment.