Skip to content

Commit a315ebc

Browse files
committed
Update 0.7.0
1 parent 810a23a commit a315ebc

21 files changed

Lines changed: 1049 additions & 106 deletions

.github/workflows/ci.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,14 @@ jobs:
7373
fail-fast: false
7474
matrix:
7575
features:
76-
- "" # no default features (no_std build)
77-
- "minimal" # minimal feature
78-
- "std" # std only
79-
- "all" # std + benchmark
76+
- "" # no default features (no_std build)
77+
- "benchmark" # timing only
78+
- "collector" # collector + histogram
79+
- "metrics" # production metrics
80+
- "high-precision" # high-precision backend (collector implied)
81+
- "hdr" # external HDR backend (high-precision implied)
82+
- "metrics high-precision" # metrics + high-precision
83+
- "metrics hdr" # metrics + hdr backend
8084

8185
steps:
8286
- name: Checkout code

CHANGELOG.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,24 @@
99
</p>
1010

1111
## [Unreleased]
12+
### Changed
13+
- BREAKING: Refactored feature flags to a clearer model. New flags:
14+
- `benchmark` (default): enables real timing and benchmarking macros; implies `std` internally.
15+
- `collector` (default): enables `Collector`, `Stats`, and built-in histogram; implies `std` internally.
16+
- `metrics`: enables production metrics (`Watch`, `Timer`, `stopwatch!`); implies `collector`.
17+
- `high-precision`: enables high-precision histogram backend; implies `collector`.
18+
- `hdr`: enables external HDR histogram backend (optional dep `hdrhistogram`); requires `high-precision`.
19+
- Note: `std` is now an internal implementation detail implied by higher-level features.
20+
- Removed legacy/alias features: `minimal`, `standard`, `all`, and public `std` flag.
1221

22+
### Added
23+
- Optional dependency `hdrhistogram = "7"` behind the `hdr` feature.
24+
- CI updated to test new feature matrix, including combinations like `metrics high-precision` and `metrics hdr`.
1325

14-
15-
26+
### Migration
27+
- For benchmarking-only users: no change needed (defaults remain timing + in-process stats).
28+
- For production metrics: replace `features = ["standard"]` with `features = ["metrics"]`.
29+
- For consumers of `Collector`/histogram only: use `features = ["collector"]`.
1630

1731

1832
<br>

Cargo.lock

Lines changed: 71 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 60 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,25 @@ authors = [
5454
#╚═══════════════════════════════════════════════════════════╝
5555
[features]
5656

57-
# Standard Features
58-
std = [] # Use the Rust standard library (disables no_std).
59-
benchmark = [] # Benchmarking enabled (can be disabled for true zero-overhead).
60-
metrics = ["std"] # Use production metrics (Watch/Timer) and Rust standard library
61-
# Gate perf-sensitive unit tests/benches so they can be opted into explicitly
62-
perf-tests = []
63-
long-tests = []
64-
65-
# Use parking_lot for faster RwLock in hot paths
66-
parking-lot-locks = ["dep:parking_lot"]
57+
# Internal std switch (activated by higher-level features)
58+
std = []
59+
60+
# Core features
61+
default = ["benchmark", "collector"] # Turn-key dev: timing + in-process stats
62+
benchmark = ["std"] # Enable real timing
63+
collector = ["std"] # Collector + histogram
64+
metrics = ["collector"] # Watch/Timer production metrics
65+
66+
# Precision backends
67+
high-precision = ["collector"] # Swap to high-precision histogram backend
68+
hdr = ["high-precision", "dep:hdrhistogram"] # Use external HDR histogram backend
6769

68-
# Feature Combinations
69-
minimal = [] # Minimal build with core timing only (no default features).
70-
default = ["std", "benchmark"] # Default features (includes std and benchmark).
71-
standard = ["metrics", "benchmark"] # Default features (includes std and benchmark).
72-
all = ["std", "benchmark", "metrics"] # Complete build with all features enabled.
70+
# Perf/long tests are opt-in
71+
perf-tests = []
72+
long-tests = []
73+
74+
# Faster locks in hot paths (optional)
75+
parking-lot-locks = ["dep:parking_lot"]
7376

7477

7578

@@ -106,6 +109,9 @@ harness = false
106109
# Optional: faster synchronization primitives
107110
parking_lot = { version = "0.12", optional = true }
108111

112+
# Optional: external HDR histogram backend
113+
hdrhistogram = { version = "7", optional = true }
114+
109115

110116
#╔═══════════════════════════════════════════════════════════╗
111117
#║ 🧩 DEV DEPENDENCIES
@@ -114,4 +120,42 @@ parking_lot = { version = "0.12", optional = true }
114120
tokio = { version = "1", features = ["macros", "rt-multi-thread", "time"] }
115121
trybuild = "1.0"
116122
criterion = "0.5"
117-
proptest = "1"
123+
proptest = "1"
124+
125+
#╔═══════════════════════════════════════════════════════════╗
126+
#║ 🧪 EXAMPLES (with required-features)
127+
#╚═══════════════════════════════════════════════════════════╝
128+
[[example]]
129+
name = "zero_overhead"
130+
path = "examples/zero_overhead.rs"
131+
# zero_overhead should compile in no-default-features mode
132+
133+
[[example]]
134+
name = "basic_cli"
135+
path = "examples/basic_cli.rs"
136+
required-features = ["benchmark"]
137+
138+
[[example]]
139+
name = "overhead_compare"
140+
path = "examples/overhead_compare.rs"
141+
required-features = ["benchmark"]
142+
143+
[[example]]
144+
name = "async_task"
145+
path = "examples/async_task.rs"
146+
required-features = ["benchmark"]
147+
148+
[[example]]
149+
name = "multi_threaded_collection"
150+
path = "examples/multi_threaded_collection.rs"
151+
required-features = ["collector"]
152+
153+
[[example]]
154+
name = "prometheus_textfile"
155+
path = "examples/prometheus_textfile.rs"
156+
required-features = ["metrics"]
157+
158+
[[example]]
159+
name = "web_server"
160+
path = "examples/web_server.rs"
161+
required-features = ["metrics"]

0 commit comments

Comments
 (0)