New crate: metrique-battery-pack
Ref: battery-pack repo, authoring guide
Motivation
metrique has 13 crates in its workspace. A basic "define a struct, set up a sink, emit on drop" workflow touches three crates and four or five trait imports from different modules. Good candidate for a battery pack.
Most of the workspace crates are already re-exported by metrique behind feature flags. The battery pack should enable those flags rather than adding the underlying crates as separate dependencies.
Default set
Just metrique itself.
Features
| Feature |
What it enables |
Notes |
emf |
metrique/emf |
CloudWatch Embedded Metric Format |
json |
metrique/json |
Plain JSON output |
aggregation |
metrique-aggregation |
#[aggregate], Histogram, Sum, KeyedAggregator, WorkerSink |
util |
metrique-util |
State<T> for shared runtime state |
Templates
Multiple templates, each with tests demonstrating test-util feature enablement. A shared METRIQUE.md (trait import cheat sheet, next steps, how to switch formats) is included in all templates via [[files]]. Templates can use MiniJinja placeholder variables (e.g., format = emf/json) to branch on sink setup, Cargo features, and imports.
cargo bp new metrique --name my-service
# prompts for template selection
| Template |
What it scaffolds |
default |
Async runtime, sink initialization (MiniJinja format placeholder for emf/json), global metrics setup (merge_globals), sample #[metrics] request handler with emit on drop |
library |
#[metrics(subfield)] function using Instrumented, returning metrics to the caller |
aggregation |
#[aggregate] with Histogram/Sum, embedded via Aggregate<T>, KeyedAggregator |
New crate:
metrique-battery-packRef: battery-pack repo, authoring guide
Motivation
metrique has 13 crates in its workspace. A basic "define a struct, set up a sink, emit on drop" workflow touches three crates and four or five trait imports from different modules. Good candidate for a battery pack.
Most of the workspace crates are already re-exported by
metriquebehind feature flags. The battery pack should enable those flags rather than adding the underlying crates as separate dependencies.Default set
Just
metriqueitself.Features
emfmetrique/emfjsonmetrique/jsonaggregationmetrique-aggregation#[aggregate],Histogram,Sum,KeyedAggregator,WorkerSinkutilmetrique-utilState<T>for shared runtime stateTemplates
Multiple templates, each with tests demonstrating
test-utilfeature enablement. A sharedMETRIQUE.md(trait import cheat sheet, next steps, how to switch formats) is included in all templates via[[files]]. Templates can use MiniJinja placeholder variables (e.g.,format=emf/json) to branch on sink setup, Cargo features, and imports.defaultformatplaceholder foremf/json), global metrics setup (merge_globals), sample#[metrics]request handler with emit on droplibrary#[metrics(subfield)]function usingInstrumented, returning metrics to the calleraggregation#[aggregate]withHistogram/Sum, embedded viaAggregate<T>,KeyedAggregator