feat(metrics): add support for gauge metrics and include IMC metrics (#4939)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Chethan Rao
2024-06-11 20:22:20 +05:30
committed by GitHub
parent a949676f8b
commit 42cd769407
10 changed files with 95 additions and 4 deletions

View File

@ -101,3 +101,22 @@ macro_rules! histogram_metric_i64 {
> = once_cell::sync::Lazy::new(|| $meter.i64_histogram($description).init());
};
}
/// Create a [`ObservableGauge`][ObservableGauge] metric with the specified name and an optional description,
/// associated with the specified meter. Note that the meter must be to a valid [`Meter`][Meter].
///
/// [ObservableGauge]: opentelemetry::metrics::ObservableGauge
/// [Meter]: opentelemetry::metrics::Meter
#[macro_export]
macro_rules! gauge_metric {
($name:ident, $meter:ident) => {
pub(crate) static $name: once_cell::sync::Lazy<
$crate::opentelemetry::metrics::ObservableGauge<u64>,
> = once_cell::sync::Lazy::new(|| $meter.u64_observable_gauge(stringify!($name)).init());
};
($name:ident, $meter:ident, description:literal) => {
pub(crate) static $name: once_cell::sync::Lazy<
$crate::opentelemetry::metrics::ObservableGauge<u64>,
> = once_cell::sync::Lazy::new(|| $meter.u64_observable_gauge($description).init());
};
}