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

@ -103,6 +103,8 @@ pub struct LogTelemetry {
pub use_xray_generator: bool,
/// Route Based Tracing
pub route_to_trace: Option<Vec<String>>,
/// Interval for collecting the metrics (such as gauge) in background thread
pub bg_metrics_collection_interval_in_secs: Option<u16>,
}
/// Telemetry / tracing.

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());
};
}