build(deps): bump opentelemetry crates to 0.27 (#6774)

This commit is contained in:
Sanchith Hegde
2024-12-10 16:35:34 +05:30
committed by GitHub
parent a52828296a
commit 47a3d2b2ab
86 changed files with 739 additions and 1086 deletions

View File

@ -38,7 +38,6 @@ use hyperswitch_domain_models::payments::PaymentIntent;
use hyperswitch_domain_models::type_encryption::{crypto_operation, CryptoOperation};
use masking::{ExposeInterface, SwitchStrategy};
use nanoid::nanoid;
use router_env::metrics::add_attributes;
use serde::de::DeserializeOwned;
use serde_json::Value;
use tracing_futures::Instrument;
@ -678,11 +677,8 @@ pub fn handle_json_response_deserialization_failure(
res: types::Response,
connector: &'static str,
) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {
metrics::RESPONSE_DESERIALIZATION_FAILURE.add(
&metrics::CONTEXT,
1,
&add_attributes([("connector", connector)]),
);
metrics::RESPONSE_DESERIALIZATION_FAILURE
.add(1, router_env::metric_attributes!(("connector", connector)));
let response_data = String::from_utf8(res.response.to_vec())
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
@ -726,21 +722,11 @@ pub fn add_connector_http_status_code_metrics(option_status_code: Option<u16>) {
if let Some(status_code) = option_status_code {
let status_code_type = get_http_status_code_type(status_code).ok();
match status_code_type.as_deref() {
Some("1xx") => {
metrics::CONNECTOR_HTTP_STATUS_CODE_1XX_COUNT.add(&metrics::CONTEXT, 1, &[])
}
Some("2xx") => {
metrics::CONNECTOR_HTTP_STATUS_CODE_2XX_COUNT.add(&metrics::CONTEXT, 1, &[])
}
Some("3xx") => {
metrics::CONNECTOR_HTTP_STATUS_CODE_3XX_COUNT.add(&metrics::CONTEXT, 1, &[])
}
Some("4xx") => {
metrics::CONNECTOR_HTTP_STATUS_CODE_4XX_COUNT.add(&metrics::CONTEXT, 1, &[])
}
Some("5xx") => {
metrics::CONNECTOR_HTTP_STATUS_CODE_5XX_COUNT.add(&metrics::CONTEXT, 1, &[])
}
Some("1xx") => metrics::CONNECTOR_HTTP_STATUS_CODE_1XX_COUNT.add(1, &[]),
Some("2xx") => metrics::CONNECTOR_HTTP_STATUS_CODE_2XX_COUNT.add(1, &[]),
Some("3xx") => metrics::CONNECTOR_HTTP_STATUS_CODE_3XX_COUNT.add(1, &[]),
Some("4xx") => metrics::CONNECTOR_HTTP_STATUS_CODE_4XX_COUNT.add(1, &[]),
Some("5xx") => metrics::CONNECTOR_HTTP_STATUS_CODE_5XX_COUNT.add(1, &[]),
_ => logger::info!("Skip metrics as invalid http status code received from connector"),
};
} else {
@ -1049,26 +1035,24 @@ pub fn add_apple_pay_flow_metrics(
if let Some(flow) = apple_pay_flow {
match flow {
domain::ApplePayFlow::Simplified(_) => metrics::APPLE_PAY_SIMPLIFIED_FLOW.add(
&metrics::CONTEXT,
1,
&add_attributes([
router_env::metric_attributes!(
(
"connector",
connector.to_owned().unwrap_or("null".to_string()),
),
("merchant_id", merchant_id.get_string_repr().to_owned()),
]),
("merchant_id", merchant_id.clone()),
),
),
domain::ApplePayFlow::Manual => metrics::APPLE_PAY_MANUAL_FLOW.add(
&metrics::CONTEXT,
1,
&add_attributes([
router_env::metric_attributes!(
(
"connector",
connector.to_owned().unwrap_or("null".to_string()),
),
("merchant_id", merchant_id.get_string_repr().to_owned()),
]),
("merchant_id", merchant_id.clone()),
),
),
}
}
@ -1085,28 +1069,26 @@ pub fn add_apple_pay_payment_status_metrics(
match flow {
domain::ApplePayFlow::Simplified(_) => {
metrics::APPLE_PAY_SIMPLIFIED_FLOW_SUCCESSFUL_PAYMENT.add(
&metrics::CONTEXT,
1,
&add_attributes([
router_env::metric_attributes!(
(
"connector",
connector.to_owned().unwrap_or("null".to_string()),
),
("merchant_id", merchant_id.get_string_repr().to_owned()),
]),
("merchant_id", merchant_id.clone()),
),
)
}
domain::ApplePayFlow::Manual => metrics::APPLE_PAY_MANUAL_FLOW_SUCCESSFUL_PAYMENT
.add(
&metrics::CONTEXT,
1,
&add_attributes([
router_env::metric_attributes!(
(
"connector",
connector.to_owned().unwrap_or("null".to_string()),
),
("merchant_id", merchant_id.get_string_repr().to_owned()),
]),
("merchant_id", merchant_id.clone()),
),
),
}
}
@ -1115,27 +1097,25 @@ pub fn add_apple_pay_payment_status_metrics(
match flow {
domain::ApplePayFlow::Simplified(_) => {
metrics::APPLE_PAY_SIMPLIFIED_FLOW_FAILED_PAYMENT.add(
&metrics::CONTEXT,
1,
&add_attributes([
router_env::metric_attributes!(
(
"connector",
connector.to_owned().unwrap_or("null".to_string()),
),
("merchant_id", merchant_id.get_string_repr().to_owned()),
]),
("merchant_id", merchant_id.clone()),
),
)
}
domain::ApplePayFlow::Manual => metrics::APPLE_PAY_MANUAL_FLOW_FAILED_PAYMENT.add(
&metrics::CONTEXT,
1,
&add_attributes([
router_env::metric_attributes!(
(
"connector",
connector.to_owned().unwrap_or("null".to_string()),
),
("merchant_id", merchant_id.get_string_repr().to_owned()),
]),
("merchant_id", merchant_id.clone()),
),
),
}
}