Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proc-macro pipeline (issue #113) #127

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: CI

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

env:
CARGO_TERM_COLOR: always
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ jobs:
RUSTDOCFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off"
run: |
cargo test --workspace --all-features --no-fail-fast
cargo run --example synchronous
cargo run --example asynchronous
cargo run --example get_started
cargo run --example log
cargo run --example synchronous
cargo run --example unit_test
- id: coverage
uses: actions-rs/grcov@v0.1
- name: Coveralls upload
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@

.idea
Cargo.lock
*.log
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Unreleased

- Refactor `minitrace-macro` to pipeline model (issue #113).
- Issue #142: Attribute arguments are all keyword/named arguments. Position arguments deprecated.
- Issue #128: Attribute parsing errors should not break IDE completion, etc.
- Issue #112: Fixed

## v0.5.1

- Fix panics due to destruction of Thread Local Storage value
Expand All @@ -19,7 +24,7 @@
- Remove `LocalSpanGuard` and merge it into `LocalSpan`.
- Remove `LocalSpan::with_property`, `LocalSpan::with_properties`, `Span::with_property` and `Span::with_properties`.
- Add `LocalSpan::add_property`, `LocalSpan::add_properties`, `Span::add_property` and `Span::add_properties`.
- Remove `LocalParentGuard`. `Span::set_local_parent` returns a general `Option<Guard<impl FnOnce()>>` instead.
- Remove `LocalParentGuard`. `Span::set_local_parent` returns a general `Option<Guard<impl FnOnce()>>` instead.

## v0.3.1

Expand Down
86 changes: 82 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,92 @@
[package]
name = "minitrace"
version = "0.5.1"
authors = ["The TiKV Project Authors"]
license = "Apache-2.0"
rust-version = "1.56.0"
edition = "2021"
description = "A high-performance timeline tracing library for Rust"
homepage = "https://github.com/tikv/minitrace-rust"
repository = "https://github.com/tikv/minitrace-rust"
documentation = "https://docs.rs/minitrace"
readme = "README.md"
keywords = ["tracing", "span", "datadog", "jaeger", "opentracing"]

[workspace]
resolver = "2"
members = [
"minitrace",
"minitrace-macro",
"minitrace-jaeger",
"minitrace-datadog",
"minitrace-opentelemetry",
"test-no-report",
"minitrace-tests",
]
exclude = ["minitrace-old"]

[dependencies]
futures = "0.3"
minitrace-macro = { version = "0.5.1", path = "minitrace-macro", optional = true}
minstant = "0.1"
parking_lot = "0.12"
pin-project = "1.0"
# TODO: Remove once_cell once #![feature(once_cell)] is stabilized
once_cell = "1"
rand = "0.8"

[dev-dependencies]
# The procedural macro `trace` only supports async-trait higher than 0.1.52
async-trait = "0.1.52"
criterion = { version = "0.3", features = ["html_reports"] }
crossbeam = "0.8"
env_logger = "0.10"
futures = "0.3"
futures-timer = "3"
log = "0.4"
logcall = "0.1.4"
minitrace-datadog = { path = "minitrace-datadog" }
minitrace-jaeger = { path = "minitrace-jaeger" }
minitrace-opentelemetry = { version = "0.5.1", path = "minitrace-opentelemetry" }
mockall = "0.11"
once_cell = "1"
opentelemetry = { version = "0.19", default-features = false, features = ["trace"] }
opentelemetry-otlp = { version = "0.12", features = ["trace"] }
rand = "0.8"
rustracing = "0.6"
serial_test = "2"
test-harness = "0.1.1"
tokio = { version = "1", features = ["rt", "time", "macros"] }
tracing = "0.1"
tracing-core = "0.1"
tracing-opentelemetry = "0.15"
tracing-subscriber = "0.2"

# Cargo does not pass on features to subcrates in a virtual workspace
# https://github.com/rust-lang/cargo/issues/4942
#
# Workaround:
#
# export MINITRACE_FEATURES="default minitrace-tests/tk"
# cargo test --manifest-path=moniker/Cargo.toml --no-default-features --features="$MINITRACE_FEATURES" test-name
#
[features]
default = ["attributes", "enable"]
attributes = ["minitrace-macro"]
ci = []
enable = []

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

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

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

[profile.bench]
opt-level = 3
lto = true
[[bench]]
name = "object_pool"
harness = false
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
// Copyright 2022 TiKV Project Authors. Licensed under Apache-2.0.

//! # Get started
//!
//! 1. Setup a trace viewer/frontend. Jaeger example:
//! ```ignore
//! podman run -p6831:6831/udp -p6832:6832/udp -p16686:16686 jaegertracing/all-in-one:latest
//! ```
//!
use minitrace::collector::Config;
use minitrace::collector::ConsoleReporter;
use minitrace::prelude::*;
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 3 additions & 1 deletion minitrace/examples/unit_test.rs → examples/unit_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ mod test_util {
use super::*;

pub fn setup_minitrace<F>(test: F)
where F: FnOnce() -> Result<()> + 'static {
where
F: FnOnce() -> Result<()> + 'static,
{
minitrace::set_reporter(ConsoleReporter, Config::default());
{
let root = Span::root(closure_name::<F>(), SpanContext::random());
Expand Down
1 change: 1 addition & 0 deletions img/benchmark.jpeg
1 change: 1 addition & 0 deletions img/jaeger-asynchronous.png
1 change: 1 addition & 0 deletions img/jaeger-synchronous.png
2 changes: 1 addition & 1 deletion minitrace-datadog/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ categories = ["development-tools::debugging"]
keywords = ["tracing", "span", "datadog", "jaeger", "opentelemetry"]

[dependencies]
minitrace = { path = "../minitrace" }
minitrace = { path = "../" }
reqwest = { version = "0.11", features = ["blocking"] }
rmp-serde = "1"
serde = { version = "1", features = ["derive"] }
Expand Down
2 changes: 1 addition & 1 deletion minitrace-jaeger/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ keywords = ["tracing", "span", "datadog", "jaeger", "opentelemetry"]

[dependencies]
log = "0.4"
minitrace = { path = "../minitrace" }
minitrace = { path = "../" }
thrift_codec = "0.2"

[dev-dependencies]
Expand Down
22 changes: 18 additions & 4 deletions minitrace-macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name = "minitrace-macro"
version = "0.5.1"
authors = ["The TiKV Project Authors"]
license = "Apache-2.0"
rust-version = "1.56.0"
edition = "2021"
description = "Attribute procedural macro for minitrace-rust"
homepage = "https://github.com/tikv/minitrace-rust"
Expand All @@ -16,17 +17,30 @@ keywords = ["tracing", "span", "datadog", "jaeger", "opentelemetry"]
proc-macro = true

[dependencies]
# The macro `quote_spanned!` is added to syn in 1.0.84
proc-macro-error = "1"
darling = "0.20"
proc-macro2 = "1"
quote = "1"
syn = { version = "1.0.84", features = ["full", "parsing", "extra-traits", "proc-macro", "visit-mut"] }
# The macro `quote_spanned!` is added to syn in 1.0.84
syn = { version = "1.0.84", features = ["full", "parsing", "extra-traits", "proc-macro", "visit", "visit-mut"] }
thiserror = "1.0.30"
tree-flat = "0.1.1"

[dev-dependencies]
aquamarine = "0.1"
futures = "0.3"
futures-timer = "3.0"
logcall = "0.1.4"
minitrace = { path = "../minitrace" }
macrotest = "1"
minitrace = { path = "../" }
minitrace-jaeger = { path = "../minitrace-jaeger" }
rand = "0.8"
test-utilities = { path = "../test-utilities" }
tokio = { version = "1", features = ["full"] }
trybuild = "1"
# The procedural macro `trace` only supports async-trait higher than 0.1.52
async-trait = "0.1.52"
log = "0.4"

[features]
default = []
ci = []
Loading