All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Additional implementations of
IntoF64
for standard numerical types (i8
,u8
,i16
,u16
,i32
,u32
, andf32
).
- Bump
ahash
back to0.8.8
to remove range constraint after an upstream fix was provided to remove the unnecessary MSRV bump.
- Lock down the version of
ahash
to avoid unnecessary MSRV bumping.
-
Support for using
Arc<T>
withCow<'a, T>
. (#402)This will primarily allow using
Arc<str>
for metric names and labels, where previously only&'static str
orString
were allowed. There's still work to be done to also support labels in this regard. -
Support for local recorders. (#414)
This is a large feature, and is documented in RELEASES.md.
- Make
Unit
methods return&'static str
(instead of&str
) where possible. (#392) - Bump MSRV to 1.65.0.
SetRecorderError
now returns the recorder given toset_global_recorder
if another global recorder was already installed instead of leaking it. (#414)
- Added a
From
implementation forKeyName
fromCow<'static, str>
. (#378)
- Removed
metrics::set_recorder_racy
as it was intended to be used inno_std
use cases, butmetrics
is not currently compatible inno_std
environments, so keepingset_recorder_racy
around was just API baggage.
- A new module,
atomics
, exposes the atomic integer type thatCounterFn
andGaugeFn
are implemented for. This will publicly re-export the type for usage by downstream crates. (Credit to @repi for the original PR (#347) that did this.)
- Bump MSRV to 1.61.0.
portable-atomic
is only used on 32-bit architectures.
- Removed the
std-atomics
feature flag.
-
Bumped the dependency on
metrics-macros
to correctly use the updated versions that are necessary for handling the recent&'static str
->SharedString
change toRecorder::describe_*
.We'll also yank 0.20.0 once this is released to avoid the patch version triggering a breaking change jump in transitive dependencies, and so people can't pick up a version of
metrics
that doesn't actually work as it should.
- Changed
Recorder::describe_*
to takeSharedString
instead of&'static str
for descriptions. (#312) - Implemented
CounterFn
andGaugeFn
forportable_atomic::AtomicU64
(#313) - Moved implementations of
CounterFn
andGaugeFn
forstd::sync::atomic::AtomicU64
behind a default feature flag.
- Small typo in the documentation. (#286)
- Refactored the global recorder instance, namely around how it gets set and documenting the safety guarantees of methods related to setting and unsetting it. (#302)
- Fixed an issue with pointer provenance in
metrics::Cow
. (#303)
- Slices of string key/value tuples can now be passed as the labels expression in macros. (#277)
- A new macro,
absolute_counter!
, for setting the value of a counter to an absolute value. - A new wrapper type,
KeyName
, which encapsulates creating the name portion of aKey
. Existing methods for building aKey
, as well as implicit conversion trait implementations, allow this to be a no-op. - Label keys in macros can now be general expressions i.e. constants or variables. Due to
limitations in how procedural macros work, and the facilities available in stable Rust for const
traits, even
&'static str
constants will cause allocations when used for emitting a metric.
- Switched to metric handles through the
Recorder
API. (#240). Due to the size of this change, the details are further documented and discussed in RELEASES.md. Unit
is nowCopy
.- When describing a metric via the
describe_*
macros, the description is no longer optional.
- Removed the
std
feature flag, asmetrics
depends too heavily onstd
-based types and as such was not meaningfully usaable when thestd
feature flag was disabled. This will be revisited in the future.
- Removed unnecessary
proc-macro-hack
dependency.
- Switched from
t1ha
toahash
for the key hasher.
NameParts
has been removed to simplify metric names, again relying on a single string which is still backed by copy-on-write storage.
- Nothing. Fixed an issue with using the wrong dependency version during a mass release of workspace crates.
- Switched from
Key
to&Key
inRecorder
. - Refactored
KeyData
intoKey
.
- Metric keys are now pre-hashed/memoized where possible, which provides a massive speedup to hashing operations over time.
- Implemented
Ord
/PartialOrd
for various key-related types.
- Minor documentation test updates for better coverage of owned strings used as metric names.
- Added support for owned strings as metric names. #170
- Added conversion from
std::borrow::Cow<'static, str>
forSharedString
.
- New macros for registration:
register_counter!
,register_gauge!
,register_histogram!
. - New macros for emission:
histogram!
,increment_counter!
,increment_gauge!
,decrement_gauge!
. - Added unit support to describe the unit of a given metric.
- Dropped the
timing!
andvalue!
macros in favor ofhistogram!
.
- All macros are now procedural macros instead of declarative macros.
- Gauges are now
f64
instead ofi64
. - Histograms are now
f64
instead ofu64
. Key
now split intoKey
andKeyData
to better support constant expression metric keys via macro callsites.- Significant overhaul of generated callsites via macros.
- Cost for macros dropped to almost zero when no recorder is installed. (#55)
- Improved documentation. (#44, #45, #46)
- Renamed
Recorder::record_counter
toincrement_counter
andRecorder::record_gauge
toupdate_gauge
. (#47)
- Fixed a bug with macros calling inner macros without a fully qualified name.
- Life begins at 0.11.0 for this crate, after being renamed from
metrics-facade
tometrics
to reflect the duality ofmetrics
to thelog
crate. (#27)