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

chore: add crates to workspace #226

Closed
wants to merge 2 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
35 changes: 26 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@
[workspace]
resolver = "2"
members = [
"minitrace",
"minitrace-macro",
"minitrace-jaeger",
"minitrace-datadog",
"minitrace-opentelemetry",
"minitrace-futures",
"test-statically-disable",
"minitrace",
"minitrace-macro",
"minitrace-jaeger",
"minitrace-datadog",
"minitrace-opentelemetry",
"minitrace-futures",
"test-statically-disable",
]
resolver = "2"

[workspace.package]
authors = ["The TiKV Project Authors"]
categories = ["development-tools::debugging"]
edition = "2021"
homepage = "https://github.com/tikv/minitrace-rust"
license = "Apache-2.0"
repository = "https://github.com/tikv/minitrace-rust"
version = "0.6.7"

[workspace.dependencies]
minitrace = { path = "minitrace" }
minitrace-datadog = { path = "minitrace-datadog" }
minitrace-futures = { path = "minitrace-futures" }
minitrace-jaeger = { path = "minitrace-jaeger" }
minitrace-macro = { path = "minitrace-macro" }
minitrace-opentelemetry = { path = "minitrace-opentelemetry" }

[profile.bench]
opt-level = 3
lto = true
opt-level = 3
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div align="center">

