diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..fd95893 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,11 @@ +root = true + +[*] +end_of_line = lf +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true + +[*.toml] +indent_size = tab +tab_width = 2 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d3d3752..1c469b7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,27 +25,27 @@ jobs: with: toolchain: ${{ matrix.rust }} components: rustfmt, clippy - + - name: Check format if: ${{ matrix.rust == 'nightly' }} run: cargo fmt --all -- --check - + - name: Check clippy if: ${{ matrix.rust == 'nightly' }} run: cargo clippy --all-targets --all-features -- --deny warnings - + - name: Build run: cargo build --workspace --all-targets - + - name: Run tests run: | cargo test --workspace --all-targets -- --nocapture cargo test --doc - - # Github Action sometimes run out of resources to run benches + + # GitHub Action sometimes run out of resources to run benches # - name: Run benches # run: cargo bench --workspace --bench compare --bench trace - + - name: Run examples run: | cargo run --example asynchronous diff --git a/Cargo.toml b/Cargo.toml index 3b9b404..dbb7fea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,20 +11,26 @@ members = [ resolver = "2" [workspace.package] -authors = ["fastrace authors"] +authors = ["Fastrace Authors"] edition = "2021" -homepage = "https://github.com/fastracelabs/fastrace" license = "Apache-2.0" repository = "https://github.com/fastracelabs/fastrace" -version = "0.6.8" [workspace.dependencies] -fastrace = { version = "0.6.8", path = "fastrace" } -fastrace-datadog = { version = "0.6.8", path = "fastrace-datadog" } -fastrace-futures = { version = "0.6.8", path = "fastrace-futures" } -fastrace-jaeger = { version = "0.6.8", path = "fastrace-jaeger" } -fastrace-macro = { version = "0.6.8", path = "fastrace-macro" } -fastrace-opentelemetry = { version = "0.6.8", path = "fastrace-opentelemetry" } +# workspace dependencies +fastrace = { version = "0.7.0", path = "fastrace" } +fastrace-macro = { version = "0.7.0", path = "fastrace-macro" } + +# workspace leaves +fastrace-datadog = { path = "fastrace-datadog" } +fastrace-futures = { path = "fastrace-futures" } +fastrace-jaeger = { path = "fastrace-jaeger" } +fastrace-opentelemetry = { path = "fastrace-opentelemetry" } + +# crates.io dependencies +futures = { version = "0.3" } +log = { version = "0.4" } +serde = { version = "1.0", features = ["derive"] } [profile.bench] lto = true diff --git a/README.md b/README.md index af2f2bf..b217706 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Libraries should include `fastrace` as a dependency without enabling any extra f ```toml [dependencies] -fastrace = "0.6" +fastrace = "0.7" ``` Add a `trace` attribute to the function you want to trace. In this example, a `SpanRecord` will be collected every time the function is called, if a tracing context is set up by the caller. @@ -65,7 +65,7 @@ Applications should include `fastrace` as a dependency with the `enable` feature ```toml [dependencies] -fastrace = { version = "0.6", features = ["enable"] } +fastrace = { version = "0.7", features = ["enable"] } ``` Applications should initialize a `Reporter` implementation early in the program's runtime. Span records generated before the reporter is initialized will be ignored. Before terminating, `flush()` should be called to ensure all collected span records are reported. @@ -97,10 +97,10 @@ fn main() { ![Benchmark result by architecture](etc/img/benchmark-arch.svg) -| | x86-64 (Intel Broadwell) | x86-64 (Intel Skylake) | x86-64 (AMD Zen) | ARM (AWS Graviton2) | -|----------------------|--------------------------|------------------------|------------------|---------------------| -| tokio-tracing | 124x slower | 33x slower | 36x slower | 29x slower | -| rustracing | 45x slower | 10x slower | 11x slower | 9x slower | +| | x86-64 (Intel Broadwell) | x86-64 (Intel Skylake) | x86-64 (AMD Zen) | ARM (AWS Graviton2) | +|---------------------|--------------------------|------------------------|------------------|---------------------| +| tokio-tracing | 124x slower | 33x slower | 36x slower | 29x slower | +| rustracing | 45x slower | 10x slower | 11x slower | 9x slower | | fastrace (baseline) | 1x (3.4us) | 1x (3.2us) | 1x (3.8us) | 1x (4.2us) | **By creating different number of spans:** @@ -149,10 +149,10 @@ For example, fastrace doesn't introduce new logging macros, e.g. `info!()` or `e ### Will fastrace incorporate 'level' for spans? -The concept of 'level' may not be an optimal feature for tracing systems. While `tokio-tracing` incorporates this feature, the underlying motivation for having levels in a span primarily revolves around performance. More specifically, it relates to the performance implications of tracing elements that are not of interest. However, tracing differs from logging in two key aspects: +The concept of 'level' may not be an optimal feature for tracing systems. While `tokio-tracing` incorporates this feature, the underlying motivation for having levels in a span primarily revolves around performance. More specifically, it relates to the performance implications of tracing elements that are not of interest. However, tracing differs from logging in two key aspects: -1. Disregarding a low-level span might inadvertently discard a high-level child span. -2. The process of filtering, or 'level' as it's often called, in a tracing system should be applied to a trace as a whole rather than individual spans within a trace. +1. Disregarding a low-level span might inadvertently discard a high-level child span. +2. The process of filtering, or 'level' as it's often called, in a tracing system should be applied to a trace as a whole rather than individual spans within a trace. In this context, fastrace offers a more efficient solution by filtering out entire traces that are not of interest through its unique tail-sampling design. Therefore, the concept of 'level', borrowed directly from logging systems, may not be suitable for fastrace. @@ -160,13 +160,13 @@ In this context, fastrace offers a more efficient solution by filtering out enti fastrace is focused on high performance tracing only. You can open an issue for the missing tracing features you want to have. -Note that we always prioritize performance over features, so that not all tracing feature requests may be accepted. +Note that we always prioritize performance over features, so that not all tracing feature requests may be accepted. ### What's the status of this library? -**API Unstable**: The API is not stabilized yet, may be changed in the future. +**API Unstable**: The API is not stabilized yet, may be changed in the future. -**Code base Tested**: fastrace has been tested with high coverage. However, applications utilizing fastrace have not been widely deployed, so that fastrace is currently **NOT** regarded as battle-tested. +**Code base Tested**: fastrace has been tested with high coverage. However, applications utilizing fastrace have not been widely deployed, so that fastrace is currently **NOT** regarded as battle-tested. [Docs]: https://docs.rs/fastrace/ [Examples]: fastrace/examples diff --git a/fastrace-datadog/Cargo.toml b/fastrace-datadog/Cargo.toml index 6a973e9..d9c9326 100644 --- a/fastrace-datadog/Cargo.toml +++ b/fastrace-datadog/Cargo.toml @@ -1,24 +1,24 @@ [package] +name = "fastrace-datadog" +version = "0.7.0" + categories = ["development-tools::debugging"] description = "Datadog reporter for fastrace" documentation = "https://docs.rs/fastrace-datadog" keywords = ["tracing", "span", "datadog", "jaeger", "opentelemetry"] -name = "fastrace-datadog" readme = "README.md" -authors = { workspace = true } -edition = { workspace = true } -homepage = { workspace = true } -license = { workspace = true } -repository = { workspace = true } -version = { workspace = true } +authors.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true [dependencies] fastrace = { workspace = true } -log = "0.4" +log = { workspace = true } reqwest = { version = "0.12", features = ["blocking"] } rmp-serde = "1.3" -serde = { version = "1.0", features = ["derive"] } +serde = { workspace = true } [dev-dependencies] -futures = "0.3" +futures = { workspace = true } diff --git a/fastrace-futures/Cargo.toml b/fastrace-futures/Cargo.toml index d02ecd9..39760e9 100644 --- a/fastrace-futures/Cargo.toml +++ b/fastrace-futures/Cargo.toml @@ -1,21 +1,21 @@ [package] +name = "fastrace-futures" +version = "0.7.0" + categories = ["development-tools::debugging"] description = "Utilities for tracing `futures` with fastrace" documentation = "https://docs.rs/fastrace-futures" keywords = ["tracing", "span", "futures", "jaeger", "opentelemetry"] -name = "fastrace-futures" readme = "README.md" -authors = { workspace = true } -edition = { workspace = true } -homepage = { workspace = true } -license = { workspace = true } -repository = { workspace = true } -version = { workspace = true } +authors.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true [dependencies] fastrace = { workspace = true } -futures = "0.3" +futures = { workspace = true } pin-project-lite = "0.2" [dev-dependencies] diff --git a/fastrace-jaeger/Cargo.toml b/fastrace-jaeger/Cargo.toml index 43fded3..4a0acde 100644 --- a/fastrace-jaeger/Cargo.toml +++ b/fastrace-jaeger/Cargo.toml @@ -1,22 +1,22 @@ [package] +name = "fastrace-jaeger" +version = "0.7.0" + categories = ["development-tools::debugging"] description = "Jaeger reporter for fastrace" documentation = "https://docs.rs/fastrace-jaeger" keywords = ["tracing", "span", "datadog", "jaeger", "opentelemetry"] -name = "fastrace-jaeger" readme = "README.md" -authors = { workspace = true } -edition = { workspace = true } -homepage = { workspace = true } -license = { workspace = true } -repository = { workspace = true } -version = { workspace = true } +authors.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true [dependencies] fastrace = { workspace = true } -log = "0.4" +log = { workspace = true } thrift_codec = "0.3" [dev-dependencies] -futures = "0.3" +futures = { workspace = true } diff --git a/fastrace-macro/Cargo.toml b/fastrace-macro/Cargo.toml index ba6d9e2..80c0ddc 100644 --- a/fastrace-macro/Cargo.toml +++ b/fastrace-macro/Cargo.toml @@ -1,17 +1,17 @@ [package] +name = "fastrace-macro" +version = "0.7.0" + categories = ["development-tools::debugging"] description = "Attribute procedural macro for fastrace" documentation = "https://docs.rs/fastrace-macro" keywords = ["tracing", "span", "datadog", "jaeger", "opentelemetry"] -name = "fastrace-macro" readme = "README.md" -authors = { workspace = true } -edition = { workspace = true } -homepage = { workspace = true } -license = { workspace = true } -repository = { workspace = true } -version = { workspace = true } +authors.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true [lib] proc-macro = true @@ -31,9 +31,10 @@ syn = { version = "1.0.84", features = [ [dev-dependencies] fastrace = { workspace = true } +log = { workspace = true } logcall = "0.1" tokio = { version = "1.38", features = ["full"] } trybuild = "1.0" # The procedural macro `trace` only supports async-trait higher than or equal to 0.1.52 async-trait = "0.1.52" -log = "0.4" + diff --git a/fastrace-opentelemetry/Cargo.toml b/fastrace-opentelemetry/Cargo.toml index 1c7e976..a92de67 100644 --- a/fastrace-opentelemetry/Cargo.toml +++ b/fastrace-opentelemetry/Cargo.toml @@ -1,22 +1,22 @@ [package] +name = "fastrace-opentelemetry" +version = "0.7.0" + categories = ["development-tools::debugging"] description = "Opentelemetry reporter for fastrace" -documentation = "https://docs.rs/fastrace-jaeger" +documentation = "https://docs.rs/fastrace-opentelemetry" keywords = ["tracing", "span", "datadog", "jaeger", "opentelemetry"] -name = "fastrace-opentelemetry" readme = "README.md" -authors = { workspace = true } -edition = { workspace = true } -homepage = { workspace = true } -license = { workspace = true } -repository = { workspace = true } -version = { workspace = true } +authors.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true [dependencies] fastrace = { workspace = true } -futures = { version = "0.3", features = ["executor"] } -log = "0.4" +futures = { workspace = true, features = ["executor"] } +log = { workspace = true } opentelemetry = { version = "0.24", features = ["trace"] } opentelemetry_sdk = { version = "0.24", features = ["trace"] } diff --git a/fastrace/Cargo.toml b/fastrace/Cargo.toml index cc53bfc..5a5d56f 100644 --- a/fastrace/Cargo.toml +++ b/fastrace/Cargo.toml @@ -1,17 +1,17 @@ [package] +name = "fastrace" +version = "0.7.0" + categories = ["development-tools::debugging"] description = "A high-performance timeline tracing library for Rust" documentation = "https://docs.rs/fastrace" keywords = ["tracing", "span", "datadog", "jaeger", "opentelemetry"] -name = "fastrace" readme = "../README.md" -authors = { workspace = true } -edition = { workspace = true } -homepage = { workspace = true } -license = { workspace = true } -repository = { workspace = true } -version = { workspace = true } +authors.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true [features] enable = [] @@ -36,9 +36,9 @@ fastrace-datadog = { workspace = true } fastrace-jaeger = { workspace = true } fastrace-opentelemetry = { workspace = true } flume = "0.11" -futures = "0.3" +futures = { workspace = true } futures-timer = "3" -log = "0.4" +log = { workspace = true } logcall = "0.1" mockall = "0.12" once_cell = "1.19" diff --git a/test-statically-disable/Cargo.toml b/test-statically-disable/Cargo.toml index 15625f4..4888ef7 100644 --- a/test-statically-disable/Cargo.toml +++ b/test-statically-disable/Cargo.toml @@ -3,9 +3,10 @@ name = "test-statically-disable" publish = false version = "0.0.1" -authors = { workspace = true } -edition = { workspace = true } -license = { workspace = true } +authors.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true [dependencies] fastrace = { workspace = true }