mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 12:06:56 +08:00
refactor: add basic counter metrics for IMC (#5006)
This commit is contained in:
@ -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)
|
||||
}
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user