![minitrace: Extremely fast tracing library for Rust](etc/img/head-img-640.svg)
![minitrace: Extremely fast tracing library for Rust](https://raw.githubusercontent.com/tikv/minitrace-rust/master/etc/img/head-img-640.svg)

[![Crates.io](https://img.shields.io/crates/v/minitrace.svg?style=flat-square&logo=rust)](https://crates.io/crates/minitrace)
[![Documentation](https://img.shields.io/docsrs/minitrace?style=flat-square&logo=rust)](https://docs.rs/minitrace/)
Expand All @@ -13,7 +13,7 @@

minitrace is a tracing library [10~100x faster](#benchmarks) than others:

![benchmark](etc/img/head-benchmark.svg)
![benchmark](https://raw.githubusercontent.com/tikv/minitrace-rust/master/etc/img/head-benchmark.svg)

Features:

Expand Down Expand Up @@ -128,6 +128,7 @@ Feel free to open a PR and add your projects here:
- [Conductor](https://github.com/the-guild-org/conductor): Open-source GraphQL Gateway
- [Apache OpenDAL](https://github.com/apache/opendal): A data access layer for various storage
- [Databend](https://github.com/datafuselabs/databend): Cost-Effective alternative to Snowflake
- [foyer](https://github.com/mrcroxx/foyer): Hybrid in-memory and disk cache in Rust

## FAQ

Expand Down
21 changes: 11 additions & 10 deletions minitrace-datadog/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
[package]
name = "minitrace-datadog"
version = "0.6.7"
authors = ["The TiKV Project Authors"]
license = "Apache-2.0"
edition = "2021"
description = "Datadog reporter for minitrace-rust"
homepage = "https://github.com/tikv/minitrace-rust"
repository = "https://github.com/tikv/minitrace-rust"
documentation = "https://docs.rs/minitrace-datadog"
readme = "README.md"
categories = ["development-tools::debugging"]
keywords = ["tracing", "span", "datadog", "jaeger", "opentelemetry"]
name = "minitrace-datadog"
readme = "README.md"

authors = { workspace = true }
categories = { workspace = true }
edition = { workspace = true }
homepage = { workspace = true }
license = { workspace = true }
repository = { workspace = true }
version = { workspace = true }

[dependencies]
log = "0.4"
minitrace = { version = "0.6.7", path = "../minitrace" }
minitrace = { workspace = true }
reqwest = { version = "0.11", features = ["blocking"] }
rmp-serde = "1"
serde = { version = "1", features = ["derive"] }
Expand Down
21 changes: 11 additions & 10 deletions minitrace-futures/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
[package]
name = "minitrace-futures"
version = "0.6.7"
authors = ["The TiKV Project Authors"]
license = "Apache-2.0"
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", "futures", "jaeger", "opentelemetry"]
name = "minitrace-futures"
readme = "README.md"

authors = { workspace = true }
categories = { workspace = true }
edition = { workspace = true }
homepage = { workspace = true }
license = { workspace = true }
repository = { workspace = true }
version = { workspace = true }

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

[dev-dependencies]
Expand Down
21 changes: 11 additions & 10 deletions minitrace-jaeger/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
[package]
name = "minitrace-jaeger"
version = "0.6.7"
authors = ["The TiKV Project Authors"]
license = "Apache-2.0"
edition = "2021"
description = "Jaeger reporter for minitrace-rust"
homepage = "https://github.com/tikv/minitrace-rust"
repository = "https://github.com/tikv/minitrace-rust"
documentation = "https://docs.rs/minitrace-jaeger"
readme = "README.md"
categories = ["development-tools::debugging"]
keywords = ["tracing", "span", "datadog", "jaeger", "opentelemetry"]
name = "minitrace-jaeger"
readme = "README.md"

authors = { workspace = true }
categories = { workspace = true }
edition = { workspace = true }
homepage = { workspace = true }
license = { workspace = true }
repository = { workspace = true }
version = { workspace = true }

[dependencies]
log = "0.4"
minitrace = { version = "0.6.7", path = "../minitrace" }
minitrace = { workspace = true }
thrift_codec = "0.3"

[dev-dependencies]
Expand Down
29 changes: 18 additions & 11 deletions minitrace-macro/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
[package]
name = "minitrace-macro"
version = "0.6.7"
authors = ["The TiKV Project Authors"]
license = "Apache-2.0"
edition = "2021"
description = "Attribute procedural macro for minitrace-rust"
homepage = "https://github.com/tikv/minitrace-rust"
repository = "https://github.com/tikv/minitrace-rust"
documentation = "https://docs.rs/minitrace-macro"
readme = "README.md"
categories = ["development-tools::debugging"]
keywords = ["tracing", "span", "datadog", "jaeger", "opentelemetry"]
name = "minitrace-macro"
readme = "README.md"

authors = { workspace = true }
categories = { workspace = true }
edition = { workspace = true }
homepage = { workspace = true }
license = { workspace = true }
repository = { workspace = true }
version = { workspace = true }

[lib]
proc-macro = true
Expand All @@ -20,11 +21,17 @@ proc-macro = true
proc-macro-error = "1"
proc-macro2 = "1"
quote = "1"
syn = { version = "1.0.84", features = ["full", "parsing", "extra-traits", "proc-macro", "visit-mut"] }
syn = { version = "1.0.84", features = [
"full",
"parsing",
"extra-traits",
"proc-macro",
"visit-mut",
] }

[dev-dependencies]
logcall = "0.1.4"
minitrace = { version = "0.6.7", path = "../minitrace" }
minitrace = { workspace = true }
tokio = { version = "1", features = ["full"] }
trybuild = "1"
# The procedural macro `trace` only supports async-trait higher than 0.1.52
Expand Down
23 changes: 12 additions & 11 deletions minitrace-opentelemetry/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
[package]
name = "minitrace-opentelemetry"
version = "0.6.7"
authors = ["The TiKV Project Authors"]
license = "Apache-2.0"
edition = "2021"
description = "Opentelemetry reporter for minitrace-rust"
homepage = "https://github.com/tikv/minitrace-rust"
repository = "https://github.com/tikv/minitrace-rust"
documentation = "https://docs.rs/minitrace-jaeger"
readme = "README.md"
categories = ["development-tools::debugging"]
documentation = "https://docs.rs/minitrace-opentelemetry"
keywords = ["tracing", "span", "datadog", "jaeger", "opentelemetry"]
name = "minitrace-opentelemetry"
readme = "README.md"

authors = { workspace = true }
categories = { workspace = true }
edition = { workspace = true }
homepage = { workspace = true }
license = { workspace = true }
repository = { workspace = true }
version = { workspace = true }

[dependencies]
futures = { version = "0.3", features = ["executor"] }
log = "0.4"
minitrace = { version = "0.6.7", path = "../minitrace" }
minitrace = { workspace = true }
opentelemetry = { version = "0.23", features = ["trace"] }
opentelemetry_sdk = { version = "0.23", features = ["trace"] }

Expand Down
41 changes: 23 additions & 18 deletions minitrace/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
[package]
name = "minitrace"
version = "0.6.7"
authors = ["The TiKV Project Authors"]
license = "Apache-2.0"
edition = "2021"
categories = ["development-tools::debugging"]
description = "A high-performance timeline tracing library for Rust"
homepage = "https://github.com/tikv/minitrace-rust"
repository = "https://github.com/tikv/minitrace-rust"
documentation = "https://docs.rs/minitrace"
readme = "../README.md"
categories = ["development-tools::debugging"]
edition = "2021"
homepage = "https://github.com/tikv/minitrace-rust"
keywords = ["tracing", "span", "datadog", "jaeger", "opentelemetry"]
license = "Apache-2.0"
name = "minitrace"
readme = "../README.md"
repository = "https://github.com/tikv/minitrace-rust"
version = "0.6.7"

[features]
enable = []

[dependencies]
minitrace-macro = { version = "0.6.7", path = "../minitrace-macro" }
minitrace-macro = { workspace = true }
minstant = "0.1.7"
parking_lot = "0.12"
pin-project = "1"
Expand All @@ -35,10 +35,10 @@ futures = "0.3"
futures-timer = "3"
log = "0.4"
logcall = "0.1.4"
minitrace = { path = ".", features = ["enable"] }
minitrace-datadog = { version = "0.6.7", path = "../minitrace-datadog" }
minitrace-jaeger = { version = "0.6.7", path = "../minitrace-jaeger" }
minitrace-opentelemetry = { version = "0.6.7", path = "../minitrace-opentelemetry" }
minitrace = { workspace = true, features = ["enable"] }
minitrace-datadog = { workspace = true }
minitrace-jaeger = { workspace = true }
minitrace-opentelemetry = { workspace = true }
mockall = "0.12"
once_cell = "1"
opentelemetry = { version = "0.23", features = ["trace"] }
Expand All @@ -48,24 +48,29 @@ rand = "0.8"
rustracing = "0.6"
serial_test = "3"
test-harness = "0.2"
tokio = { version = "1", features = ["rt", "time", "macros", "rt-multi-thread"] }
tokio = { version = "1", features = [
"rt",
"time",
"macros",
"rt-multi-thread",
] }
tracing = "0.1"
tracing-core = "0.1"
tracing-opentelemetry = "0.24"
tracing-subscriber = "0.3"

[[bench]]
name = "trace"
harness = false
name = "trace"

[[bench]]
name = "compare"
harness = false
name = "compare"

[[bench]]
name = "spsc"
harness = false
name = "spsc"

[[bench]]
name = "object_pool"
harness = false
name = "object_pool"
4 changes: 2 additions & 2 deletions minitrace/src/collector/console_reporter.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2023 TiKV Project Authors. Licensed under Apache-2.0.

use super::global_collector::Reporter;
use super::SpanRecord;
use crate::collector::global_collector::Reporter;
use crate::collector::SpanRecord;

/// A console reporter that prints span records to the stderr.
pub struct ConsoleReporter;
Expand Down
1 change: 0 additions & 1 deletion minitrace/src/collector/global_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ pub(crate) struct GlobalCollector {
}

impl GlobalCollector {
#[allow(unreachable_code)]
fn start(reporter: impl Reporter, config: Config) {
let global_collector = GlobalCollector {
config,
Expand Down
9 changes: 9 additions & 0 deletions minitrace/src/collector/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,15 @@ impl Config {
/// consider reducing the report interval, potentially down to zero, to prevent losing spans.
///
/// The default value is 10 milliseconds.
///
/// # Examples
///
/// ```
/// use minitrace::collector::Config;
///
/// let config = Config::default().report_interval(std::time::Duration::from_millis(100));
/// minitrace::set_reporter(minitrace::collector::ConsoleReporter, config);
/// ```
pub fn report_interval(self, report_interval: Duration) -> Self {
Self {
report_interval,
Expand Down
4 changes: 2 additions & 2 deletions minitrace/src/collector/test_reporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use std::sync::Arc;

use parking_lot::Mutex;

use super::global_collector::Reporter;
use super::SpanRecord;
use crate::collector::global_collector::Reporter;
use crate::collector::SpanRecord;

pub struct TestReporter {
pub spans: Arc<Mutex<Vec<SpanRecord>>>,
Expand Down
10 changes: 4 additions & 6 deletions minitrace/src/span.rs
Original file line number Diff line number Diff line change
Expand Up @@ -519,11 +519,9 @@ impl Drop for LocalParentGuard {
let (spans, token) = inner.collector.collect_spans_and_token();
debug_assert!(token.is_some());
if let Some(token) = token {
if !spans.spans.is_empty() {
inner
.collect
.submit_spans(SpanSet::LocalSpansInner(spans), token);
}
inner
.collect
.submit_spans(SpanSet::LocalSpansInner(spans), token);
}
}
}
Expand Down Expand Up @@ -913,7 +911,7 @@ parent5 []
.in_sequence(&mut seq)
.return_const(42_usize);
mock.expect_submit_spans()
.times(4)
.times(5)
.in_sequence(&mut seq)
.withf(|_, collect_token| collect_token.len() == 1 && collect_token[0].collect_id == 42)
.returning({
Expand Down
Loading
Loading