Releases: awslabs/metrique
metrique-v0.1.25
Added
-
pending_sinkinmetrique-util(feature:pending-sink): deferred sink attachment with bounded buffering. (#275)- Emit metrics immediately during startup while the real sink initializes asynchronously.
- Entries buffer in a lock-free ring buffer; oldest dropped when full.
resolver.resolve(real_sink)drains the buffer and switches to direct forwarding.
use metrique_util::pending_sink; // Create a pending sink that buffers up to 1024 entries. let (sink, resolver) = pending_sink::new(1024); // Attach immediately so metrics start buffering during startup. let _handle = ServiceMetrics::attach((sink, ())); // Later, once the real sink is ready (after async init, credential // exchange, etc.): resolver.resolve(real_sink); // Buffered entries drain into the real sink; future appends go direct.
Other
metrique-v0.1.24
Added
-
Tokio runtime metrics integration via
metrique-util(feature:tokio-metrics-bridge). Spawns a background reporter that periodically appendsRuntimeMetricssnapshots (worker utilization, park counts, queue depths, poll durations, etc.) to the attached sink. The reporter is automatically aborted when the attach handle drops. (#256)use metrique_util::{AttachGlobalEntrySinkTokioMetricsExt, TokioRuntimeMetricsConfig}; let _handle = ServiceMetrics::attach_to_stream( Emf::all_validations("MyApp".to_string(), vec![vec![]]) .output_to(std::io::stderr()), ); let config = TokioRuntimeMetricsConfig::default() .with_interval(Duration::from_secs(30)) .with_name_style(MetricNameStyle::KebabCase); ServiceMetrics::subscribe_tokio_runtime_metrics(config);
-
Vec<V: Value>and[V: Value]now implementValue, so vector fields emit as native JSON arrays in EMF and comma-joined strings in other formats. Elements that write nothing (e.g.NoneinVec<Option<String>>) are skipped automatically. (#266)#[metrics(rename_all = "PascalCase")] struct RequestMetrics { plugins: Vec<String>, request_count: u32, } // EMF output: {"Plugins": ["auth", "cache"], "RequestCount": 5} // Default: Plugins=auth,cache
-
OwnedCounterGuard: an owned variant ofCounterGuardthat holds anArc<Counter>instead of a reference, allowing it to be moved across async boundaries or stored in structs without lifetime constraints. Returned byCounter::increment_owned. (#265)use std::sync::Arc; use metrique::Counter; let counter = Arc::new(Counter::new(0)); let (guard, count) = counter.increment_owned(); // +1 now, -1 on drop // guard can be stored in a response body wrapper, moved into a spawned task, etc. tokio::spawn(async move { do_work().await; drop(guard); // decrements when the task completes });
Fixed
- Convert broken reference-style links to inline links in README (#262)
metrique-v0.1.23
metrique-v0.1.22
Fixed
- (doc) Fix docs.rs build failure for
metriquecrate (#245)
metrique-v0.1.21
Added
-
Pure JSON output format via
metrique::json::Json(#224)let _handle = ServiceMetrics::attach_to_stream( Json::new().output_to_makewriter(|| std::io::stdout().lock()), ); // {"timestamp":...,"metrics":{...},"properties":{...}}
-
Counter::increment_scoped: returns a guard that decrements on drop, for tracking in-flight work (#235)static IN_FLIGHT: Counter = Counter::new(0); let _guard = IN_FLIGHT.increment_scoped(); // +1 now and for this metric, -1 on drop
-
Counter::newis nowconst fn, enablingstatic Counterdeclarations (#235) -
CloseValueimpl forCounterGuardandOnceLock<T>(#235) -
metrique-utilcrate withState<T>(feature:state): atomically swappable shared value with snapshot-on-first-read semantics (#235)let shared = State::new(AppConfig::default()); shared.store(Arc::new(new_config)); // background task swaps in new config let request = shared.clone(); // each request clones a handle let config = request.snapshot(); // first snapshot() pins the value
-
skip_validate_dimensions_existsetter onEmfBuilder(#223)
Fixed
- EMF produced trailing commas when distribution ends with skipped observation (#222)
Other
- Add
_guidemodule with cookbook, concurrency, sinks, sampling, testing (#219, #232) - (examples) add global-state example combining
State,Counter::increment_scoped, andOnceLock(#235) - (examples) use metrique::ServiceMetrics instead of global_entry_sink! (#241)
- Add metrique json feature and formatter re-export (#242)
metrique-v0.1.20
metrique-v0.1.19
metrique-v0.1.18
Other
- Add Debug derive to SetEntryDimensions (#202)
metrique-v0.1.17
Fixed
- Fix issues with
#[derive(Debug)]on metrics entries (#200)