From c384760a4fbcdc285f358cac4369ca5046890d22 Mon Sep 17 00:00:00 2001 From: tison Date: Wed, 17 Jun 2026 21:19:02 +0800 Subject: [PATCH 01/10] chore: restructure repo Signed-off-by: tison --- Cargo.lock | 318 ------------------ Cargo.toml | 44 +-- README.md | 2 +- .../fastrace-futures}/Cargo.toml | 0 .../fastrace-futures}/README.md | 2 +- .../fastrace-futures}/src/lib.rs | 0 .../fastrace-macro}/Cargo.toml | 0 .../fastrace-macro}/README.md | 0 .../fastrace-macro}/src/args.rs | 0 .../fastrace-macro}/src/impls.rs | 0 .../fastrace-macro}/src/lib.rs | 0 .../fastrace-opentelemetry}/CHANGELOG.md | 0 .../fastrace-opentelemetry}/Cargo.toml | 0 .../fastrace-opentelemetry}/README.md | 0 .../dev/docker-compose.yaml | 0 .../dev/otel-collector-config.yaml | 0 .../fastrace-opentelemetry}/src/lib.rs | 0 .../fastrace-opentelemetry}/tests/context.rs | 0 {fastrace => crates/fastrace}/Cargo.toml | 4 +- .../fastrace}/benches/compare.rs | 0 {fastrace => crates/fastrace}/benches/id.rs | 0 {fastrace => crates/fastrace}/benches/spsc.rs | 0 .../fastrace}/benches/trace.rs | 0 {fastrace => crates/fastrace}/benches/vec.rs | 0 .../fastrace}/src/collector/command.rs | 0 .../src/collector/console_reporter.rs | 0 .../src/collector/global_collector.rs | 0 .../fastrace}/src/collector/id.rs | 0 .../fastrace}/src/collector/mod.rs | 0 .../fastrace}/src/collector/test_reporter.rs | 0 {fastrace => crates/fastrace}/src/event.rs | 0 {fastrace => crates/fastrace}/src/future.rs | 0 {fastrace => crates/fastrace}/src/lib.rs | 0 .../fastrace}/src/local/local_collector.rs | 0 .../fastrace}/src/local/local_span.rs | 0 .../fastrace}/src/local/local_span_line.rs | 0 .../fastrace}/src/local/local_span_stack.rs | 0 .../fastrace}/src/local/mod.rs | 0 .../fastrace}/src/local/raw_span.rs | 0 .../fastrace}/src/local/span_queue.rs | 0 {fastrace => crates/fastrace}/src/macros.rs | 0 {fastrace => crates/fastrace}/src/span.rs | 0 .../fastrace}/src/util/command_bus.rs | 0 {fastrace => crates/fastrace}/src/util/mod.rs | 0 .../fastrace}/src/util/spsc.rs | 0 .../fastrace}/src/util/tree.rs | 0 {fastrace => crates/fastrace}/tests/lib.rs | 0 fastrace-futures/LICENSE | 1 - fastrace-macro/LICENSE | 1 - fastrace-opentelemetry/LICENSE | 1 - fastrace/LICENSE | 1 - rustfmt.toml | 7 - taplo.toml | 1 + 53 files changed, 19 insertions(+), 363 deletions(-) rename {fastrace-futures => crates/fastrace-futures}/Cargo.toml (100%) rename {fastrace-futures => crates/fastrace-futures}/README.md (86%) rename {fastrace-futures => crates/fastrace-futures}/src/lib.rs (100%) rename {fastrace-macro => crates/fastrace-macro}/Cargo.toml (100%) rename {fastrace-macro => crates/fastrace-macro}/README.md (100%) rename {fastrace-macro => crates/fastrace-macro}/src/args.rs (100%) rename {fastrace-macro => crates/fastrace-macro}/src/impls.rs (100%) rename {fastrace-macro => crates/fastrace-macro}/src/lib.rs (100%) rename {fastrace-opentelemetry => crates/fastrace-opentelemetry}/CHANGELOG.md (100%) rename {fastrace-opentelemetry => crates/fastrace-opentelemetry}/Cargo.toml (100%) rename {fastrace-opentelemetry => crates/fastrace-opentelemetry}/README.md (100%) rename {fastrace-opentelemetry => crates/fastrace-opentelemetry}/dev/docker-compose.yaml (100%) rename {fastrace-opentelemetry => crates/fastrace-opentelemetry}/dev/otel-collector-config.yaml (100%) rename {fastrace-opentelemetry => crates/fastrace-opentelemetry}/src/lib.rs (100%) rename {fastrace-opentelemetry => crates/fastrace-opentelemetry}/tests/context.rs (100%) rename {fastrace => crates/fastrace}/Cargo.toml (94%) rename {fastrace => crates/fastrace}/benches/compare.rs (100%) rename {fastrace => crates/fastrace}/benches/id.rs (100%) rename {fastrace => crates/fastrace}/benches/spsc.rs (100%) rename {fastrace => crates/fastrace}/benches/trace.rs (100%) rename {fastrace => crates/fastrace}/benches/vec.rs (100%) rename {fastrace => crates/fastrace}/src/collector/command.rs (100%) rename {fastrace => crates/fastrace}/src/collector/console_reporter.rs (100%) rename {fastrace => crates/fastrace}/src/collector/global_collector.rs (100%) rename {fastrace => crates/fastrace}/src/collector/id.rs (100%) rename {fastrace => crates/fastrace}/src/collector/mod.rs (100%) rename {fastrace => crates/fastrace}/src/collector/test_reporter.rs (100%) rename {fastrace => crates/fastrace}/src/event.rs (100%) rename {fastrace => crates/fastrace}/src/future.rs (100%) rename {fastrace => crates/fastrace}/src/lib.rs (100%) rename {fastrace => crates/fastrace}/src/local/local_collector.rs (100%) rename {fastrace => crates/fastrace}/src/local/local_span.rs (100%) rename {fastrace => crates/fastrace}/src/local/local_span_line.rs (100%) rename {fastrace => crates/fastrace}/src/local/local_span_stack.rs (100%) rename {fastrace => crates/fastrace}/src/local/mod.rs (100%) rename {fastrace => crates/fastrace}/src/local/raw_span.rs (100%) rename {fastrace => crates/fastrace}/src/local/span_queue.rs (100%) rename {fastrace => crates/fastrace}/src/macros.rs (100%) rename {fastrace => crates/fastrace}/src/span.rs (100%) rename {fastrace => crates/fastrace}/src/util/command_bus.rs (100%) rename {fastrace => crates/fastrace}/src/util/mod.rs (100%) rename {fastrace => crates/fastrace}/src/util/spsc.rs (100%) rename {fastrace => crates/fastrace}/src/util/tree.rs (100%) rename {fastrace => crates/fastrace}/tests/lib.rs (100%) delete mode 120000 fastrace-futures/LICENSE delete mode 120000 fastrace-macro/LICENSE delete mode 120000 fastrace-opentelemetry/LICENSE delete mode 120000 fastrace/LICENSE diff --git a/Cargo.lock b/Cargo.lock index a8ef0503..3ff5e4fc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -120,15 +120,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" -[[package]] -name = "colored" -version = "3.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "faf9468729b8cbcea668e36183cb69d317348c2e08e994829fb56ebfdfbaac34" -dependencies = [ - "windows-sys", -] - [[package]] name = "condtype" version = "1.3.0" @@ -270,23 +261,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "example" -version = "0.0.0" -dependencies = [ - "anyhow", - "fastrace", - "fastrace-opentelemetry", - "log", - "logcall", - "logforth", - "opentelemetry", - "opentelemetry-otlp", - "opentelemetry_sdk", - "test-harness", - "tokio", -] - [[package]] name = "fastant" version = "0.1.11" @@ -527,12 +501,6 @@ dependencies = [ "wasip3", ] -[[package]] -name = "glob" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" - [[package]] name = "h2" version = "0.4.15" @@ -711,47 +679,6 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" -[[package]] -name = "jiff" -version = "0.2.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4603d3033e49e2b0e31229fcab20a5d40089c607d975cd9c80551dc69eed9102" -dependencies = [ - "jiff-static", - "jiff-tzdb-platform", - "log", - "portable-atomic", - "portable-atomic-util", - "serde_core", - "windows-link", -] - -[[package]] -name = "jiff-static" -version = "0.2.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "782d32378dddf207193ac91cefb848ad41abb58195c95168e1291227a0832b47" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "jiff-tzdb" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c900ef84826f1338a557697dc8fc601df9ca9af4ac137c7fb61d4c6f2dfd3076" - -[[package]] -name = "jiff-tzdb-platform" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "875a5a69ac2bab1a891711cf5eccbec1ce0341ea805560dcd90b7a2e925132e8" -dependencies = [ - "jiff-tzdb", -] - [[package]] name = "js-sys" version = "0.3.102" @@ -802,117 +729,6 @@ version = "0.4.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "953f07c43838f8e6f9758cab68bf5bed85465e7587ebe0b823f1bcd81978ad3a" -[[package]] -name = "logcall" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "003d767f357cf1f04a444766b2646682a75732505d71553d02f81c6848e0533e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "logforth" -version = "0.30.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "522000d3921e4b089de59204d2d3ca8792cd53f8ce5a54b5ac8b9a6e867259f0" -dependencies = [ - "log", - "logforth-append-fastrace", - "logforth-append-file", - "logforth-bridge-log", - "logforth-core", - "logforth-diagnostic-fastrace", - "logforth-filter-rustlog", - "logforth-layout-json", - "logforth-layout-text", -] - -[[package]] -name = "logforth-append-fastrace" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "107b4296c4dfbdca6eb3a29a0414e374d1f06e7e7738f16e28dd6b8079cb59ec" -dependencies = [ - "fastrace", - "jiff", - "logforth-core", -] - -[[package]] -name = "logforth-append-file" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80f4ed78a03a30c12285135d98330f0f5d53cb0019bd1ac6d66863dae72d8d52" -dependencies = [ - "jiff", - "logforth-core", -] - -[[package]] -name = "logforth-bridge-log" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c7224c78547e542572ae4d1f787f96c4395a4c3f24513bf221bd8e49888f610" -dependencies = [ - "log", - "logforth-core", -] - -[[package]] -name = "logforth-core" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "400ba5305e0cb6819efa6c2c503020562eb5b47fd53c91c935be55af1ffd374e" -dependencies = [ - "anyhow", - "serde", -] - -[[package]] -name = "logforth-diagnostic-fastrace" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95df712f493a6e50ab7bb10ca76ddafc3b80cf23a998b88cc3f8e8bd285d9f18" -dependencies = [ - "fastrace", - "logforth-core", -] - -[[package]] -name = "logforth-filter-rustlog" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e8431cfa1d3eeca479c363651320a66c7003350528f678b30e8c1474fb0d802" -dependencies = [ - "logforth-core", -] - -[[package]] -name = "logforth-layout-json" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d86a105f8f32151ca1e0a6d4097d478badb02d5715239ba0fa431a188a5d966" -dependencies = [ - "jiff", - "logforth-core", - "serde", - "serde_json", -] - -[[package]] -name = "logforth-layout-text" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eafe007ac55293d807e8c7f5a23002e2518d32e476e195443cde23e7845416a" -dependencies = [ - "colored", - "jiff", - "logforth-core", -] - [[package]] name = "memchr" version = "2.8.2" @@ -1097,15 +913,6 @@ version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" -[[package]] -name = "portable-atomic-util" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2a106d1259c23fac8e543272398ae0e3c0b8d33c88ed73d0cc71b0f1d902618" -dependencies = [ - "portable-atomic", -] - [[package]] name = "ppv-lite86" version = "0.2.21" @@ -1354,15 +1161,6 @@ dependencies = [ "zmij", ] -[[package]] -name = "serde_spanned" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26" -dependencies = [ - "serde_core", -] - [[package]] name = "serial_test" version = "3.5.0" @@ -1467,12 +1265,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" -[[package]] -name = "target-triple" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "591ef38edfb78ca4771ee32cf494cb8771944bee237a9b91fc9c1424ac4b777b" - [[package]] name = "tempfile" version = "3.27.0" @@ -1486,15 +1278,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "termcolor" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" -dependencies = [ - "winapi-util", -] - [[package]] name = "terminal_size" version = "0.4.4" @@ -1511,38 +1294,6 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f50febec83f5ee1df3015341d8bd429f2d1cc62bcba7ea2076759d315084683" -[[package]] -name = "test-harness" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "540dedb2dcfa0cff7a79ec955936440a13a75839b6ac14b834a8bbae929bb489" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "test-macros-ui" -version = "0.0.0" -dependencies = [ - "async-stream", - "async-trait", - "fastrace", - "futures", - "log", - "logcall", - "tokio", - "trybuild", -] - -[[package]] -name = "test-statically-disable" -version = "0.0.0" -dependencies = [ - "fastrace", -] - [[package]] name = "thiserror" version = "2.0.18" @@ -1624,45 +1375,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "toml" -version = "1.1.2+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81f3d15e84cbcd896376e6730314d59fb5a87f31e4b038454184435cd57defee" -dependencies = [ - "indexmap", - "serde_core", - "serde_spanned", - "toml_datetime", - "toml_parser", - "toml_writer", - "winnow", -] - -[[package]] -name = "toml_datetime" -version = "1.1.1+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7" -dependencies = [ - "serde_core", -] - -[[package]] -name = "toml_parser" -version = "1.1.2+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526" -dependencies = [ - "winnow", -] - -[[package]] -name = "toml_writer" -version = "1.1.1+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "756daf9b1013ebe47a8776667b466417e2d4c5679d441c26230efd9ef78692db" - [[package]] name = "tonic" version = "0.14.6" @@ -1821,21 +1533,6 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" -[[package]] -name = "trybuild" -version = "1.0.116" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47c635f0191bd3a2941013e5062667100969f8c4e9cd787c14f977265d73616e" -dependencies = [ - "glob", - "serde", - "serde_derive", - "serde_json", - "target-triple", - "termcolor", - "toml", -] - [[package]] name = "unicode-ident" version = "1.0.24" @@ -1976,15 +1673,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "winapi-util" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" -dependencies = [ - "windows-sys", -] - [[package]] name = "windows-link" version = "0.2.1" @@ -2000,12 +1688,6 @@ dependencies = [ "windows-link", ] -[[package]] -name = "winnow" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0592e1c9d151f854e6fd382574c3a0855250e1d9b2f99d9281c6e6391af352f1" - [[package]] name = "wit-bindgen" version = "0.51.0" diff --git a/Cargo.toml b/Cargo.toml index f3caba9c..655f386e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,34 +1,30 @@ [workspace] members = [ - "fastrace", - "fastrace-macro", - "fastrace-opentelemetry", - "fastrace-futures", - - # non-publish crates - "examples", - "tests/macros", - "tests/statically-disable", + "crates/fastrace", + "crates/fastrace-macro", + "crates/fastrace-opentelemetry", + "crates/fastrace-futures", ] -resolver = "2" +resolver = "3" [workspace.package] edition = "2024" license = "Apache-2.0" +readme = "README.md" repository = "https://github.com/fast/fastrace" rust-version = "1.91.0" [workspace.dependencies] # Workspace dependencies -fastrace = { version = "0.7.18", path = "fastrace" } -fastrace-macro = { version = "0.7.18", path = "fastrace-macro" } +fastrace = { version = "0.7.18", path = "crates/fastrace" } +fastrace-macro = { version = "0.7.18", path = "crates/fastrace-macro" } # Workspace leaves -fastrace-futures = { path = "fastrace-futures" } -fastrace-opentelemetry = { path = "fastrace-opentelemetry" } +fastrace-futures = { path = "crates/fastrace-futures" } +fastrace-opentelemetry = { path = "crates/fastrace-opentelemetry" } # crates.io dependencies -log = { version = "0.4.27" } +log = { version = "0.4.32" } opentelemetry = { version = "0.32.0", default-features = false, features = [ "trace", ] } @@ -36,22 +32,10 @@ opentelemetry-otlp = { version = "0.32.0", default-features = false, features = "trace", "grpc-tonic", ] } -opentelemetry_sdk = { version = "0.32.0", default-features = false, features = [ +opentelemetry_sdk = { version = "0.32.1", default-features = false, features = [ "trace", ] } -serde = { version = "1.0", features = ["derive"] } +serde = { version = "1.0.228", features = ["derive"] } # test dependencies -tokio = { version = "1.45.0", features = ["full"] } - -[profile.bench] -lto = true -opt-level = 3 - -[patch.crates-io] -# Patch fastrace in crates.io because we import logforth in the examples, which -# itself depends on fastrace from crates.io. If we don't do this, example break -# because logforth brings in a different version of fastrace and the appender -# stops working. -fastrace = { path = "fastrace" } -fastrace-macro = { path = "fastrace-macro" } +tokio = { version = "1.52.3", features = ["full"] } diff --git a/README.md b/README.md index a98cb37a..5575df74 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Documentation](https://img.shields.io/docsrs/fastrace?style=flat-square&logo=rust)](https://docs.rs/fastrace/) [![MSRV 1.91.0](https://img.shields.io/badge/MSRV-1.91.0-green?style=flat-square&logo=rust)](https://www.whatrustisit.com) [![CI Status](https://img.shields.io/github/actions/workflow/status/fast/fastrace/ci.yml?style=flat-square&logo=github)](https://github.com/fast/fastrace/actions) -[![License](https://img.shields.io/crates/l/fastrace?style=flat-square)](https://github.com/fast/fastrace/blob/main/LICENSE) +[![License](https://img.shields.io/crates/l/fastrace?style=flat-square)](https://www.apache.org/licenses/LICENSE-2.0.txt) [![libs.tech recommends](https://libs.tech/project/829370199/badge.svg)](https://libs.tech/project/829370199/fastrace) Fastrace is a tracing library [100x faster](#benchmarks) than others: diff --git a/fastrace-futures/Cargo.toml b/crates/fastrace-futures/Cargo.toml similarity index 100% rename from fastrace-futures/Cargo.toml rename to crates/fastrace-futures/Cargo.toml diff --git a/fastrace-futures/README.md b/crates/fastrace-futures/README.md similarity index 86% rename from fastrace-futures/README.md rename to crates/fastrace-futures/README.md index e73dd355..f08de896 100644 --- a/fastrace-futures/README.md +++ b/crates/fastrace-futures/README.md @@ -2,6 +2,6 @@ [![Documentation](https://docs.rs/fastrace-futures/badge.svg)](https://docs.rs/fastrace-futures/) [![Crates.io](https://img.shields.io/crates/v/fastrace-futures.svg)](https://crates.io/crates/fastrace-futures) -[![LICENSE](https://img.shields.io/github/license/fast/fastrace.svg)](https://github.com/fast/fastrace/blob/main/LICENSE) +[![LICENSE](https://img.shields.io/github/license/fast/fastrace.svg)](https://www.apache.org/licenses/LICENSE-2.0.txt) Utilities for tracing `Stream` with [`fastrace`](https://crates.io/crates/fastrace). diff --git a/fastrace-futures/src/lib.rs b/crates/fastrace-futures/src/lib.rs similarity index 100% rename from fastrace-futures/src/lib.rs rename to crates/fastrace-futures/src/lib.rs diff --git a/fastrace-macro/Cargo.toml b/crates/fastrace-macro/Cargo.toml similarity index 100% rename from fastrace-macro/Cargo.toml rename to crates/fastrace-macro/Cargo.toml diff --git a/fastrace-macro/README.md b/crates/fastrace-macro/README.md similarity index 100% rename from fastrace-macro/README.md rename to crates/fastrace-macro/README.md diff --git a/fastrace-macro/src/args.rs b/crates/fastrace-macro/src/args.rs similarity index 100% rename from fastrace-macro/src/args.rs rename to crates/fastrace-macro/src/args.rs diff --git a/fastrace-macro/src/impls.rs b/crates/fastrace-macro/src/impls.rs similarity index 100% rename from fastrace-macro/src/impls.rs rename to crates/fastrace-macro/src/impls.rs diff --git a/fastrace-macro/src/lib.rs b/crates/fastrace-macro/src/lib.rs similarity index 100% rename from fastrace-macro/src/lib.rs rename to crates/fastrace-macro/src/lib.rs diff --git a/fastrace-opentelemetry/CHANGELOG.md b/crates/fastrace-opentelemetry/CHANGELOG.md similarity index 100% rename from fastrace-opentelemetry/CHANGELOG.md rename to crates/fastrace-opentelemetry/CHANGELOG.md diff --git a/fastrace-opentelemetry/Cargo.toml b/crates/fastrace-opentelemetry/Cargo.toml similarity index 100% rename from fastrace-opentelemetry/Cargo.toml rename to crates/fastrace-opentelemetry/Cargo.toml diff --git a/fastrace-opentelemetry/README.md b/crates/fastrace-opentelemetry/README.md similarity index 100% rename from fastrace-opentelemetry/README.md rename to crates/fastrace-opentelemetry/README.md diff --git a/fastrace-opentelemetry/dev/docker-compose.yaml b/crates/fastrace-opentelemetry/dev/docker-compose.yaml similarity index 100% rename from fastrace-opentelemetry/dev/docker-compose.yaml rename to crates/fastrace-opentelemetry/dev/docker-compose.yaml diff --git a/fastrace-opentelemetry/dev/otel-collector-config.yaml b/crates/fastrace-opentelemetry/dev/otel-collector-config.yaml similarity index 100% rename from fastrace-opentelemetry/dev/otel-collector-config.yaml rename to crates/fastrace-opentelemetry/dev/otel-collector-config.yaml diff --git a/fastrace-opentelemetry/src/lib.rs b/crates/fastrace-opentelemetry/src/lib.rs similarity index 100% rename from fastrace-opentelemetry/src/lib.rs rename to crates/fastrace-opentelemetry/src/lib.rs diff --git a/fastrace-opentelemetry/tests/context.rs b/crates/fastrace-opentelemetry/tests/context.rs similarity index 100% rename from fastrace-opentelemetry/tests/context.rs rename to crates/fastrace-opentelemetry/tests/context.rs diff --git a/fastrace/Cargo.toml b/crates/fastrace/Cargo.toml similarity index 94% rename from fastrace/Cargo.toml rename to crates/fastrace/Cargo.toml index 6267b827..18c2deaa 100644 --- a/fastrace/Cargo.toml +++ b/crates/fastrace/Cargo.toml @@ -6,10 +6,10 @@ categories = ["development-tools::debugging"] description = "A high-performance timeline tracing library for Rust" documentation = "https://docs.rs/fastrace" keywords = ["tracing", "span", "opentelemetry"] -readme = "../README.md" edition.workspace = true license.workspace = true +readme.workspace = true repository.workspace = true rust-version.workspace = true @@ -29,7 +29,7 @@ serde = { workspace = true } async-trait = "0.1" crossbeam = "0.8" divan = "0.1" -fastrace = { path = ".", features = ["enable"] } +fastrace = { workspace = true, features = ["enable"] } fastrace-opentelemetry = { workspace = true } flume = "0.12.0" futures-timer = "3" diff --git a/fastrace/benches/compare.rs b/crates/fastrace/benches/compare.rs similarity index 100% rename from fastrace/benches/compare.rs rename to crates/fastrace/benches/compare.rs diff --git a/fastrace/benches/id.rs b/crates/fastrace/benches/id.rs similarity index 100% rename from fastrace/benches/id.rs rename to crates/fastrace/benches/id.rs diff --git a/fastrace/benches/spsc.rs b/crates/fastrace/benches/spsc.rs similarity index 100% rename from fastrace/benches/spsc.rs rename to crates/fastrace/benches/spsc.rs diff --git a/fastrace/benches/trace.rs b/crates/fastrace/benches/trace.rs similarity index 100% rename from fastrace/benches/trace.rs rename to crates/fastrace/benches/trace.rs diff --git a/fastrace/benches/vec.rs b/crates/fastrace/benches/vec.rs similarity index 100% rename from fastrace/benches/vec.rs rename to crates/fastrace/benches/vec.rs diff --git a/fastrace/src/collector/command.rs b/crates/fastrace/src/collector/command.rs similarity index 100% rename from fastrace/src/collector/command.rs rename to crates/fastrace/src/collector/command.rs diff --git a/fastrace/src/collector/console_reporter.rs b/crates/fastrace/src/collector/console_reporter.rs similarity index 100% rename from fastrace/src/collector/console_reporter.rs rename to crates/fastrace/src/collector/console_reporter.rs diff --git a/fastrace/src/collector/global_collector.rs b/crates/fastrace/src/collector/global_collector.rs similarity index 100% rename from fastrace/src/collector/global_collector.rs rename to crates/fastrace/src/collector/global_collector.rs diff --git a/fastrace/src/collector/id.rs b/crates/fastrace/src/collector/id.rs similarity index 100% rename from fastrace/src/collector/id.rs rename to crates/fastrace/src/collector/id.rs diff --git a/fastrace/src/collector/mod.rs b/crates/fastrace/src/collector/mod.rs similarity index 100% rename from fastrace/src/collector/mod.rs rename to crates/fastrace/src/collector/mod.rs diff --git a/fastrace/src/collector/test_reporter.rs b/crates/fastrace/src/collector/test_reporter.rs similarity index 100% rename from fastrace/src/collector/test_reporter.rs rename to crates/fastrace/src/collector/test_reporter.rs diff --git a/fastrace/src/event.rs b/crates/fastrace/src/event.rs similarity index 100% rename from fastrace/src/event.rs rename to crates/fastrace/src/event.rs diff --git a/fastrace/src/future.rs b/crates/fastrace/src/future.rs similarity index 100% rename from fastrace/src/future.rs rename to crates/fastrace/src/future.rs diff --git a/fastrace/src/lib.rs b/crates/fastrace/src/lib.rs similarity index 100% rename from fastrace/src/lib.rs rename to crates/fastrace/src/lib.rs diff --git a/fastrace/src/local/local_collector.rs b/crates/fastrace/src/local/local_collector.rs similarity index 100% rename from fastrace/src/local/local_collector.rs rename to crates/fastrace/src/local/local_collector.rs diff --git a/fastrace/src/local/local_span.rs b/crates/fastrace/src/local/local_span.rs similarity index 100% rename from fastrace/src/local/local_span.rs rename to crates/fastrace/src/local/local_span.rs diff --git a/fastrace/src/local/local_span_line.rs b/crates/fastrace/src/local/local_span_line.rs similarity index 100% rename from fastrace/src/local/local_span_line.rs rename to crates/fastrace/src/local/local_span_line.rs diff --git a/fastrace/src/local/local_span_stack.rs b/crates/fastrace/src/local/local_span_stack.rs similarity index 100% rename from fastrace/src/local/local_span_stack.rs rename to crates/fastrace/src/local/local_span_stack.rs diff --git a/fastrace/src/local/mod.rs b/crates/fastrace/src/local/mod.rs similarity index 100% rename from fastrace/src/local/mod.rs rename to crates/fastrace/src/local/mod.rs diff --git a/fastrace/src/local/raw_span.rs b/crates/fastrace/src/local/raw_span.rs similarity index 100% rename from fastrace/src/local/raw_span.rs rename to crates/fastrace/src/local/raw_span.rs diff --git a/fastrace/src/local/span_queue.rs b/crates/fastrace/src/local/span_queue.rs similarity index 100% rename from fastrace/src/local/span_queue.rs rename to crates/fastrace/src/local/span_queue.rs diff --git a/fastrace/src/macros.rs b/crates/fastrace/src/macros.rs similarity index 100% rename from fastrace/src/macros.rs rename to crates/fastrace/src/macros.rs diff --git a/fastrace/src/span.rs b/crates/fastrace/src/span.rs similarity index 100% rename from fastrace/src/span.rs rename to crates/fastrace/src/span.rs diff --git a/fastrace/src/util/command_bus.rs b/crates/fastrace/src/util/command_bus.rs similarity index 100% rename from fastrace/src/util/command_bus.rs rename to crates/fastrace/src/util/command_bus.rs diff --git a/fastrace/src/util/mod.rs b/crates/fastrace/src/util/mod.rs similarity index 100% rename from fastrace/src/util/mod.rs rename to crates/fastrace/src/util/mod.rs diff --git a/fastrace/src/util/spsc.rs b/crates/fastrace/src/util/spsc.rs similarity index 100% rename from fastrace/src/util/spsc.rs rename to crates/fastrace/src/util/spsc.rs diff --git a/fastrace/src/util/tree.rs b/crates/fastrace/src/util/tree.rs similarity index 100% rename from fastrace/src/util/tree.rs rename to crates/fastrace/src/util/tree.rs diff --git a/fastrace/tests/lib.rs b/crates/fastrace/tests/lib.rs similarity index 100% rename from fastrace/tests/lib.rs rename to crates/fastrace/tests/lib.rs diff --git a/fastrace-futures/LICENSE b/fastrace-futures/LICENSE deleted file mode 120000 index ea5b6064..00000000 --- a/fastrace-futures/LICENSE +++ /dev/null @@ -1 +0,0 @@ -../LICENSE \ No newline at end of file diff --git a/fastrace-macro/LICENSE b/fastrace-macro/LICENSE deleted file mode 120000 index ea5b6064..00000000 --- a/fastrace-macro/LICENSE +++ /dev/null @@ -1 +0,0 @@ -../LICENSE \ No newline at end of file diff --git a/fastrace-opentelemetry/LICENSE b/fastrace-opentelemetry/LICENSE deleted file mode 120000 index ea5b6064..00000000 --- a/fastrace-opentelemetry/LICENSE +++ /dev/null @@ -1 +0,0 @@ -../LICENSE \ No newline at end of file diff --git a/fastrace/LICENSE b/fastrace/LICENSE deleted file mode 120000 index ea5b6064..00000000 --- a/fastrace/LICENSE +++ /dev/null @@ -1 +0,0 @@ -../LICENSE \ No newline at end of file diff --git a/rustfmt.toml b/rustfmt.toml index f23dccec..a1a83fd0 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,12 +1,5 @@ comment_width = 120 -edition = "2021" format_code_in_doc_comments = true group_imports = "StdExternalCrate" imports_granularity = "Item" -normalize_comments = true -overflow_delimited_expr = true -reorder_imports = true -style_edition = "2024" -trailing_comma = "Vertical" -where_single_line = true wrap_comments = true diff --git a/taplo.toml b/taplo.toml index 583da20d..c9286933 100644 --- a/taplo.toml +++ b/taplo.toml @@ -1,3 +1,4 @@ +exclude = ["target/**"] include = ["Cargo.toml", "**/*.toml"] [formatting] From 50e4394f7046d7e73f598284211d34d0020aa86e Mon Sep 17 00:00:00 2001 From: tison Date: Wed, 17 Jun 2026 21:27:27 +0800 Subject: [PATCH 02/10] tests-build Signed-off-by: tison --- Cargo.lock | 124 ++++++++++++++++++ Cargo.toml | 9 +- tests-build/Cargo.toml | 20 +++ {tests/macros => tests-build}/tests/ui.rs | 0 .../tests/ui/err/has-duplicated-arguments.rs | 0 .../ui/err/has-duplicated-arguments.stderr | 0 .../tests/ui/err/has-duplicated-properties.rs | 0 .../ui/err/has-duplicated-properties.stderr | 0 .../tests/ui/err/has-empty-name.rs | 0 .../tests/ui/err/has-empty-name.stderr | 0 .../ui/err/has-enter-on-poll-and-sync.rs | 0 .../ui/err/has-enter-on-poll-and-sync.stderr | 0 .../tests/ui/err/has-expr-argument.rs | 0 .../tests/ui/err/has-expr-argument.stderr | 0 .../tests/ui/err/has-ident-arguments.rs | 0 .../tests/ui/err/has-ident-arguments.stderr | 0 .../tests/ui/err/has-name-and-short-name.rs | 0 .../ui/err/has-name-and-short-name.stderr | 0 .../err/has-properties-and-enter-on-poll.rs | 0 .../has-properties-and-enter-on-poll.stderr | 0 .../tests/ui/err/has-unknown-argument.rs | 0 .../tests/ui/err/has-unknown-argument.stderr | 0 .../tests/ui/err/item-is-not-a-function.rs | 0 .../ui/err/item-is-not-a-function.stderr | 0 .../name-is-not-an-assignment-expression.rs | 0 ...ame-is-not-an-assignment-expression.stderr | 0 .../tests/ui/err/name-is-not-string.rs | 0 .../tests/ui/err/name-is-not-string.stderr | 0 .../tests/ui/err/properties-missing-braces.rs | 0 .../ui/err/properties-missing-braces.stderr | 0 .../tests/ui/err/properties-non-string.rs | 0 .../tests/ui/err/properties-non-string.stderr | 0 .../tests/ui/err/properties-partial-escape.rs | 0 .../ui/err/properties-partial-escape.stderr | 0 .../ui/err/properties-value-non-string.rs | 0 .../ui/err/properties-value-non-string.stderr | 0 .../tests/ui/err/short-name-is-not-bool.rs | 0 .../ui/err/short-name-is-not-bool.stderr | 0 .../tests/ui/err/trace-interleaved.rs | 0 .../tests/ui/err/trace-interleaved.stderr | 0 .../tests/ui/ok/async-in-trait.rs | 0 .../tests/ui/ok/async-trait-dyn-future.rs | 0 .../tests/ui/ok/async-trait.rs | 0 .../tests/ui/ok/dyn-future.rs | 0 .../tests/ui/ok/has-crate-path.rs | 0 .../tests/ui/ok/has-enter-on-poll.rs | 0 .../tests/ui/ok/has-generic-signatures.rs | 0 .../tests/ui/ok/has-methods.rs | 0 .../tests/ui/ok/has-name-and-short-name.rs | 0 .../tests/ui/ok/has-name-async-mut.rs | 0 .../tests/ui/ok/has-name-async.rs | 0 .../tests/ui/ok/has-name-mut.rs | 0 .../tests/ui/ok/has-name.rs | 0 .../tests/ui/ok/has-no-arguments.rs | 0 .../tests/ui/ok/has-properties.rs | 0 .../tests/ui/ok/has-short-name.rs | 0 .../tests/ui/ok/has-sync-properties.rs | 0 .../tests/ui/ok/has-unsafe-extern.rs | 0 .../tests/ui/ok/impl-stream.rs | 0 tests/macros/Cargo.toml | 24 ---- 60 files changed, 152 insertions(+), 25 deletions(-) create mode 100644 tests-build/Cargo.toml rename {tests/macros => tests-build}/tests/ui.rs (100%) rename {tests/macros => tests-build}/tests/ui/err/has-duplicated-arguments.rs (100%) rename {tests/macros => tests-build}/tests/ui/err/has-duplicated-arguments.stderr (100%) rename {tests/macros => tests-build}/tests/ui/err/has-duplicated-properties.rs (100%) rename {tests/macros => tests-build}/tests/ui/err/has-duplicated-properties.stderr (100%) rename {tests/macros => tests-build}/tests/ui/err/has-empty-name.rs (100%) rename {tests/macros => tests-build}/tests/ui/err/has-empty-name.stderr (100%) rename {tests/macros => tests-build}/tests/ui/err/has-enter-on-poll-and-sync.rs (100%) rename {tests/macros => tests-build}/tests/ui/err/has-enter-on-poll-and-sync.stderr (100%) rename {tests/macros => tests-build}/tests/ui/err/has-expr-argument.rs (100%) rename {tests/macros => tests-build}/tests/ui/err/has-expr-argument.stderr (100%) rename {tests/macros => tests-build}/tests/ui/err/has-ident-arguments.rs (100%) rename {tests/macros => tests-build}/tests/ui/err/has-ident-arguments.stderr (100%) rename {tests/macros => tests-build}/tests/ui/err/has-name-and-short-name.rs (100%) rename {tests/macros => tests-build}/tests/ui/err/has-name-and-short-name.stderr (100%) rename {tests/macros => tests-build}/tests/ui/err/has-properties-and-enter-on-poll.rs (100%) rename {tests/macros => tests-build}/tests/ui/err/has-properties-and-enter-on-poll.stderr (100%) rename {tests/macros => tests-build}/tests/ui/err/has-unknown-argument.rs (100%) rename {tests/macros => tests-build}/tests/ui/err/has-unknown-argument.stderr (100%) rename {tests/macros => tests-build}/tests/ui/err/item-is-not-a-function.rs (100%) rename {tests/macros => tests-build}/tests/ui/err/item-is-not-a-function.stderr (100%) rename {tests/macros => tests-build}/tests/ui/err/name-is-not-an-assignment-expression.rs (100%) rename {tests/macros => tests-build}/tests/ui/err/name-is-not-an-assignment-expression.stderr (100%) rename {tests/macros => tests-build}/tests/ui/err/name-is-not-string.rs (100%) rename {tests/macros => tests-build}/tests/ui/err/name-is-not-string.stderr (100%) rename {tests/macros => tests-build}/tests/ui/err/properties-missing-braces.rs (100%) rename {tests/macros => tests-build}/tests/ui/err/properties-missing-braces.stderr (100%) rename {tests/macros => tests-build}/tests/ui/err/properties-non-string.rs (100%) rename {tests/macros => tests-build}/tests/ui/err/properties-non-string.stderr (100%) rename {tests/macros => tests-build}/tests/ui/err/properties-partial-escape.rs (100%) rename {tests/macros => tests-build}/tests/ui/err/properties-partial-escape.stderr (100%) rename {tests/macros => tests-build}/tests/ui/err/properties-value-non-string.rs (100%) rename {tests/macros => tests-build}/tests/ui/err/properties-value-non-string.stderr (100%) rename {tests/macros => tests-build}/tests/ui/err/short-name-is-not-bool.rs (100%) rename {tests/macros => tests-build}/tests/ui/err/short-name-is-not-bool.stderr (100%) rename {tests/macros => tests-build}/tests/ui/err/trace-interleaved.rs (100%) rename {tests/macros => tests-build}/tests/ui/err/trace-interleaved.stderr (100%) rename {tests/macros => tests-build}/tests/ui/ok/async-in-trait.rs (100%) rename {tests/macros => tests-build}/tests/ui/ok/async-trait-dyn-future.rs (100%) rename {tests/macros => tests-build}/tests/ui/ok/async-trait.rs (100%) rename {tests/macros => tests-build}/tests/ui/ok/dyn-future.rs (100%) rename {tests/macros => tests-build}/tests/ui/ok/has-crate-path.rs (100%) rename {tests/macros => tests-build}/tests/ui/ok/has-enter-on-poll.rs (100%) rename {tests/macros => tests-build}/tests/ui/ok/has-generic-signatures.rs (100%) rename {tests/macros => tests-build}/tests/ui/ok/has-methods.rs (100%) rename {tests/macros => tests-build}/tests/ui/ok/has-name-and-short-name.rs (100%) rename {tests/macros => tests-build}/tests/ui/ok/has-name-async-mut.rs (100%) rename {tests/macros => tests-build}/tests/ui/ok/has-name-async.rs (100%) rename {tests/macros => tests-build}/tests/ui/ok/has-name-mut.rs (100%) rename {tests/macros => tests-build}/tests/ui/ok/has-name.rs (100%) rename {tests/macros => tests-build}/tests/ui/ok/has-no-arguments.rs (100%) rename {tests/macros => tests-build}/tests/ui/ok/has-properties.rs (100%) rename {tests/macros => tests-build}/tests/ui/ok/has-short-name.rs (100%) rename {tests/macros => tests-build}/tests/ui/ok/has-sync-properties.rs (100%) rename {tests/macros => tests-build}/tests/ui/ok/has-unsafe-extern.rs (100%) rename {tests/macros => tests-build}/tests/ui/ok/impl-stream.rs (100%) delete mode 100644 tests/macros/Cargo.toml diff --git a/Cargo.lock b/Cargo.lock index 3ff5e4fc..a2964684 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -501,6 +501,12 @@ dependencies = [ "wasip3", ] +[[package]] +name = "glob" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" + [[package]] name = "h2" version = "0.4.15" @@ -729,6 +735,17 @@ version = "0.4.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "953f07c43838f8e6f9758cab68bf5bed85465e7587ebe0b823f1bcd81978ad3a" +[[package]] +name = "logcall" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "003d767f357cf1f04a444766b2646682a75732505d71553d02f81c6848e0533e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "memchr" version = "2.8.2" @@ -1161,6 +1178,15 @@ dependencies = [ "zmij", ] +[[package]] +name = "serde_spanned" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26" +dependencies = [ + "serde_core", +] + [[package]] name = "serial_test" version = "3.5.0" @@ -1265,6 +1291,12 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +[[package]] +name = "target-triple" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "591ef38edfb78ca4771ee32cf494cb8771944bee237a9b91fc9c1424ac4b777b" + [[package]] name = "tempfile" version = "3.27.0" @@ -1278,6 +1310,15 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + [[package]] name = "terminal_size" version = "0.4.4" @@ -1294,6 +1335,20 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f50febec83f5ee1df3015341d8bd429f2d1cc62bcba7ea2076759d315084683" +[[package]] +name = "tests-build" +version = "0.0.0" +dependencies = [ + "async-stream", + "async-trait", + "fastrace", + "futures", + "log", + "logcall", + "tokio", + "trybuild", +] + [[package]] name = "thiserror" version = "2.0.18" @@ -1375,6 +1430,45 @@ dependencies = [ "tokio", ] +[[package]] +name = "toml" +version = "1.1.2+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81f3d15e84cbcd896376e6730314d59fb5a87f31e4b038454184435cd57defee" +dependencies = [ + "indexmap", + "serde_core", + "serde_spanned", + "toml_datetime", + "toml_parser", + "toml_writer", + "winnow", +] + +[[package]] +name = "toml_datetime" +version = "1.1.1+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_parser" +version = "1.1.2+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526" +dependencies = [ + "winnow", +] + +[[package]] +name = "toml_writer" +version = "1.1.1+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "756daf9b1013ebe47a8776667b466417e2d4c5679d441c26230efd9ef78692db" + [[package]] name = "tonic" version = "0.14.6" @@ -1533,6 +1627,21 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" +[[package]] +name = "trybuild" +version = "1.0.116" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47c635f0191bd3a2941013e5062667100969f8c4e9cd787c14f977265d73616e" +dependencies = [ + "glob", + "serde", + "serde_derive", + "serde_json", + "target-triple", + "termcolor", + "toml", +] + [[package]] name = "unicode-ident" version = "1.0.24" @@ -1673,6 +1782,15 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys", +] + [[package]] name = "windows-link" version = "0.2.1" @@ -1688,6 +1806,12 @@ dependencies = [ "windows-link", ] +[[package]] +name = "winnow" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0592e1c9d151f854e6fd382574c3a0855250e1d9b2f99d9281c6e6391af352f1" + [[package]] name = "wit-bindgen" version = "0.51.0" diff --git a/Cargo.toml b/Cargo.toml index 655f386e..ad0d4fbc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,7 @@ members = [ "crates/fastrace-macro", "crates/fastrace-opentelemetry", "crates/fastrace-futures", + "tests-build", ] resolver = "3" @@ -24,6 +25,7 @@ fastrace-futures = { path = "crates/fastrace-futures" } fastrace-opentelemetry = { path = "crates/fastrace-opentelemetry" } # crates.io dependencies +futures = { version = "0.3.32" } log = { version = "0.4.32" } opentelemetry = { version = "0.32.0", default-features = false, features = [ "trace", @@ -37,5 +39,10 @@ opentelemetry_sdk = { version = "0.32.1", default-features = false, features = [ ] } serde = { version = "1.0.228", features = ["derive"] } -# test dependencies +# test-only dependencies +async-stream = { version = "0.3.6" } +# The `fastrace::trace` procedural macro only supports async-trait>=0.1.52 +async-trait = { version = "0.1.52" } +logcall = { version = "0.2.0" } tokio = { version = "1.52.3", features = ["full"] } +trybuild = { version = "1.0.116" } diff --git a/tests-build/Cargo.toml b/tests-build/Cargo.toml new file mode 100644 index 00000000..b80ea792 --- /dev/null +++ b/tests-build/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "tests-build" +publish = false + +edition = "2024" +version = "0.0.0" +rust-version = "1.91.0" + +[package.metadata.release] +release = false + +[dev-dependencies] +async-trait = { workspace = true } +async-stream = { workspace = true } +fastrace = { workspace = true, features = ["enable"] } +futures = { workspace = true } +log = { workspace = true } +logcall = { workspace = true } +tokio = { workspace = true } +trybuild = { workspace = true } diff --git a/tests/macros/tests/ui.rs b/tests-build/tests/ui.rs similarity index 100% rename from tests/macros/tests/ui.rs rename to tests-build/tests/ui.rs diff --git a/tests/macros/tests/ui/err/has-duplicated-arguments.rs b/tests-build/tests/ui/err/has-duplicated-arguments.rs similarity index 100% rename from tests/macros/tests/ui/err/has-duplicated-arguments.rs rename to tests-build/tests/ui/err/has-duplicated-arguments.rs diff --git a/tests/macros/tests/ui/err/has-duplicated-arguments.stderr b/tests-build/tests/ui/err/has-duplicated-arguments.stderr similarity index 100% rename from tests/macros/tests/ui/err/has-duplicated-arguments.stderr rename to tests-build/tests/ui/err/has-duplicated-arguments.stderr diff --git a/tests/macros/tests/ui/err/has-duplicated-properties.rs b/tests-build/tests/ui/err/has-duplicated-properties.rs similarity index 100% rename from tests/macros/tests/ui/err/has-duplicated-properties.rs rename to tests-build/tests/ui/err/has-duplicated-properties.rs diff --git a/tests/macros/tests/ui/err/has-duplicated-properties.stderr b/tests-build/tests/ui/err/has-duplicated-properties.stderr similarity index 100% rename from tests/macros/tests/ui/err/has-duplicated-properties.stderr rename to tests-build/tests/ui/err/has-duplicated-properties.stderr diff --git a/tests/macros/tests/ui/err/has-empty-name.rs b/tests-build/tests/ui/err/has-empty-name.rs similarity index 100% rename from tests/macros/tests/ui/err/has-empty-name.rs rename to tests-build/tests/ui/err/has-empty-name.rs diff --git a/tests/macros/tests/ui/err/has-empty-name.stderr b/tests-build/tests/ui/err/has-empty-name.stderr similarity index 100% rename from tests/macros/tests/ui/err/has-empty-name.stderr rename to tests-build/tests/ui/err/has-empty-name.stderr diff --git a/tests/macros/tests/ui/err/has-enter-on-poll-and-sync.rs b/tests-build/tests/ui/err/has-enter-on-poll-and-sync.rs similarity index 100% rename from tests/macros/tests/ui/err/has-enter-on-poll-and-sync.rs rename to tests-build/tests/ui/err/has-enter-on-poll-and-sync.rs diff --git a/tests/macros/tests/ui/err/has-enter-on-poll-and-sync.stderr b/tests-build/tests/ui/err/has-enter-on-poll-and-sync.stderr similarity index 100% rename from tests/macros/tests/ui/err/has-enter-on-poll-and-sync.stderr rename to tests-build/tests/ui/err/has-enter-on-poll-and-sync.stderr diff --git a/tests/macros/tests/ui/err/has-expr-argument.rs b/tests-build/tests/ui/err/has-expr-argument.rs similarity index 100% rename from tests/macros/tests/ui/err/has-expr-argument.rs rename to tests-build/tests/ui/err/has-expr-argument.rs diff --git a/tests/macros/tests/ui/err/has-expr-argument.stderr b/tests-build/tests/ui/err/has-expr-argument.stderr similarity index 100% rename from tests/macros/tests/ui/err/has-expr-argument.stderr rename to tests-build/tests/ui/err/has-expr-argument.stderr diff --git a/tests/macros/tests/ui/err/has-ident-arguments.rs b/tests-build/tests/ui/err/has-ident-arguments.rs similarity index 100% rename from tests/macros/tests/ui/err/has-ident-arguments.rs rename to tests-build/tests/ui/err/has-ident-arguments.rs diff --git a/tests/macros/tests/ui/err/has-ident-arguments.stderr b/tests-build/tests/ui/err/has-ident-arguments.stderr similarity index 100% rename from tests/macros/tests/ui/err/has-ident-arguments.stderr rename to tests-build/tests/ui/err/has-ident-arguments.stderr diff --git a/tests/macros/tests/ui/err/has-name-and-short-name.rs b/tests-build/tests/ui/err/has-name-and-short-name.rs similarity index 100% rename from tests/macros/tests/ui/err/has-name-and-short-name.rs rename to tests-build/tests/ui/err/has-name-and-short-name.rs diff --git a/tests/macros/tests/ui/err/has-name-and-short-name.stderr b/tests-build/tests/ui/err/has-name-and-short-name.stderr similarity index 100% rename from tests/macros/tests/ui/err/has-name-and-short-name.stderr rename to tests-build/tests/ui/err/has-name-and-short-name.stderr diff --git a/tests/macros/tests/ui/err/has-properties-and-enter-on-poll.rs b/tests-build/tests/ui/err/has-properties-and-enter-on-poll.rs similarity index 100% rename from tests/macros/tests/ui/err/has-properties-and-enter-on-poll.rs rename to tests-build/tests/ui/err/has-properties-and-enter-on-poll.rs diff --git a/tests/macros/tests/ui/err/has-properties-and-enter-on-poll.stderr b/tests-build/tests/ui/err/has-properties-and-enter-on-poll.stderr similarity index 100% rename from tests/macros/tests/ui/err/has-properties-and-enter-on-poll.stderr rename to tests-build/tests/ui/err/has-properties-and-enter-on-poll.stderr diff --git a/tests/macros/tests/ui/err/has-unknown-argument.rs b/tests-build/tests/ui/err/has-unknown-argument.rs similarity index 100% rename from tests/macros/tests/ui/err/has-unknown-argument.rs rename to tests-build/tests/ui/err/has-unknown-argument.rs diff --git a/tests/macros/tests/ui/err/has-unknown-argument.stderr b/tests-build/tests/ui/err/has-unknown-argument.stderr similarity index 100% rename from tests/macros/tests/ui/err/has-unknown-argument.stderr rename to tests-build/tests/ui/err/has-unknown-argument.stderr diff --git a/tests/macros/tests/ui/err/item-is-not-a-function.rs b/tests-build/tests/ui/err/item-is-not-a-function.rs similarity index 100% rename from tests/macros/tests/ui/err/item-is-not-a-function.rs rename to tests-build/tests/ui/err/item-is-not-a-function.rs diff --git a/tests/macros/tests/ui/err/item-is-not-a-function.stderr b/tests-build/tests/ui/err/item-is-not-a-function.stderr similarity index 100% rename from tests/macros/tests/ui/err/item-is-not-a-function.stderr rename to tests-build/tests/ui/err/item-is-not-a-function.stderr diff --git a/tests/macros/tests/ui/err/name-is-not-an-assignment-expression.rs b/tests-build/tests/ui/err/name-is-not-an-assignment-expression.rs similarity index 100% rename from tests/macros/tests/ui/err/name-is-not-an-assignment-expression.rs rename to tests-build/tests/ui/err/name-is-not-an-assignment-expression.rs diff --git a/tests/macros/tests/ui/err/name-is-not-an-assignment-expression.stderr b/tests-build/tests/ui/err/name-is-not-an-assignment-expression.stderr similarity index 100% rename from tests/macros/tests/ui/err/name-is-not-an-assignment-expression.stderr rename to tests-build/tests/ui/err/name-is-not-an-assignment-expression.stderr diff --git a/tests/macros/tests/ui/err/name-is-not-string.rs b/tests-build/tests/ui/err/name-is-not-string.rs similarity index 100% rename from tests/macros/tests/ui/err/name-is-not-string.rs rename to tests-build/tests/ui/err/name-is-not-string.rs diff --git a/tests/macros/tests/ui/err/name-is-not-string.stderr b/tests-build/tests/ui/err/name-is-not-string.stderr similarity index 100% rename from tests/macros/tests/ui/err/name-is-not-string.stderr rename to tests-build/tests/ui/err/name-is-not-string.stderr diff --git a/tests/macros/tests/ui/err/properties-missing-braces.rs b/tests-build/tests/ui/err/properties-missing-braces.rs similarity index 100% rename from tests/macros/tests/ui/err/properties-missing-braces.rs rename to tests-build/tests/ui/err/properties-missing-braces.rs diff --git a/tests/macros/tests/ui/err/properties-missing-braces.stderr b/tests-build/tests/ui/err/properties-missing-braces.stderr similarity index 100% rename from tests/macros/tests/ui/err/properties-missing-braces.stderr rename to tests-build/tests/ui/err/properties-missing-braces.stderr diff --git a/tests/macros/tests/ui/err/properties-non-string.rs b/tests-build/tests/ui/err/properties-non-string.rs similarity index 100% rename from tests/macros/tests/ui/err/properties-non-string.rs rename to tests-build/tests/ui/err/properties-non-string.rs diff --git a/tests/macros/tests/ui/err/properties-non-string.stderr b/tests-build/tests/ui/err/properties-non-string.stderr similarity index 100% rename from tests/macros/tests/ui/err/properties-non-string.stderr rename to tests-build/tests/ui/err/properties-non-string.stderr diff --git a/tests/macros/tests/ui/err/properties-partial-escape.rs b/tests-build/tests/ui/err/properties-partial-escape.rs similarity index 100% rename from tests/macros/tests/ui/err/properties-partial-escape.rs rename to tests-build/tests/ui/err/properties-partial-escape.rs diff --git a/tests/macros/tests/ui/err/properties-partial-escape.stderr b/tests-build/tests/ui/err/properties-partial-escape.stderr similarity index 100% rename from tests/macros/tests/ui/err/properties-partial-escape.stderr rename to tests-build/tests/ui/err/properties-partial-escape.stderr diff --git a/tests/macros/tests/ui/err/properties-value-non-string.rs b/tests-build/tests/ui/err/properties-value-non-string.rs similarity index 100% rename from tests/macros/tests/ui/err/properties-value-non-string.rs rename to tests-build/tests/ui/err/properties-value-non-string.rs diff --git a/tests/macros/tests/ui/err/properties-value-non-string.stderr b/tests-build/tests/ui/err/properties-value-non-string.stderr similarity index 100% rename from tests/macros/tests/ui/err/properties-value-non-string.stderr rename to tests-build/tests/ui/err/properties-value-non-string.stderr diff --git a/tests/macros/tests/ui/err/short-name-is-not-bool.rs b/tests-build/tests/ui/err/short-name-is-not-bool.rs similarity index 100% rename from tests/macros/tests/ui/err/short-name-is-not-bool.rs rename to tests-build/tests/ui/err/short-name-is-not-bool.rs diff --git a/tests/macros/tests/ui/err/short-name-is-not-bool.stderr b/tests-build/tests/ui/err/short-name-is-not-bool.stderr similarity index 100% rename from tests/macros/tests/ui/err/short-name-is-not-bool.stderr rename to tests-build/tests/ui/err/short-name-is-not-bool.stderr diff --git a/tests/macros/tests/ui/err/trace-interleaved.rs b/tests-build/tests/ui/err/trace-interleaved.rs similarity index 100% rename from tests/macros/tests/ui/err/trace-interleaved.rs rename to tests-build/tests/ui/err/trace-interleaved.rs diff --git a/tests/macros/tests/ui/err/trace-interleaved.stderr b/tests-build/tests/ui/err/trace-interleaved.stderr similarity index 100% rename from tests/macros/tests/ui/err/trace-interleaved.stderr rename to tests-build/tests/ui/err/trace-interleaved.stderr diff --git a/tests/macros/tests/ui/ok/async-in-trait.rs b/tests-build/tests/ui/ok/async-in-trait.rs similarity index 100% rename from tests/macros/tests/ui/ok/async-in-trait.rs rename to tests-build/tests/ui/ok/async-in-trait.rs diff --git a/tests/macros/tests/ui/ok/async-trait-dyn-future.rs b/tests-build/tests/ui/ok/async-trait-dyn-future.rs similarity index 100% rename from tests/macros/tests/ui/ok/async-trait-dyn-future.rs rename to tests-build/tests/ui/ok/async-trait-dyn-future.rs diff --git a/tests/macros/tests/ui/ok/async-trait.rs b/tests-build/tests/ui/ok/async-trait.rs similarity index 100% rename from tests/macros/tests/ui/ok/async-trait.rs rename to tests-build/tests/ui/ok/async-trait.rs diff --git a/tests/macros/tests/ui/ok/dyn-future.rs b/tests-build/tests/ui/ok/dyn-future.rs similarity index 100% rename from tests/macros/tests/ui/ok/dyn-future.rs rename to tests-build/tests/ui/ok/dyn-future.rs diff --git a/tests/macros/tests/ui/ok/has-crate-path.rs b/tests-build/tests/ui/ok/has-crate-path.rs similarity index 100% rename from tests/macros/tests/ui/ok/has-crate-path.rs rename to tests-build/tests/ui/ok/has-crate-path.rs diff --git a/tests/macros/tests/ui/ok/has-enter-on-poll.rs b/tests-build/tests/ui/ok/has-enter-on-poll.rs similarity index 100% rename from tests/macros/tests/ui/ok/has-enter-on-poll.rs rename to tests-build/tests/ui/ok/has-enter-on-poll.rs diff --git a/tests/macros/tests/ui/ok/has-generic-signatures.rs b/tests-build/tests/ui/ok/has-generic-signatures.rs similarity index 100% rename from tests/macros/tests/ui/ok/has-generic-signatures.rs rename to tests-build/tests/ui/ok/has-generic-signatures.rs diff --git a/tests/macros/tests/ui/ok/has-methods.rs b/tests-build/tests/ui/ok/has-methods.rs similarity index 100% rename from tests/macros/tests/ui/ok/has-methods.rs rename to tests-build/tests/ui/ok/has-methods.rs diff --git a/tests/macros/tests/ui/ok/has-name-and-short-name.rs b/tests-build/tests/ui/ok/has-name-and-short-name.rs similarity index 100% rename from tests/macros/tests/ui/ok/has-name-and-short-name.rs rename to tests-build/tests/ui/ok/has-name-and-short-name.rs diff --git a/tests/macros/tests/ui/ok/has-name-async-mut.rs b/tests-build/tests/ui/ok/has-name-async-mut.rs similarity index 100% rename from tests/macros/tests/ui/ok/has-name-async-mut.rs rename to tests-build/tests/ui/ok/has-name-async-mut.rs diff --git a/tests/macros/tests/ui/ok/has-name-async.rs b/tests-build/tests/ui/ok/has-name-async.rs similarity index 100% rename from tests/macros/tests/ui/ok/has-name-async.rs rename to tests-build/tests/ui/ok/has-name-async.rs diff --git a/tests/macros/tests/ui/ok/has-name-mut.rs b/tests-build/tests/ui/ok/has-name-mut.rs similarity index 100% rename from tests/macros/tests/ui/ok/has-name-mut.rs rename to tests-build/tests/ui/ok/has-name-mut.rs diff --git a/tests/macros/tests/ui/ok/has-name.rs b/tests-build/tests/ui/ok/has-name.rs similarity index 100% rename from tests/macros/tests/ui/ok/has-name.rs rename to tests-build/tests/ui/ok/has-name.rs diff --git a/tests/macros/tests/ui/ok/has-no-arguments.rs b/tests-build/tests/ui/ok/has-no-arguments.rs similarity index 100% rename from tests/macros/tests/ui/ok/has-no-arguments.rs rename to tests-build/tests/ui/ok/has-no-arguments.rs diff --git a/tests/macros/tests/ui/ok/has-properties.rs b/tests-build/tests/ui/ok/has-properties.rs similarity index 100% rename from tests/macros/tests/ui/ok/has-properties.rs rename to tests-build/tests/ui/ok/has-properties.rs diff --git a/tests/macros/tests/ui/ok/has-short-name.rs b/tests-build/tests/ui/ok/has-short-name.rs similarity index 100% rename from tests/macros/tests/ui/ok/has-short-name.rs rename to tests-build/tests/ui/ok/has-short-name.rs diff --git a/tests/macros/tests/ui/ok/has-sync-properties.rs b/tests-build/tests/ui/ok/has-sync-properties.rs similarity index 100% rename from tests/macros/tests/ui/ok/has-sync-properties.rs rename to tests-build/tests/ui/ok/has-sync-properties.rs diff --git a/tests/macros/tests/ui/ok/has-unsafe-extern.rs b/tests-build/tests/ui/ok/has-unsafe-extern.rs similarity index 100% rename from tests/macros/tests/ui/ok/has-unsafe-extern.rs rename to tests-build/tests/ui/ok/has-unsafe-extern.rs diff --git a/tests/macros/tests/ui/ok/impl-stream.rs b/tests-build/tests/ui/ok/impl-stream.rs similarity index 100% rename from tests/macros/tests/ui/ok/impl-stream.rs rename to tests-build/tests/ui/ok/impl-stream.rs diff --git a/tests/macros/Cargo.toml b/tests/macros/Cargo.toml deleted file mode 100644 index c9096dd7..00000000 --- a/tests/macros/Cargo.toml +++ /dev/null @@ -1,24 +0,0 @@ -[package] -name = "test-macros-ui" -publish = false -version = "0.0.0" - -edition.workspace = true -license.workspace = true -repository.workspace = true -rust-version.workspace = true - -[package.metadata.release] -release = false - -[dev-dependencies] -async-stream = { version = "0.3" } -fastrace = { workspace = true, features = ["enable"] } -futures = { version = "0.3" } -log = { workspace = true } -logcall = { version = "0.2" } -tokio = { workspace = true } -trybuild = { version = "1.0" } - -# The procedural macro `trace` only supports async-trait higher than or equal to 0.1.52 -async-trait = { version = "0.1.52" } From 05324530f9d30f7a91dd44bfa78a54b62e4aa98a Mon Sep 17 00:00:00 2001 From: tison Date: Wed, 17 Jun 2026 21:33:39 +0800 Subject: [PATCH 03/10] tests-integration Signed-off-by: tison --- Cargo.lock | 14 +++++++++++++ Cargo.toml | 6 ++++++ crates/fastrace-futures/Cargo.toml | 2 +- examples/Cargo.toml | 6 +++--- tests-build/Cargo.toml | 8 ++++---- tests-integration/Cargo.toml | 20 +++++++++++++++++++ .../tests/tests.rs | 10 +++++----- 7 files changed, 53 insertions(+), 13 deletions(-) create mode 100644 tests-integration/Cargo.toml rename crates/fastrace/tests/lib.rs => tests-integration/tests/tests.rs (99%) diff --git a/Cargo.lock b/Cargo.lock index a2964684..6cbc8192 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1349,6 +1349,20 @@ dependencies = [ "trybuild", ] +[[package]] +name = "tests-integration" +version = "0.0.0" +dependencies = [ + "async-trait", + "crossbeam", + "fastrace", + "futures-timer", + "insta", + "pollster", + "serial_test", + "tokio", +] + [[package]] name = "thiserror" version = "2.0.18" diff --git a/Cargo.toml b/Cargo.toml index ad0d4fbc..f15cb8d0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,6 +5,7 @@ members = [ "crates/fastrace-opentelemetry", "crates/fastrace-futures", "tests-build", + "tests-integration", ] resolver = "3" @@ -43,6 +44,11 @@ serde = { version = "1.0.228", features = ["derive"] } async-stream = { version = "0.3.6" } # The `fastrace::trace` procedural macro only supports async-trait>=0.1.52 async-trait = { version = "0.1.52" } +crossbeam = { version = "0.8.4" } +futures-timer = { version = "3.0.4" } +insta = { version = "1.48.0" } logcall = { version = "0.2.0" } +pollster = { version = "0.4.0" } +serial_test = { version = "3.5.0" } tokio = { version = "1.52.3", features = ["full"] } trybuild = { version = "1.0.116" } diff --git a/crates/fastrace-futures/Cargo.toml b/crates/fastrace-futures/Cargo.toml index b04d3e67..273693ea 100644 --- a/crates/fastrace-futures/Cargo.toml +++ b/crates/fastrace-futures/Cargo.toml @@ -20,7 +20,7 @@ futures-sink = { version = "0.3.31" } pin-project = { version = "1.1.8" } [dev-dependencies] -fastrace = { workspace = true, features = ["enable"] } async-stream = { version = "0.3" } +fastrace = { workspace = true, features = ["enable"] } futures = { version = "0.3" } tokio = { workspace = true } diff --git a/examples/Cargo.toml b/examples/Cargo.toml index c74ce1f7..9a7b8969 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -18,9 +18,9 @@ fastrace-opentelemetry = { workspace = true } log = { workspace = true } logcall = { version = "0.2.0" } logforth = { version = "0.30.1", features = [ - "append-fastrace", - "diagnostic-fastrace", - "starter-log", + "append-fastrace", + "diagnostic-fastrace", + "starter-log", ] } opentelemetry = { workspace = true } opentelemetry-otlp = { workspace = true } diff --git a/tests-build/Cargo.toml b/tests-build/Cargo.toml index b80ea792..892ade2c 100644 --- a/tests-build/Cargo.toml +++ b/tests-build/Cargo.toml @@ -1,17 +1,17 @@ [package] name = "tests-build" publish = false - -edition = "2024" version = "0.0.0" -rust-version = "1.91.0" + +edition.workspace = true +rust-version.workspace = true [package.metadata.release] release = false [dev-dependencies] -async-trait = { workspace = true } async-stream = { workspace = true } +async-trait = { workspace = true } fastrace = { workspace = true, features = ["enable"] } futures = { workspace = true } log = { workspace = true } diff --git a/tests-integration/Cargo.toml b/tests-integration/Cargo.toml new file mode 100644 index 00000000..711647d4 --- /dev/null +++ b/tests-integration/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "tests-integration" +publish = false +version = "0.0.0" + +edition.workspace = true +rust-version.workspace = true + +[package.metadata.release] +release = false + +[dependencies] +async-trait = { workspace = true } +crossbeam = { workspace = true } +fastrace = { workspace = true, features = ["enable"] } +futures-timer = { workspace = true } +insta = { workspace = true } +pollster = { workspace = true } +serial_test = { workspace = true } +tokio = { workspace = true } diff --git a/crates/fastrace/tests/lib.rs b/tests-integration/tests/tests.rs similarity index 99% rename from crates/fastrace/tests/lib.rs rename to tests-integration/tests/tests.rs index 2164c071..a6bd7ec5 100644 --- a/crates/fastrace/tests/lib.rs +++ b/tests-integration/tests/tests.rs @@ -206,7 +206,7 @@ fn multiple_threads_single_span() { handles.into_iter().for_each(|h| h.join().unwrap()); }) - .unwrap(); + .unwrap(); fastrace::flush(); @@ -359,10 +359,10 @@ fn test_macro() { Bar.work2(&100).await; work3(&100, &100).await; } - .in_span(root), + .in_span(root), ), ) - .unwrap(); + .unwrap(); } fastrace::flush(); @@ -623,10 +623,10 @@ fn test_macro_properties() { foo_async(1, &Bar, Bar).await; bar_async().await; } - .in_span(root), + .in_span(root), ), ) - .unwrap(); + .unwrap(); } fastrace::flush(); From 320d3385682cb4ee9fbf828fbd5bdc4b6bb3b091 Mon Sep 17 00:00:00 2001 From: tison Date: Wed, 17 Jun 2026 21:50:43 +0800 Subject: [PATCH 04/10] benches Signed-off-by: tison --- Cargo.lock | 33 +++++++------ Cargo.toml | 9 +++- README.md | 8 ++-- benches/Cargo.toml | 44 ++++++++++++++++++ .../fastrace => benches}/benches/compare.rs | 0 {crates/fastrace => benches}/benches/id.rs | 0 {crates/fastrace => benches}/benches/spsc.rs | 0 {crates/fastrace => benches}/benches/trace.rs | 0 {crates/fastrace => benches}/benches/vec.rs | 0 {etc/img => benches/media}/benchmark-arch.svg | 0 .../img => benches/media}/benchmark-spans.svg | 0 {etc/img => benches/media}/head-benchmark.svg | 0 .../media}/jaeger-asynchronous.png | Bin .../media}/jaeger-synchronous.png | Bin .../results}/README.md | 0 .../results}/compare-m4.2xlarge.txt | 0 .../results}/compare-m5.2xlarge.txt | 0 .../results}/compare-m5a.2xlarge.txt | 0 .../results}/compare-m6g.2xlarge.txt | 0 crates/fastrace/Cargo.toml | 44 ++---------------- crates/fastrace/src/lib.rs | 3 +- tests-integration/Cargo.toml | 2 +- 22 files changed, 83 insertions(+), 60 deletions(-) create mode 100644 benches/Cargo.toml rename {crates/fastrace => benches}/benches/compare.rs (100%) rename {crates/fastrace => benches}/benches/id.rs (100%) rename {crates/fastrace => benches}/benches/spsc.rs (100%) rename {crates/fastrace => benches}/benches/trace.rs (100%) rename {crates/fastrace => benches}/benches/vec.rs (100%) rename {etc/img => benches/media}/benchmark-arch.svg (100%) rename {etc/img => benches/media}/benchmark-spans.svg (100%) rename {etc/img => benches/media}/head-benchmark.svg (100%) rename {etc/img => benches/media}/jaeger-asynchronous.png (100%) rename {etc/img => benches/media}/jaeger-synchronous.png (100%) rename {etc/benchmark-result => benches/results}/README.md (100%) rename {etc/benchmark-result => benches/results}/compare-m4.2xlarge.txt (100%) rename {etc/benchmark-result => benches/results}/compare-m5.2xlarge.txt (100%) rename {etc/benchmark-result => benches/results}/compare-m5a.2xlarge.txt (100%) rename {etc/benchmark-result => benches/results}/compare-m6g.2xlarge.txt (100%) diff --git a/Cargo.lock b/Cargo.lock index 6cbc8192..a3a175d6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -59,6 +59,26 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" +[[package]] +name = "benches" +version = "0.1.0" +dependencies = [ + "crossbeam", + "divan", + "fastrace", + "fastrace-opentelemetry", + "flume", + "opentelemetry", + "opentelemetry-otlp", + "opentelemetry_sdk", + "pollster", + "rtrb", + "tokio", + "tracing", + "tracing-opentelemetry", + "tracing-subscriber", +] + [[package]] name = "bitflags" version = "2.13.0" @@ -275,31 +295,18 @@ dependencies = [ name = "fastrace" version = "0.7.18" dependencies = [ - "async-trait", "crossbeam", - "divan", "fastant", "fastrace", "fastrace-macro", - "fastrace-opentelemetry", - "flume", "futures-timer", - "insta", "mockall", - "opentelemetry", - "opentelemetry-otlp", - "opentelemetry_sdk", "parking_lot", "pin-project", "pollster", "rand 0.10.1", "rtrb", "serde", - "serial_test", - "tokio", - "tracing", - "tracing-opentelemetry", - "tracing-subscriber", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index f15cb8d0..b871bb73 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ members = [ "crates/fastrace-opentelemetry", "crates/fastrace-futures", "tests-build", - "tests-integration", + "tests-integration", "benches", ] resolver = "3" @@ -38,6 +38,7 @@ opentelemetry-otlp = { version = "0.32.0", default-features = false, features = opentelemetry_sdk = { version = "0.32.1", default-features = false, features = [ "trace", ] } +rtrb = { version = "0.3.4" } serde = { version = "1.0.228", features = ["derive"] } # test-only dependencies @@ -45,10 +46,16 @@ async-stream = { version = "0.3.6" } # The `fastrace::trace` procedural macro only supports async-trait>=0.1.52 async-trait = { version = "0.1.52" } crossbeam = { version = "0.8.4" } +divan = { version = "0.1.21" } +flume = { version = "0.12.0" } futures-timer = { version = "3.0.4" } insta = { version = "1.48.0" } logcall = { version = "0.2.0" } +mockall = { version = "0.14.0" } pollster = { version = "0.4.0" } serial_test = { version = "3.5.0" } tokio = { version = "1.52.3", features = ["full"] } +tracing = { version = "0.1.44" } +tracing-opentelemetry = { version = "0.33.0" } +tracing-subscriber = { version = "0.3.19" } trybuild = { version = "1.0.116" } diff --git a/README.md b/README.md index 5575df74..fb11d7da 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Fastrace is a tracing library [100x faster](#benchmarks) than others: -![benchmark](https://raw.githubusercontent.com/fast/fastrace/refs/heads/main/etc/img/head-benchmark.svg) +![benchmark](https://raw.githubusercontent.com/fast/fastrace/refs/heads/main/benches/media/head-benchmark.svg) Features: @@ -176,7 +176,7 @@ In this context, Fastrace offers a more efficient solution by filtering out enti **By different architectures:** -![Benchmark result by architecture](https://raw.githubusercontent.com/fast/fastrace/refs/heads/main/etc/img/benchmark-arch.svg) +![Benchmark result by architecture](https://raw.githubusercontent.com/fast/fastrace/refs/heads/main/benches/media/benchmark-arch.svg) | | x86-64 (Intel Broadwell) | x86-64 (Intel Skylake) | x86-64 (AMD Zen) | ARM (AWS Graviton2) | |---------------------|--------------------------|------------------------|------------------|---------------------| @@ -186,7 +186,7 @@ In this context, Fastrace offers a more efficient solution by filtering out enti **By creating a different number of spans:** -![Benchmark result by number of spans](https://raw.githubusercontent.com/fast/fastrace/refs/heads/main/etc/img/benchmark-spans.svg) +![Benchmark result by number of spans](https://raw.githubusercontent.com/fast/fastrace/refs/heads/main/benches/media/benchmark-spans.svg) | | 1 span | 10 spans | 100 spans | 1000 spans | |---------------------|------------|------------|-------------|-------------| @@ -194,7 +194,7 @@ In this context, Fastrace offers a more efficient solution by filtering out enti | rustracing | 13x slower | 26x slower | 45x slower | 55x slower | | fastrace (baseline) | 1x (0.4us) | 1x (0.8us) | 1x (3.4us) | 1x (27.8us) | -Detailed results are available in [etc/benchmark-result](https://github.com/fast/fastrace/tree/main/etc/benchmark-result). +Detailed results are available in [benches/results](https://github.com/fast/fastrace/tree/main/benches/results). ## License diff --git a/benches/Cargo.toml b/benches/Cargo.toml new file mode 100644 index 00000000..859e97bd --- /dev/null +++ b/benches/Cargo.toml @@ -0,0 +1,44 @@ +[package] +name = "benches" +version = "0.1.0" +edition.workspace = true +license.workspace = true +readme.workspace = true +repository.workspace = true +rust-version.workspace = true + +[dev-dependencies] +crossbeam = { workspace = true } +divan = { workspace = true } +fastrace = { workspace = true, features = ["enable"] } +fastrace-opentelemetry = { workspace = true } +flume = { workspace = true } +opentelemetry = { workspace = true } +opentelemetry-otlp = { workspace = true } +opentelemetry_sdk = { workspace = true } +pollster = { workspace = true } +rtrb = { workspace = true } +tokio = { workspace = true } +tracing = { workspace = true } +tracing-opentelemetry = { workspace = true } +tracing-subscriber = { workspace = true } + +[[bench]] +harness = false +name = "trace" + +[[bench]] +harness = false +name = "compare" + +[[bench]] +harness = false +name = "spsc" + +[[bench]] +harness = false +name = "id" + +[[bench]] +harness = false +name = "vec" diff --git a/crates/fastrace/benches/compare.rs b/benches/benches/compare.rs similarity index 100% rename from crates/fastrace/benches/compare.rs rename to benches/benches/compare.rs diff --git a/crates/fastrace/benches/id.rs b/benches/benches/id.rs similarity index 100% rename from crates/fastrace/benches/id.rs rename to benches/benches/id.rs diff --git a/crates/fastrace/benches/spsc.rs b/benches/benches/spsc.rs similarity index 100% rename from crates/fastrace/benches/spsc.rs rename to benches/benches/spsc.rs diff --git a/crates/fastrace/benches/trace.rs b/benches/benches/trace.rs similarity index 100% rename from crates/fastrace/benches/trace.rs rename to benches/benches/trace.rs diff --git a/crates/fastrace/benches/vec.rs b/benches/benches/vec.rs similarity index 100% rename from crates/fastrace/benches/vec.rs rename to benches/benches/vec.rs diff --git a/etc/img/benchmark-arch.svg b/benches/media/benchmark-arch.svg similarity index 100% rename from etc/img/benchmark-arch.svg rename to benches/media/benchmark-arch.svg diff --git a/etc/img/benchmark-spans.svg b/benches/media/benchmark-spans.svg similarity index 100% rename from etc/img/benchmark-spans.svg rename to benches/media/benchmark-spans.svg diff --git a/etc/img/head-benchmark.svg b/benches/media/head-benchmark.svg similarity index 100% rename from etc/img/head-benchmark.svg rename to benches/media/head-benchmark.svg diff --git a/etc/img/jaeger-asynchronous.png b/benches/media/jaeger-asynchronous.png similarity index 100% rename from etc/img/jaeger-asynchronous.png rename to benches/media/jaeger-asynchronous.png diff --git a/etc/img/jaeger-synchronous.png b/benches/media/jaeger-synchronous.png similarity index 100% rename from etc/img/jaeger-synchronous.png rename to benches/media/jaeger-synchronous.png diff --git a/etc/benchmark-result/README.md b/benches/results/README.md similarity index 100% rename from etc/benchmark-result/README.md rename to benches/results/README.md diff --git a/etc/benchmark-result/compare-m4.2xlarge.txt b/benches/results/compare-m4.2xlarge.txt similarity index 100% rename from etc/benchmark-result/compare-m4.2xlarge.txt rename to benches/results/compare-m4.2xlarge.txt diff --git a/etc/benchmark-result/compare-m5.2xlarge.txt b/benches/results/compare-m5.2xlarge.txt similarity index 100% rename from etc/benchmark-result/compare-m5.2xlarge.txt rename to benches/results/compare-m5.2xlarge.txt diff --git a/etc/benchmark-result/compare-m5a.2xlarge.txt b/benches/results/compare-m5a.2xlarge.txt similarity index 100% rename from etc/benchmark-result/compare-m5a.2xlarge.txt rename to benches/results/compare-m5a.2xlarge.txt diff --git a/etc/benchmark-result/compare-m6g.2xlarge.txt b/benches/results/compare-m6g.2xlarge.txt similarity index 100% rename from etc/benchmark-result/compare-m6g.2xlarge.txt rename to benches/results/compare-m6g.2xlarge.txt diff --git a/crates/fastrace/Cargo.toml b/crates/fastrace/Cargo.toml index 18c2deaa..74fa930a 100644 --- a/crates/fastrace/Cargo.toml +++ b/crates/fastrace/Cargo.toml @@ -22,46 +22,12 @@ fastrace-macro = { workspace = true } parking_lot = "0.12" pin-project = { version = "1.1.8" } rand = "0.10.0" -rtrb = "0.3" +rtrb = { workspace = true } serde = { workspace = true } [dev-dependencies] -async-trait = "0.1" -crossbeam = "0.8" -divan = "0.1" +crossbeam = { workspace = true } fastrace = { workspace = true, features = ["enable"] } -fastrace-opentelemetry = { workspace = true } -flume = "0.12.0" -futures-timer = "3" -insta = "1.43.1" -mockall = "0.14.0" -opentelemetry = { workspace = true } -opentelemetry-otlp = { workspace = true } -opentelemetry_sdk = { workspace = true } -pollster = { version = "0.4.0" } -rand = "0.10.0" -serial_test = "3.1" -tokio = { workspace = true } -tracing = { version = "0.1" } -tracing-opentelemetry = { version = "0.33.0" } -tracing-subscriber = { version = "0.3.19" } - -[[bench]] -harness = false -name = "trace" - -[[bench]] -harness = false -name = "compare" - -[[bench]] -harness = false -name = "spsc" - -[[bench]] -harness = false -name = "id" - -[[bench]] -harness = false -name = "vec" +futures-timer = { workspace = true } +mockall = { workspace = true } +pollster = { workspace = true } diff --git a/crates/fastrace/src/lib.rs b/crates/fastrace/src/lib.rs index 6a774a2b..0441677f 100644 --- a/crates/fastrace/src/lib.rs +++ b/crates/fastrace/src/lib.rs @@ -260,7 +260,6 @@ //! use fastrace::collector::Config; //! use fastrace::collector::ConsoleReporter; //! use fastrace::prelude::*; -//! use pollster::block_on; //! //! #[trace] //! fn do_something(i: u64) { @@ -280,7 +279,7 @@ //! //! do_something(100); //! -//! block_on( +//! pollster::block_on( //! async { //! do_something_async(100).await; //! } diff --git a/tests-integration/Cargo.toml b/tests-integration/Cargo.toml index 711647d4..532c21d7 100644 --- a/tests-integration/Cargo.toml +++ b/tests-integration/Cargo.toml @@ -9,7 +9,7 @@ rust-version.workspace = true [package.metadata.release] release = false -[dependencies] +[dev-dependencies] async-trait = { workspace = true } crossbeam = { workspace = true } fastrace = { workspace = true, features = ["enable"] } From 5c7068b90375b772aa701dff0c45b2c1a325652a Mon Sep 17 00:00:00 2001 From: tison Date: Wed, 17 Jun 2026 22:04:25 +0800 Subject: [PATCH 05/10] cont benches Signed-off-by: tison --- .gitignore | 4 - Cargo.lock | 200 --------------------------------------------- Cargo.toml | 10 +-- benches/.gitignore | 2 + benches/Cargo.toml | 45 +++++----- 5 files changed, 29 insertions(+), 232 deletions(-) create mode 100644 benches/.gitignore diff --git a/.gitignore b/.gitignore index bc92265e..ea8c4bf7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1 @@ /target -/wip - -.editorconfig -.idea diff --git a/Cargo.lock b/Cargo.lock index a3a175d6..73c0cbd3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -59,26 +59,6 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" -[[package]] -name = "benches" -version = "0.1.0" -dependencies = [ - "crossbeam", - "divan", - "fastrace", - "fastrace-opentelemetry", - "flume", - "opentelemetry", - "opentelemetry-otlp", - "opentelemetry_sdk", - "pollster", - "rtrb", - "tokio", - "tracing", - "tracing-opentelemetry", - "tracing-subscriber", -] - [[package]] name = "bitflags" version = "2.13.0" @@ -114,38 +94,6 @@ dependencies = [ "rand_core 0.10.1", ] -[[package]] -name = "clap" -version = "4.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ddb117e43bbf7dacf0a4190fef4d345b9bad68dfc649cb349e7d17d28428e51" -dependencies = [ - "clap_builder", -] - -[[package]] -name = "clap_builder" -version = "4.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f" -dependencies = [ - "anstyle", - "clap_lex", - "terminal_size", -] - -[[package]] -name = "clap_lex" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" - -[[package]] -name = "condtype" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf0a07a401f374238ab8e2f11a104d2851bf9ce711ec69804834de8af45c7af" - [[package]] name = "console" version = "0.16.3" @@ -222,31 +170,6 @@ version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" -[[package]] -name = "divan" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a405457ec78b8fe08b0e32b4a3570ab5dff6dd16eb9e76a5ee0a9d9cbd898933" -dependencies = [ - "cfg-if", - "clap", - "condtype", - "divan-macros", - "libc", - "regex-lite", -] - -[[package]] -name = "divan-macros" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9556bc800956545d6420a640173e5ba7dfa82f38d3ea5a167eb555bc69ac3323" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "downcast" version = "0.11.0" @@ -349,21 +272,6 @@ name = "fastrand" version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6" -dependencies = [ - "getrandom 0.3.4", -] - -[[package]] -name = "flume" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e139bc46ca777eb5efaf62df0ab8cc5fd400866427e56c68b22e414e53bd3be" -dependencies = [ - "fastrand", - "futures-core", - "futures-sink", - "spin", -] [[package]] name = "fnv" @@ -487,11 +395,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" dependencies = [ "cfg-if", - "js-sys", "libc", "r-efi 5.3.0", "wasip2", - "wasm-bindgen", ] [[package]] @@ -703,12 +609,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "lazy_static" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" - [[package]] name = "leb128fmt" version = "0.1.0" @@ -796,15 +696,6 @@ dependencies = [ "syn", ] -[[package]] -name = "nu-ansi-term" -version = "0.50.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" -dependencies = [ - "windows-sys", -] - [[package]] name = "once_cell" version = "1.21.4" @@ -1099,12 +990,6 @@ dependencies = [ "bitflags", ] -[[package]] -name = "regex-lite" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cab834c73d247e67f4fae452806d17d3c7501756d98c8808d7c9c7aa7d18f973" - [[package]] name = "rtrb" version = "0.3.4" @@ -1219,15 +1104,6 @@ dependencies = [ "syn", ] -[[package]] -name = "sharded-slab" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" -dependencies = [ - "lazy_static", -] - [[package]] name = "signal-hook-registry" version = "1.4.8" @@ -1272,15 +1148,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "spin" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" -dependencies = [ - "lock_api", -] - [[package]] name = "syn" version = "2.0.118" @@ -1326,16 +1193,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "terminal_size" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "230a1b821ccbd75b185820a1f1ff7b14d21da1e442e22c0863ea5f08771a8874" -dependencies = [ - "rustix", - "windows-sys", -] - [[package]] name = "termtree" version = "0.5.1" @@ -1390,15 +1247,6 @@ dependencies = [ "syn", ] -[[package]] -name = "thread_local" -version = "1.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" -dependencies = [ - "cfg-if", -] - [[package]] name = "tokio" version = "1.52.3" @@ -1598,48 +1446,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" dependencies = [ "once_cell", - "valuable", -] - -[[package]] -name = "tracing-log" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" -dependencies = [ - "log", - "once_cell", - "tracing-core", -] - -[[package]] -name = "tracing-opentelemetry" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adbc64cba7137545b8044cb1fe9814f7aacf3c6b5f9b45be8bb5db538befdb26" -dependencies = [ - "js-sys", - "opentelemetry", - "smallvec", - "tracing", - "tracing-core", - "tracing-log", - "tracing-subscriber", - "web-time", -] - -[[package]] -name = "tracing-subscriber" -version = "0.3.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319" -dependencies = [ - "nu-ansi-term", - "sharded-slab", - "smallvec", - "thread_local", - "tracing-core", - "tracing-log", ] [[package]] @@ -1675,12 +1481,6 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" -[[package]] -name = "valuable" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" - [[package]] name = "want" version = "0.3.1" diff --git a/Cargo.toml b/Cargo.toml index b871bb73..2a520605 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,11 +1,12 @@ [workspace] +exclude = ["benches", "examples"] members = [ "crates/fastrace", "crates/fastrace-macro", "crates/fastrace-opentelemetry", "crates/fastrace-futures", "tests-build", - "tests-integration", "benches", + "tests-integration", ] resolver = "3" @@ -20,8 +21,6 @@ rust-version = "1.91.0" # Workspace dependencies fastrace = { version = "0.7.18", path = "crates/fastrace" } fastrace-macro = { version = "0.7.18", path = "crates/fastrace-macro" } - -# Workspace leaves fastrace-futures = { path = "crates/fastrace-futures" } fastrace-opentelemetry = { path = "crates/fastrace-opentelemetry" } @@ -46,8 +45,6 @@ async-stream = { version = "0.3.6" } # The `fastrace::trace` procedural macro only supports async-trait>=0.1.52 async-trait = { version = "0.1.52" } crossbeam = { version = "0.8.4" } -divan = { version = "0.1.21" } -flume = { version = "0.12.0" } futures-timer = { version = "3.0.4" } insta = { version = "1.48.0" } logcall = { version = "0.2.0" } @@ -55,7 +52,4 @@ mockall = { version = "0.14.0" } pollster = { version = "0.4.0" } serial_test = { version = "3.5.0" } tokio = { version = "1.52.3", features = ["full"] } -tracing = { version = "0.1.44" } -tracing-opentelemetry = { version = "0.33.0" } -tracing-subscriber = { version = "0.3.19" } trybuild = { version = "1.0.116" } diff --git a/benches/.gitignore b/benches/.gitignore new file mode 100644 index 00000000..1b72444a --- /dev/null +++ b/benches/.gitignore @@ -0,0 +1,2 @@ +/Cargo.lock +/target diff --git a/benches/Cargo.toml b/benches/Cargo.toml index 859e97bd..3a69fb8f 100644 --- a/benches/Cargo.toml +++ b/benches/Cargo.toml @@ -1,27 +1,32 @@ [package] name = "benches" -version = "0.1.0" -edition.workspace = true -license.workspace = true -readme.workspace = true -repository.workspace = true -rust-version.workspace = true +version = "0.0.0" + +edition = "2024" +publish = false [dev-dependencies] -crossbeam = { workspace = true } -divan = { workspace = true } -fastrace = { workspace = true, features = ["enable"] } -fastrace-opentelemetry = { workspace = true } -flume = { workspace = true } -opentelemetry = { workspace = true } -opentelemetry-otlp = { workspace = true } -opentelemetry_sdk = { workspace = true } -pollster = { workspace = true } -rtrb = { workspace = true } -tokio = { workspace = true } -tracing = { workspace = true } -tracing-opentelemetry = { workspace = true } -tracing-subscriber = { workspace = true } +crossbeam = { version = "0.8.4" } +divan = { version = "0.1.21" } +fastrace = { path = "../crates/fastrace", features = ["enable"] } +fastrace-opentelemetry = { path = "../crates/fastrace-opentelemetry" } +flume = { version = "0.12.0" } +opentelemetry = { version = "0.32.0", default-features = false, features = [ + "trace", +] } +opentelemetry-otlp = { version = "0.32.0", default-features = false, features = [ + "trace", + "grpc-tonic", +] } +opentelemetry_sdk = { version = "0.32.1", default-features = false, features = [ + "trace", +] } +pollster = { version = "0.4.0" } +rtrb = { version = "0.3.4" } +tokio = { version = "1.52.3", features = ["full"] } +tracing = { version = "0.1.44" } +tracing-opentelemetry = { version = "0.33.0" } +tracing-subscriber = { version = "0.3.23" } [[bench]] harness = false From 11fb57e1a0beb4542f035183580c2d6b8127c89f Mon Sep 17 00:00:00 2001 From: tison Date: Wed, 17 Jun 2026 22:43:58 +0800 Subject: [PATCH 06/10] examples Signed-off-by: tison --- benches/Cargo.toml | 4 + examples/.gitignore | 2 + examples/Cargo.toml | 83 ++++++++--------- examples/basic.rs | 32 ------- examples/console-reporter/Cargo.toml | 13 +++ examples/console-reporter/main.rs | 49 ++++++++++ examples/fastrace-disabled/Cargo.toml | 13 +++ .../fastrace-disabled}/main.rs | 4 - examples/log-integration/Cargo.toml | 17 ++++ .../{logging.rs => log-integration/main.rs} | 13 ++- examples/opentelemetry-reporter/Cargo.toml | 18 ++++ .../main.rs} | 73 ++++++--------- examples/sampling/Cargo.toml | 13 +++ examples/{sampling.rs => sampling/main.rs} | 6 +- examples/synchronous.rs | 93 ------------------- examples/test-harness-integration/Cargo.toml | 16 ++++ .../main.rs} | 9 +- tests/statically-disable/Cargo.toml | 15 --- 18 files changed, 223 insertions(+), 250 deletions(-) create mode 100644 examples/.gitignore delete mode 100644 examples/basic.rs create mode 100644 examples/console-reporter/Cargo.toml create mode 100644 examples/console-reporter/main.rs create mode 100644 examples/fastrace-disabled/Cargo.toml rename {tests/statically-disable/src => examples/fastrace-disabled}/main.rs (93%) create mode 100644 examples/log-integration/Cargo.toml rename examples/{logging.rs => log-integration/main.rs} (87%) create mode 100644 examples/opentelemetry-reporter/Cargo.toml rename examples/{asynchronous.rs => opentelemetry-reporter/main.rs} (51%) create mode 100644 examples/sampling/Cargo.toml rename examples/{sampling.rs => sampling/main.rs} (94%) delete mode 100644 examples/synchronous.rs create mode 100644 examples/test-harness-integration/Cargo.toml rename examples/{harness.rs => test-harness-integration/main.rs} (90%) delete mode 100644 tests/statically-disable/Cargo.toml diff --git a/benches/Cargo.toml b/benches/Cargo.toml index 3a69fb8f..a09db420 100644 --- a/benches/Cargo.toml +++ b/benches/Cargo.toml @@ -28,6 +28,10 @@ tracing = { version = "0.1.44" } tracing-opentelemetry = { version = "0.33.0" } tracing-subscriber = { version = "0.3.23" } +[profile.bench] +lto = true +opt-level = 3 + [[bench]] harness = false name = "trace" diff --git a/examples/.gitignore b/examples/.gitignore new file mode 100644 index 00000000..1b72444a --- /dev/null +++ b/examples/.gitignore @@ -0,0 +1,2 @@ +/Cargo.lock +/target diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 9a7b8969..6783bb31 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -1,53 +1,46 @@ -[package] -name = "example" +[workspace] +members = [ + "console-reporter", "fastrace-disabled", "log-integration", + "opentelemetry-reporter", + "sampling", + "test-harness-integration", +] +resolver = "3" + +[workspace.package] +edition = "2024" publish = false version = "0.0.0" -edition.workspace = true -license.workspace = true -repository.workspace = true -rust-version.workspace = true - -[package.metadata.release] -release = false - -[dev-dependencies] -anyhow = { version = "1.0.98" } -fastrace = { workspace = true, features = ["enable"] } -fastrace-opentelemetry = { workspace = true } -log = { workspace = true } +[workspace.dependencies] +anyhow = { version = "1.0.102" } +fastrace = { path = "../crates/fastrace" } +fastrace-opentelemetry = { path = "../crates/fastrace-opentelemetry" } +log = { version = "0.4.32" } logcall = { version = "0.2.0" } logforth = { version = "0.30.1", features = [ - "append-fastrace", - "diagnostic-fastrace", - "starter-log", + "append-fastrace", + "diagnostic-fastrace", + "starter-log", ] } -opentelemetry = { workspace = true } -opentelemetry-otlp = { workspace = true } -opentelemetry_sdk = { workspace = true } -test-harness = { version = "0.3.0" } -tokio = { workspace = true } - -[[example]] -name = "asynchronous" -path = "asynchronous.rs" - -[[example]] -name = "basic" -path = "basic.rs" - -[[example]] -name = "harness" -path = "harness.rs" - -[[example]] -name = "logging" -path = "logging.rs" +opentelemetry = { version = "0.32.0", default-features = false, features = [ + "trace", +] } +opentelemetry-otlp = { version = "0.32.0", default-features = false, features = [ + "trace", + "grpc-tonic", +] } +opentelemetry_sdk = { version = "0.32.1", default-features = false, features = [ + "trace", +] } +test-harness = { version = "0.3.1" } +tokio = { version = "1.52.3", features = ["full"] } -[[example]] -name = "synchronous" -path = "synchronous.rs" -[[example]] -name = "sampling" -path = "sampling.rs" +[patch.crates-io] +# Patch fastrace in crates.io because we import logforth in the examples, which +# itself depends on fastrace from crates.io. If we don't do this, example break +# because logforth brings in a different version of fastrace and the appender +# stops working. +fastrace = { path = "../crates/fastrace" } +fastrace-macro = { path = "../crates/fastrace-macro" } diff --git a/examples/basic.rs b/examples/basic.rs deleted file mode 100644 index 3371733e..00000000 --- a/examples/basic.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2024 FastLabs Developers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -use fastrace::collector::Config; -use fastrace::collector::ConsoleReporter; -use fastrace::prelude::*; - -fn main() { - fastrace::set_reporter(ConsoleReporter, Config::default()); - do_main(); - fastrace::flush(); -} - -fn do_main() { - let parent = SpanContext::random(); - let root = Span::root("root", parent); - let _g = root.set_local_parent(); - let _g = LocalSpan::enter_with_local_parent("child"); - - // do business -} diff --git a/examples/console-reporter/Cargo.toml b/examples/console-reporter/Cargo.toml new file mode 100644 index 00000000..ea067cb4 --- /dev/null +++ b/examples/console-reporter/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "console-reporter" + +edition.workspace = true +publish.workspace = true +version.workspace = true + +[dependencies] +fastrace = { workspace = true, features = ["enable"] } + +[[bin]] +name = "console-reporter" +path = "main.rs" \ No newline at end of file diff --git a/examples/console-reporter/main.rs b/examples/console-reporter/main.rs new file mode 100644 index 00000000..36f80994 --- /dev/null +++ b/examples/console-reporter/main.rs @@ -0,0 +1,49 @@ +// Copyright 2024 FastLabs Developers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use std::time::Duration; + +use fastrace::Span; +use fastrace::collector::{Config, ConsoleReporter, SpanContext}; +use fastrace::local::LocalSpan; + +fn func1(i: u64) { + let _guard = LocalSpan::enter_with_local_parent("func1"); + std::thread::sleep(Duration::from_millis(i)); + func2(i); +} + +#[fastrace::trace] +fn func2(i: u64) { + std::thread::sleep(Duration::from_millis(i)); +} + +fn main() { + fastrace::set_reporter(ConsoleReporter, Config::default()); + + { + let parent = SpanContext::random(); + let root = Span::root("root", parent); + + let _g = root.set_local_parent(); + let _span = LocalSpan::enter_with_local_parent("biz-span") + .with_property(|| ("biz-property", "biz-value")); + + for i in 1..=10 { + func1(i); + } + } + + fastrace::flush(); +} diff --git a/examples/fastrace-disabled/Cargo.toml b/examples/fastrace-disabled/Cargo.toml new file mode 100644 index 00000000..cb73f453 --- /dev/null +++ b/examples/fastrace-disabled/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "fastrace-disabled" + +edition.workspace = true +publish.workspace = true +version.workspace = true + +[dependencies] +fastrace = { workspace = true } # do not turn on the "enable" feature + +[[bin]] +name = "fastrace-disabled" +path = "main.rs" \ No newline at end of file diff --git a/tests/statically-disable/src/main.rs b/examples/fastrace-disabled/main.rs similarity index 93% rename from tests/statically-disable/src/main.rs rename to examples/fastrace-disabled/main.rs index 9457b341..1908b468 100644 --- a/tests/statically-disable/src/main.rs +++ b/examples/fastrace-disabled/main.rs @@ -12,10 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -// This file is derived from [1] under the original license header: -// Copyright 2020 TiKV Project Authors. Licensed under Apache-2.0. -// [1]: https://github.com/tikv/minitrace-rust/blob/v0.6.4/test-statically-disable/src/main.rs - //! The libraries may have tracing instrument embedded in the code for tracing purposes. //! //! However, if the executable does not enable fastrace, it will be statically disabled. diff --git a/examples/log-integration/Cargo.toml b/examples/log-integration/Cargo.toml new file mode 100644 index 00000000..c30e807b --- /dev/null +++ b/examples/log-integration/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "log-integration" + +edition.workspace = true +publish.workspace = true +version.workspace = true + +[dependencies] +fastrace = { workspace = true, features = ["enable"] } +log = { workspace = true } +logcall = { workspace = true } +logforth = { workspace = true } + + +[[bin]] +name = "log-integration" +path = "main.rs" diff --git a/examples/logging.rs b/examples/log-integration/main.rs similarity index 87% rename from examples/logging.rs rename to examples/log-integration/main.rs index bc98d280..a6613690 100644 --- a/examples/logging.rs +++ b/examples/log-integration/main.rs @@ -12,17 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -use fastrace::collector::Config; +use fastrace::collector::{Config, SpanContext}; use fastrace::collector::ConsoleReporter; -use fastrace::prelude::*; -use log::info; use logforth::append; use logforth::diagnostic; use logforth::layout; +use fastrace::local::LocalSpan; +use fastrace::Span; -/// An example of automatically logging function arguments and return values. #[logcall::logcall("debug")] -#[trace] +#[fastrace::trace] fn plus(a: u64, b: u64) -> Result { Ok(a + b) } @@ -51,11 +50,11 @@ fn do_main() { let root = Span::root("root", parent); let _span_guard = root.set_local_parent(); - info!("event in root span"); + log::info!("event in root span"); let _local_span_guard = LocalSpan::enter_with_local_parent("child"); - info!("event in child span"); + log::info!("event in child span"); plus(1, 2).unwrap(); } diff --git a/examples/opentelemetry-reporter/Cargo.toml b/examples/opentelemetry-reporter/Cargo.toml new file mode 100644 index 00000000..68bf1407 --- /dev/null +++ b/examples/opentelemetry-reporter/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "opentelemetry-reporter" + +edition.workspace = true +publish.workspace = true +version.workspace = true + +[dependencies] +fastrace = { workspace = true, features = ["enable"] } +fastrace-opentelemetry = { workspace = true } +opentelemetry = { workspace = true } +opentelemetry-otlp = { workspace = true } +opentelemetry_sdk = { workspace = true } +tokio = { workspace = true } + +[[bin]] +name = "opentelemetry-reporter" +path = "main.rs" diff --git a/examples/asynchronous.rs b/examples/opentelemetry-reporter/main.rs similarity index 51% rename from examples/asynchronous.rs rename to examples/opentelemetry-reporter/main.rs index 7b038da3..a92994de 100644 --- a/examples/asynchronous.rs +++ b/examples/opentelemetry-reporter/main.rs @@ -12,16 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -// This file is derived from [1] under the original license header: -// Copyright 2020 TiKV Project Authors. Licensed under Apache-2.0. -// [1]: https://github.com/tikv/minitrace-rust/blob/v0.6.4/minitrace/examples/asynchronous.rs - use std::borrow::Cow; -use fastrace::collector::Config; -use fastrace::collector::Reporter; -use fastrace::prelude::*; +use fastrace::collector::{Config, SpanContext}; use opentelemetry_otlp::WithExportConfig; +use fastrace::future::FutureExt; +use fastrace::local::LocalSpan; +use fastrace::Span; fn parallel_job() -> Vec> { let mut v = Vec::with_capacity(4); @@ -39,7 +36,7 @@ async fn iter_job(iter: u64) { other_job().await; } -#[trace(enter_on_poll = true)] +#[fastrace::trace(enter_on_poll = true)] async fn other_job() { for i in 0..20 { if i == 10 { @@ -51,7 +48,28 @@ async fn other_job() { #[tokio::main] async fn main() { - fastrace::set_reporter(ReportAll::create(), Config::default()); + let reporter = fastrace_opentelemetry::OpenTelemetryReporter::new( + opentelemetry_otlp::SpanExporter::builder() + .with_tonic() + .with_endpoint("http://127.0.0.1:4317".to_string()) + .with_protocol(opentelemetry_otlp::Protocol::Grpc) + .with_timeout(opentelemetry_otlp::OTEL_EXPORTER_OTLP_TIMEOUT_DEFAULT) + .build() + .unwrap(), + Cow::Owned( + opentelemetry_sdk::Resource::builder() + .with_attributes([opentelemetry::KeyValue::new( + "service.name", + "asynchronous(opentelemetry)", + )]) + .build(), + ), + opentelemetry::InstrumentationScope::builder("example-crate") + .with_version(env!("CARGO_PKG_VERSION")) + .build(), + ); + + fastrace::set_reporter(reporter, Config::default()); { let parent = SpanContext::random(); @@ -77,40 +95,3 @@ async fn main() { fastrace::flush(); } - -pub struct ReportAll { - opentelemetry: fastrace_opentelemetry::OpenTelemetryReporter, -} - -impl ReportAll { - pub fn create() -> ReportAll { - ReportAll { - opentelemetry: fastrace_opentelemetry::OpenTelemetryReporter::new( - opentelemetry_otlp::SpanExporter::builder() - .with_tonic() - .with_endpoint("http://127.0.0.1:4317".to_string()) - .with_protocol(opentelemetry_otlp::Protocol::Grpc) - .with_timeout(opentelemetry_otlp::OTEL_EXPORTER_OTLP_TIMEOUT_DEFAULT) - .build() - .expect("initialize oltp exporter"), - Cow::Owned( - opentelemetry_sdk::Resource::builder() - .with_attributes([opentelemetry::KeyValue::new( - "service.name", - "asynchronous(opentelemetry)", - )]) - .build(), - ), - opentelemetry::InstrumentationScope::builder("example-crate") - .with_version(env!("CARGO_PKG_VERSION")) - .build(), - ), - } - } -} - -impl Reporter for ReportAll { - fn report(&mut self, spans: Vec) { - self.opentelemetry.report(spans); - } -} diff --git a/examples/sampling/Cargo.toml b/examples/sampling/Cargo.toml new file mode 100644 index 00000000..9ad4007c --- /dev/null +++ b/examples/sampling/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "sampling" + +edition.workspace = true +publish.workspace = true +version.workspace = true + +[dependencies] +fastrace = { workspace = true, features = ["enable"] } + +[[bin]] +name = "sampling" +path = "main.rs" \ No newline at end of file diff --git a/examples/sampling.rs b/examples/sampling/main.rs similarity index 94% rename from examples/sampling.rs rename to examples/sampling/main.rs index 230c1f70..d05019f5 100644 --- a/examples/sampling.rs +++ b/examples/sampling/main.rs @@ -14,9 +14,9 @@ use std::time::Duration; -use fastrace::collector::Config; +use fastrace::collector::{Config, SpanContext}; use fastrace::collector::ConsoleReporter; -use fastrace::prelude::*; +use fastrace::Span; fn main() { fastrace::set_reporter(ConsoleReporter, Config::default()); @@ -53,7 +53,7 @@ fn heavy_task() { } } -#[trace] +#[fastrace::trace] fn expensive_task(time: Duration) { std::thread::sleep(time); } diff --git a/examples/synchronous.rs b/examples/synchronous.rs deleted file mode 100644 index b0a4f49a..00000000 --- a/examples/synchronous.rs +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2024 FastLabs Developers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This file is derived from [1] under the original license header: -// Copyright 2020 TiKV Project Authors. Licensed under Apache-2.0. -// [1]: https://github.com/tikv/minitrace-rust/blob/v0.6.4/minitrace/examples/synchronous.rs - -use std::borrow::Cow; -use std::time::Duration; - -use fastrace::collector::Config; -use fastrace::collector::Reporter; -use fastrace::prelude::*; -use opentelemetry_otlp::WithExportConfig; - -fn func1(i: u64) { - let _guard = LocalSpan::enter_with_local_parent("func1"); - std::thread::sleep(Duration::from_millis(i)); - func2(i); -} - -#[trace] -fn func2(i: u64) { - std::thread::sleep(Duration::from_millis(i)); -} - -#[tokio::main] -async fn main() { - fastrace::set_reporter(ReportAll::create(), Config::default()); - - { - let parent = SpanContext::random(); - let root = Span::root("root", parent); - - let _g = root.set_local_parent(); - let _span = LocalSpan::enter_with_local_parent("a span") - .with_property(|| ("a property", "a value")); - - for i in 1..=10 { - func1(i); - } - } - - fastrace::flush(); -} - -pub struct ReportAll { - opentelemetry: fastrace_opentelemetry::OpenTelemetryReporter, -} - -impl ReportAll { - pub fn create() -> ReportAll { - ReportAll { - opentelemetry: fastrace_opentelemetry::OpenTelemetryReporter::new( - opentelemetry_otlp::SpanExporter::builder() - .with_tonic() - .with_endpoint("http://127.0.0.1:4317".to_string()) - .with_protocol(opentelemetry_otlp::Protocol::Grpc) - .with_timeout(opentelemetry_otlp::OTEL_EXPORTER_OTLP_TIMEOUT_DEFAULT) - .build() - .expect("initialize oltp exporter"), - Cow::Owned( - opentelemetry_sdk::Resource::builder() - .with_attributes([opentelemetry::KeyValue::new( - "service.name", - "synchronous(opentelemetry)", - )]) - .build(), - ), - opentelemetry::InstrumentationScope::builder("example-crate") - .with_version(env!("CARGO_PKG_VERSION")) - .build(), - ), - } - } -} - -impl Reporter for ReportAll { - fn report(&mut self, spans: Vec) { - self.opentelemetry.report(spans); - } -} diff --git a/examples/test-harness-integration/Cargo.toml b/examples/test-harness-integration/Cargo.toml new file mode 100644 index 00000000..b3854987 --- /dev/null +++ b/examples/test-harness-integration/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "test-harness-integration" + +edition.workspace = true +publish.workspace = true +version.workspace = true + +[dependencies] +anyhow = { workspace = true } +fastrace = { workspace = true, features = ["enable"] } +test-harness = { workspace = true } +tokio = { workspace = true } + +[[bin]] +name = "test-harness-integration" +path = "main.rs" \ No newline at end of file diff --git a/examples/harness.rs b/examples/test-harness-integration/main.rs similarity index 90% rename from examples/harness.rs rename to examples/test-harness-integration/main.rs index 7d4829ae..74223586 100644 --- a/examples/harness.rs +++ b/examples/test-harness-integration/main.rs @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! This example shows how to write a test harness to set up fastrace. - #[test_harness::test(harness = test_util::setup_fastrace)] #[fastrace::trace] fn test_sync() -> anyhow::Result<()> { @@ -30,9 +28,10 @@ async fn test_async() -> anyhow::Result<()> { #[cfg(test)] mod test_util { - use fastrace::collector::Config; + use fastrace::collector::{Config, SpanContext}; use fastrace::collector::ConsoleReporter; - use fastrace::prelude::*; + use fastrace::future::FutureExt; + use fastrace::Span; pub fn setup_fastrace(test: F) where F: FnOnce() -> anyhow::Result<()> + 'static { @@ -48,7 +47,7 @@ mod test_util { pub fn setup_fastrace_async(test: F) where F: FnOnce() -> Fut + 'static, - Fut: std::future::Future> + Send + 'static, + Fut: Future> + Send + 'static, { fastrace::set_reporter(ConsoleReporter, Config::default()); let rt = tokio::runtime::Builder::new_multi_thread() diff --git a/tests/statically-disable/Cargo.toml b/tests/statically-disable/Cargo.toml deleted file mode 100644 index 2bd56232..00000000 --- a/tests/statically-disable/Cargo.toml +++ /dev/null @@ -1,15 +0,0 @@ -[package] -name = "test-statically-disable" -publish = false -version = "0.0.0" - -edition.workspace = true -license.workspace = true -repository.workspace = true -rust-version.workspace = true - -[package.metadata.release] -release = false - -[dependencies] -fastrace = { workspace = true } # do not turn on the "enable" feature From ff3de485af029eb910fb2a038666a5d446d4089d Mon Sep 17 00:00:00 2001 From: tison Date: Wed, 17 Jun 2026 22:57:18 +0800 Subject: [PATCH 07/10] ci Signed-off-by: tison --- .github/workflows/ci.yml | 68 +++++++++++++++----- Cargo.lock | 1 + crates/fastrace-futures/src/lib.rs | 9 ++- crates/fastrace-opentelemetry/src/lib.rs | 6 +- crates/fastrace/Cargo.toml | 1 + crates/fastrace/src/local/local_span_line.rs | 17 +++-- examples/console-reporter/main.rs | 4 +- examples/log-integration/main.rs | 7 +- examples/opentelemetry-reporter/main.rs | 7 +- examples/sampling/main.rs | 5 +- examples/test-harness-integration/main.rs | 13 ++-- tests-integration/tests/tests.rs | 19 +++--- 12 files changed, 105 insertions(+), 52 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b01d5d4e..899f8da7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,8 +12,6 @@ env: jobs: check: runs-on: ubuntu-24.04 - env: - FORCE_COLOR: 1 steps: - uses: actions/checkout@v6 - uses: crate-ci/typos@master @@ -23,15 +21,25 @@ jobs: - uses: dtolnay/rust-toolchain@master with: toolchain: nightly - components: rustfmt, clippy + components: rustfmt,clippy - name: Cargo version run: cargo --version - - name: Check format - run: cargo fmt --all -- --check - - name: Check clippy - run: cargo clippy --all-targets --all-features -- --deny warnings + - name: Check workspace + run: | + cargo fmt --all -- --check + cargo clippy --all-targets --all-features -- --deny warnings + - name: Check benches + working-directory: benches + run: | + cargo fmt --all -- --check + cargo clippy --all-targets --all-features -- --deny warnings + - name: Check examples + working-directory: examples + run: | + cargo fmt --all -- --check + cargo clippy --all-targets --all-features -- --deny warnings - test: + tests: runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -50,21 +58,47 @@ jobs: - uses: taiki-e/install-action@v2 with: tool: nextest,cargo-nextest - - name: Cargo version run: cargo --version - - name: Build - run: cargo build --workspace --all-targets - - - name: Run tests + - name: Run workspace tests run: | + cargo build --workspace --all-features --all-targets cargo nextest run --workspace cargo test --doc - name: Run examples + working-directory: examples + shell: bash run: | - cargo run --example asynchronous - cargo run --example synchronous - cargo run --example basic - cargo run --package test-statically-disable + set -euo pipefail + + targets=$(cargo metadata --no-deps --format-version 1 | node -e ' + const fs = require("fs"); + const metadata = JSON.parse(fs.readFileSync(0, "utf8")); + + const targets = metadata.packages.flatMap((pkg) => + pkg.targets + .filter((target) => target.kind.includes("bin")) + .map((target) => [pkg.name, target.name]), + ); + + if (targets.length === 0) { + console.error("no runnable example targets found"); + process.exit(1); + } + + for (const [pkg, target] of targets) { + console.log(`${pkg}\t${target}`); + } + ') + + while IFS=$'\t' read -r package target; do + echo "::group::cargo run --package ${package} --bin ${target}" + cargo run --package "${package}" --bin "${target}" + echo "::endgroup::" + done <<< "${targets}" + + - name: Run benches + working-directory: benches + run: cargo bench --workspace diff --git a/Cargo.lock b/Cargo.lock index 73c0cbd3..4d8419bd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -230,6 +230,7 @@ dependencies = [ "rand 0.10.1", "rtrb", "serde", + "tokio", ] [[package]] diff --git a/crates/fastrace-futures/src/lib.rs b/crates/fastrace-futures/src/lib.rs index f96b44e8..0ddfaf6e 100644 --- a/crates/fastrace-futures/src/lib.rs +++ b/crates/fastrace-futures/src/lib.rs @@ -167,7 +167,8 @@ pub struct InSpan { } impl Stream for InSpan -where T: Stream +where + T: Stream, { type Item = T::Item; @@ -190,7 +191,8 @@ where T: Stream } impl Sink for InSpan -where T: Sink +where + T: Sink, { type Error = T::Error; @@ -238,7 +240,8 @@ pub struct EnterOnPollStream { } impl Stream for EnterOnPollStream -where T: Stream +where + T: Stream, { type Item = T::Item; diff --git a/crates/fastrace-opentelemetry/src/lib.rs b/crates/fastrace-opentelemetry/src/lib.rs index b76ffd55..5c566ebf 100644 --- a/crates/fastrace-opentelemetry/src/lib.rs +++ b/crates/fastrace-opentelemetry/src/lib.rs @@ -237,9 +237,11 @@ impl OpenTelemetryReporter { /// .with_block_on(move |future| handle.block_on(future)); /// ``` pub fn with_block_on(mut self, block_on: F) -> Self - where F: for<'a> FnMut(Pin + Send + 'a>>) -> OTelSdkResult + where + F: for<'a> FnMut(Pin + Send + 'a>>) -> OTelSdkResult + Send - + 'static { + + 'static, + { self.block_on = Box::new(block_on); self } diff --git a/crates/fastrace/Cargo.toml b/crates/fastrace/Cargo.toml index 74fa930a..82e0fdf8 100644 --- a/crates/fastrace/Cargo.toml +++ b/crates/fastrace/Cargo.toml @@ -31,3 +31,4 @@ fastrace = { workspace = true, features = ["enable"] } futures-timer = { workspace = true } mockall = { workspace = true } pollster = { workspace = true } +tokio = { workspace = true } diff --git a/crates/fastrace/src/local/local_span_line.rs b/crates/fastrace/src/local/local_span_line.rs index c285b4db..74fba545 100644 --- a/crates/fastrace/src/local/local_span_line.rs +++ b/crates/fastrace/src/local/local_span_line.rs @@ -198,13 +198,16 @@ span1 [] let span = span_line.start_span("span").unwrap(); let current_token = span_line.current_collect_token().unwrap(); - assert_eq!(current_token, CollectToken { - trace_id: TraceId(1234), - parent_id: span_line.span_queue.current_parent_id().unwrap(), - collect_id: 42, - is_root: false, - is_sampled: true, - }); + assert_eq!( + current_token, + CollectToken { + trace_id: TraceId(1234), + parent_id: span_line.span_queue.current_parent_id().unwrap(), + collect_id: 42, + is_root: false, + is_sampled: true, + } + ); span_line.finish_span(span); let current_token = span_line.current_collect_token().unwrap(); diff --git a/examples/console-reporter/main.rs b/examples/console-reporter/main.rs index 36f80994..fc95a4bc 100644 --- a/examples/console-reporter/main.rs +++ b/examples/console-reporter/main.rs @@ -15,7 +15,9 @@ use std::time::Duration; use fastrace::Span; -use fastrace::collector::{Config, ConsoleReporter, SpanContext}; +use fastrace::collector::Config; +use fastrace::collector::ConsoleReporter; +use fastrace::collector::SpanContext; use fastrace::local::LocalSpan; fn func1(i: u64) { diff --git a/examples/log-integration/main.rs b/examples/log-integration/main.rs index a6613690..771c29db 100644 --- a/examples/log-integration/main.rs +++ b/examples/log-integration/main.rs @@ -12,13 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -use fastrace::collector::{Config, SpanContext}; +use fastrace::Span; +use fastrace::collector::Config; use fastrace::collector::ConsoleReporter; +use fastrace::collector::SpanContext; +use fastrace::local::LocalSpan; use logforth::append; use logforth::diagnostic; use logforth::layout; -use fastrace::local::LocalSpan; -use fastrace::Span; #[logcall::logcall("debug")] #[fastrace::trace] diff --git a/examples/opentelemetry-reporter/main.rs b/examples/opentelemetry-reporter/main.rs index a92994de..3192bf4b 100644 --- a/examples/opentelemetry-reporter/main.rs +++ b/examples/opentelemetry-reporter/main.rs @@ -14,11 +14,12 @@ use std::borrow::Cow; -use fastrace::collector::{Config, SpanContext}; -use opentelemetry_otlp::WithExportConfig; +use fastrace::Span; +use fastrace::collector::Config; +use fastrace::collector::SpanContext; use fastrace::future::FutureExt; use fastrace::local::LocalSpan; -use fastrace::Span; +use opentelemetry_otlp::WithExportConfig; fn parallel_job() -> Vec> { let mut v = Vec::with_capacity(4); diff --git a/examples/sampling/main.rs b/examples/sampling/main.rs index d05019f5..c30d984c 100644 --- a/examples/sampling/main.rs +++ b/examples/sampling/main.rs @@ -14,9 +14,10 @@ use std::time::Duration; -use fastrace::collector::{Config, SpanContext}; -use fastrace::collector::ConsoleReporter; use fastrace::Span; +use fastrace::collector::Config; +use fastrace::collector::ConsoleReporter; +use fastrace::collector::SpanContext; fn main() { fastrace::set_reporter(ConsoleReporter, Config::default()); diff --git a/examples/test-harness-integration/main.rs b/examples/test-harness-integration/main.rs index 74223586..a65244e7 100644 --- a/examples/test-harness-integration/main.rs +++ b/examples/test-harness-integration/main.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +fn main() {} + #[test_harness::test(harness = test_util::setup_fastrace)] #[fastrace::trace] fn test_sync() -> anyhow::Result<()> { @@ -28,13 +30,16 @@ async fn test_async() -> anyhow::Result<()> { #[cfg(test)] mod test_util { - use fastrace::collector::{Config, SpanContext}; + use fastrace::Span; + use fastrace::collector::Config; use fastrace::collector::ConsoleReporter; + use fastrace::collector::SpanContext; use fastrace::future::FutureExt; - use fastrace::Span; pub fn setup_fastrace(test: F) - where F: FnOnce() -> anyhow::Result<()> + 'static { + where + F: FnOnce() -> anyhow::Result<()> + 'static, + { fastrace::set_reporter(ConsoleReporter, Config::default()); { let root = Span::root(closure_name::(), SpanContext::random()); @@ -68,5 +73,3 @@ mod test_util { .unwrap() } } - -fn main() {} diff --git a/tests-integration/tests/tests.rs b/tests-integration/tests/tests.rs index a6bd7ec5..5b3b4567 100644 --- a/tests-integration/tests/tests.rs +++ b/tests-integration/tests/tests.rs @@ -206,7 +206,7 @@ fn multiple_threads_single_span() { handles.into_iter().for_each(|h| h.join().unwrap()); }) - .unwrap(); + .unwrap(); fastrace::flush(); @@ -359,10 +359,10 @@ fn test_macro() { Bar.work2(&100).await; work3(&100, &100).await; } - .in_span(root), + .in_span(root), ), ) - .unwrap(); + .unwrap(); } fastrace::flush(); @@ -429,13 +429,14 @@ fn macro_example() { fastrace::flush(); let graph = tree_str_from_span_records(collected_spans.lock().clone()); - insta::assert_snapshot!(graph,@r###" + insta::assert_snapshot!(graph,@" + root [] do_something_async_short_name [] do_something_short_name [] - lib::macro_example::{{closure}}::do_something [] - lib::macro_example::{{closure}}::do_something_async::{{closure}} [] - "###); + tests::macro_example::{{closure}}::do_something [] + tests::macro_example::{{closure}}::do_something_async::{{closure}} [] + "); } #[test] @@ -623,10 +624,10 @@ fn test_macro_properties() { foo_async(1, &Bar, Bar).await; bar_async().await; } - .in_span(root), + .in_span(root), ), ) - .unwrap(); + .unwrap(); } fastrace::flush(); From 5e31aecce024f69fc0e2e3b1a237ced3f9840d17 Mon Sep 17 00:00:00 2001 From: tison Date: Wed, 17 Jun 2026 23:04:45 +0800 Subject: [PATCH 08/10] fixup Signed-off-by: tison --- .github/workflows/ci.yml | 27 +++++++------------- Cargo.toml | 2 +- benches/Cargo.toml | 8 +++--- examples/Cargo.toml | 25 +++++++++--------- examples/console-reporter/Cargo.toml | 2 +- examples/fastrace-disabled/Cargo.toml | 2 +- examples/log-integration/Cargo.toml | 1 - examples/sampling/Cargo.toml | 2 +- examples/test-harness-integration/Cargo.toml | 2 +- 9 files changed, 31 insertions(+), 40 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 899f8da7..c0b06471 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -73,24 +73,15 @@ jobs: run: | set -euo pipefail - targets=$(cargo metadata --no-deps --format-version 1 | node -e ' - const fs = require("fs"); - const metadata = JSON.parse(fs.readFileSync(0, "utf8")); - - const targets = metadata.packages.flatMap((pkg) => - pkg.targets - .filter((target) => target.kind.includes("bin")) - .map((target) => [pkg.name, target.name]), - ); - - if (targets.length === 0) { - console.error("no runnable example targets found"); - process.exit(1); - } - - for (const [pkg, target] of targets) { - console.log(`${pkg}\t${target}`); - } + targets=$(cargo metadata --no-deps --format-version 1 | jq -er ' + [ + .packages[] as $package + | $package.targets[] + | select(.kind | index("bin")) + | [$package.name, .name] + | @tsv + ] + | if length == 0 then error("no runnable example targets found") else .[] end ') while IFS=$'\t' read -r package target; do diff --git a/Cargo.toml b/Cargo.toml index 2a520605..5ae94aa2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,8 +20,8 @@ rust-version = "1.91.0" [workspace.dependencies] # Workspace dependencies fastrace = { version = "0.7.18", path = "crates/fastrace" } -fastrace-macro = { version = "0.7.18", path = "crates/fastrace-macro" } fastrace-futures = { path = "crates/fastrace-futures" } +fastrace-macro = { version = "0.7.18", path = "crates/fastrace-macro" } fastrace-opentelemetry = { path = "crates/fastrace-opentelemetry" } # crates.io dependencies diff --git a/benches/Cargo.toml b/benches/Cargo.toml index a09db420..05d7318f 100644 --- a/benches/Cargo.toml +++ b/benches/Cargo.toml @@ -12,14 +12,14 @@ fastrace = { path = "../crates/fastrace", features = ["enable"] } fastrace-opentelemetry = { path = "../crates/fastrace-opentelemetry" } flume = { version = "0.12.0" } opentelemetry = { version = "0.32.0", default-features = false, features = [ - "trace", + "trace", ] } opentelemetry-otlp = { version = "0.32.0", default-features = false, features = [ - "trace", - "grpc-tonic", + "trace", + "grpc-tonic", ] } opentelemetry_sdk = { version = "0.32.1", default-features = false, features = [ - "trace", + "trace", ] } pollster = { version = "0.4.0" } rtrb = { version = "0.3.4" } diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 6783bb31..54bb83bd 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -1,9 +1,11 @@ [workspace] members = [ - "console-reporter", "fastrace-disabled", "log-integration", - "opentelemetry-reporter", - "sampling", - "test-harness-integration", + "console-reporter", + "fastrace-disabled", + "log-integration", + "opentelemetry-reporter", + "sampling", + "test-harness-integration", ] resolver = "3" @@ -19,24 +21,23 @@ fastrace-opentelemetry = { path = "../crates/fastrace-opentelemetry" } log = { version = "0.4.32" } logcall = { version = "0.2.0" } logforth = { version = "0.30.1", features = [ - "append-fastrace", - "diagnostic-fastrace", - "starter-log", + "append-fastrace", + "diagnostic-fastrace", + "starter-log", ] } opentelemetry = { version = "0.32.0", default-features = false, features = [ - "trace", + "trace", ] } opentelemetry-otlp = { version = "0.32.0", default-features = false, features = [ - "trace", - "grpc-tonic", + "trace", + "grpc-tonic", ] } opentelemetry_sdk = { version = "0.32.1", default-features = false, features = [ - "trace", + "trace", ] } test-harness = { version = "0.3.1" } tokio = { version = "1.52.3", features = ["full"] } - [patch.crates-io] # Patch fastrace in crates.io because we import logforth in the examples, which # itself depends on fastrace from crates.io. If we don't do this, example break diff --git a/examples/console-reporter/Cargo.toml b/examples/console-reporter/Cargo.toml index ea067cb4..4fcbb4d3 100644 --- a/examples/console-reporter/Cargo.toml +++ b/examples/console-reporter/Cargo.toml @@ -10,4 +10,4 @@ fastrace = { workspace = true, features = ["enable"] } [[bin]] name = "console-reporter" -path = "main.rs" \ No newline at end of file +path = "main.rs" diff --git a/examples/fastrace-disabled/Cargo.toml b/examples/fastrace-disabled/Cargo.toml index cb73f453..c8bb4034 100644 --- a/examples/fastrace-disabled/Cargo.toml +++ b/examples/fastrace-disabled/Cargo.toml @@ -10,4 +10,4 @@ fastrace = { workspace = true } # do not turn on the "enable" feature [[bin]] name = "fastrace-disabled" -path = "main.rs" \ No newline at end of file +path = "main.rs" diff --git a/examples/log-integration/Cargo.toml b/examples/log-integration/Cargo.toml index c30e807b..bab3aaba 100644 --- a/examples/log-integration/Cargo.toml +++ b/examples/log-integration/Cargo.toml @@ -11,7 +11,6 @@ log = { workspace = true } logcall = { workspace = true } logforth = { workspace = true } - [[bin]] name = "log-integration" path = "main.rs" diff --git a/examples/sampling/Cargo.toml b/examples/sampling/Cargo.toml index 9ad4007c..628c99c6 100644 --- a/examples/sampling/Cargo.toml +++ b/examples/sampling/Cargo.toml @@ -10,4 +10,4 @@ fastrace = { workspace = true, features = ["enable"] } [[bin]] name = "sampling" -path = "main.rs" \ No newline at end of file +path = "main.rs" diff --git a/examples/test-harness-integration/Cargo.toml b/examples/test-harness-integration/Cargo.toml index b3854987..ba935e46 100644 --- a/examples/test-harness-integration/Cargo.toml +++ b/examples/test-harness-integration/Cargo.toml @@ -13,4 +13,4 @@ tokio = { workspace = true } [[bin]] name = "test-harness-integration" -path = "main.rs" \ No newline at end of file +path = "main.rs" From 831620144da2adc3469d8c6be4a895fa812e40b8 Mon Sep 17 00:00:00 2001 From: tison Date: Wed, 17 Jun 2026 23:14:16 +0800 Subject: [PATCH 09/10] f windows Signed-off-by: tison --- .github/workflows/ci.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c0b06471..1e84f279 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -73,7 +73,7 @@ jobs: run: | set -euo pipefail - targets=$(cargo metadata --no-deps --format-version 1 | jq -er ' + cargo metadata --no-deps --format-version 1 | jq -er ' [ .packages[] as $package | $package.targets[] @@ -82,13 +82,11 @@ jobs: | @tsv ] | if length == 0 then error("no runnable example targets found") else .[] end - ') - - while IFS=$'\t' read -r package target; do + ' | tr -d '\r' | while IFS=$'\t' read -r package target; do echo "::group::cargo run --package ${package} --bin ${target}" cargo run --package "${package}" --bin "${target}" echo "::endgroup::" - done <<< "${targets}" + done - name: Run benches working-directory: benches From 97e757cfa027e8dac353b76d34956fe105b56cbd Mon Sep 17 00:00:00 2001 From: tison Date: Thu, 18 Jun 2026 02:50:02 +0800 Subject: [PATCH 10/10] fixup Signed-off-by: tison --- Cargo.toml | 15 +++++++-------- crates/fastrace-futures/Cargo.toml | 10 +++++----- crates/fastrace-macro/Cargo.toml | 6 +++--- crates/fastrace-opentelemetry/Cargo.toml | 2 +- crates/fastrace/Cargo.toml | 8 ++++---- examples/Cargo.toml | 2 +- 6 files changed, 21 insertions(+), 22 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5ae94aa2..31b73967 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,13 +1,6 @@ [workspace] exclude = ["benches", "examples"] -members = [ - "crates/fastrace", - "crates/fastrace-macro", - "crates/fastrace-opentelemetry", - "crates/fastrace-futures", - "tests-build", - "tests-integration", -] +members = ["crates/*", "tests-build", "tests-integration"] resolver = "3" [workspace.package] @@ -25,7 +18,10 @@ fastrace-macro = { version = "0.7.18", path = "crates/fastrace-macro" } fastrace-opentelemetry = { path = "crates/fastrace-opentelemetry" } # crates.io dependencies +fastant = { version = "0.1.11" } futures = { version = "0.3.32" } +futures-core = { version = "0.3.32" } +futures-sink = { version = "0.3.32" } log = { version = "0.4.32" } opentelemetry = { version = "0.32.0", default-features = false, features = [ "trace", @@ -37,6 +33,9 @@ opentelemetry-otlp = { version = "0.32.0", default-features = false, features = opentelemetry_sdk = { version = "0.32.1", default-features = false, features = [ "trace", ] } +parking_lot = { version = "0.12.5" } +pin-project = { version = "1.1.13" } +rand = { version = "0.10.1" } rtrb = { version = "0.3.4" } serde = { version = "1.0.228", features = ["derive"] } diff --git a/crates/fastrace-futures/Cargo.toml b/crates/fastrace-futures/Cargo.toml index 273693ea..8bbf3707 100644 --- a/crates/fastrace-futures/Cargo.toml +++ b/crates/fastrace-futures/Cargo.toml @@ -15,12 +15,12 @@ rust-version.workspace = true [dependencies] fastrace = { workspace = true } -futures-core = { version = "0.3.31" } -futures-sink = { version = "0.3.31" } -pin-project = { version = "1.1.8" } +futures-core = { workspace = true } +futures-sink = { workspace = true } +pin-project = { workspace = true } [dev-dependencies] -async-stream = { version = "0.3" } +async-stream = { workspace = true } fastrace = { workspace = true, features = ["enable"] } -futures = { version = "0.3" } +futures = { workspace = true } tokio = { workspace = true } diff --git a/crates/fastrace-macro/Cargo.toml b/crates/fastrace-macro/Cargo.toml index f7c50c76..290a719c 100644 --- a/crates/fastrace-macro/Cargo.toml +++ b/crates/fastrace-macro/Cargo.toml @@ -20,9 +20,9 @@ proc-macro = true enable = [] [dependencies] -proc-macro2 = "1.0" -quote = "1.0" -syn = { version = "2.0", features = [ +proc-macro2 = { version = "1.0.106" } +quote = { version = "1.0.45" } +syn = { version = "2.0.118", features = [ "full", "parsing", "extra-traits", diff --git a/crates/fastrace-opentelemetry/Cargo.toml b/crates/fastrace-opentelemetry/Cargo.toml index 79cb3398..302c03fc 100644 --- a/crates/fastrace-opentelemetry/Cargo.toml +++ b/crates/fastrace-opentelemetry/Cargo.toml @@ -18,7 +18,7 @@ fastrace = { workspace = true } log = { workspace = true } opentelemetry = { workspace = true } opentelemetry_sdk = { workspace = true } -pollster = { version = "0.4.0" } +pollster = { workspace = true } [dev-dependencies] fastrace = { workspace = true, features = ["enable"] } diff --git a/crates/fastrace/Cargo.toml b/crates/fastrace/Cargo.toml index 82e0fdf8..2fcedf54 100644 --- a/crates/fastrace/Cargo.toml +++ b/crates/fastrace/Cargo.toml @@ -17,11 +17,11 @@ rust-version.workspace = true enable = ["fastrace-macro/enable"] [dependencies] -fastant = "0.1" +fastant = { workspace = true } fastrace-macro = { workspace = true } -parking_lot = "0.12" -pin-project = { version = "1.1.8" } -rand = "0.10.0" +parking_lot = { workspace = true } +pin-project = { workspace = true } +rand = { workspace = true } rtrb = { workspace = true } serde = { workspace = true } diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 54bb83bd..4185fff8 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -40,7 +40,7 @@ tokio = { version = "1.52.3", features = ["full"] } [patch.crates-io] # Patch fastrace in crates.io because we import logforth in the examples, which -# itself depends on fastrace from crates.io. If we don't do this, example break +# itself depends on fastrace from crates.io. If we don't do this, examples break # because logforth brings in a different version of fastrace and the appender # stops working. fastrace = { path = "../crates/fastrace" }