refactor: add basic counter metrics for IMC (#5006)

This commit is contained in:
Chethan Rao
2024-06-18 18:29:12 +05:30
committed by GitHub
parent 010e6fe3ee
commit d2092dcb0a
43 changed files with 301 additions and 316 deletions

View File

@ -6,6 +6,7 @@ use common_utils::{
};
use hyperswitch_domain_models::router_data::{ErrorResponse, RouterData};
use masking::Maskable;
use router_env::metrics::add_attributes;
use serde_json::json;
use crate::{
@ -87,7 +88,7 @@ pub trait ConnectorIntegration<T, Req, Resp>: ConnectorIntegrationAny<T, Req, Re
metrics::UNIMPLEMENTED_FLOW.add(
&metrics::CONTEXT,
1,
&[metrics::add_attributes("connector", req.connector.clone())],
&add_attributes([("connector", req.connector.clone())]),
);
Ok(None)
}

View File

@ -1,16 +1,8 @@
//! Metrics interface
use router_env::{counter_metric, global_meter, metrics_context, opentelemetry};
use router_env::{counter_metric, global_meter, metrics_context};
metrics_context!(CONTEXT);
global_meter!(GLOBAL_METER, "ROUTER_API");
counter_metric!(UNIMPLEMENTED_FLOW, GLOBAL_METER);
/// fn add attributes
pub fn add_attributes<T: Into<opentelemetry::Value>>(
key: &'static str,
value: T,
) -> opentelemetry::KeyValue {
opentelemetry::KeyValue::new(key, value)
}