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

@ -30,12 +30,11 @@ crate::impl_serializable_secret_id_type!(MerchantId);
crate::impl_queryable_id_type!(MerchantId);
crate::impl_to_sql_from_sql_id_type!(MerchantId);
// This is implemented so that we can use merchant id directly as attribute in metrics
#[cfg(feature = "metrics")]
/// This is implemented so that we can use merchant id directly as attribute in metrics
impl From<MerchantId> for router_env::opentelemetry::Value {
fn from(val: MerchantId) -> Self {
let string_value = val.0 .0 .0;
Self::String(router_env::opentelemetry::StringValue::from(string_value))
Self::from(val.0 .0 .0)
}
}

View File

@ -79,11 +79,10 @@ crate::impl_try_from_cow_str_id_type!(PaymentReferenceId, "payment_reference_id"
crate::impl_queryable_id_type!(PaymentReferenceId);
crate::impl_to_sql_from_sql_id_type!(PaymentReferenceId);
// This is implemented so that we can use payment id directly as attribute in metrics
#[cfg(feature = "metrics")]
/// This is implemented so that we can use payment id directly as attribute in metrics
impl From<PaymentId> for router_env::opentelemetry::Value {
fn from(val: PaymentId) -> Self {
let string_value = val.0 .0 .0;
Self::String(router_env::opentelemetry::StringValue::from(string_value))
Self::from(val.0 .0 .0)
}
}

View File

@ -31,3 +31,11 @@ impl FromStr for ProfileId {
Self::try_from(cow_string)
}
}
// This is implemented so that we can use profile id directly as attribute in metrics
#[cfg(feature = "metrics")]
impl From<ProfileId> for router_env::opentelemetry::Value {
fn from(val: ProfileId) -> Self {
Self::from(val.0 .0 .0)
}
}

View File

@ -21,13 +21,12 @@ where
pub async fn record_operation_time<F, R>(
future: F,
metric: &opentelemetry::metrics::Histogram<f64>,
metric_context: &opentelemetry::Context,
key_value: &[opentelemetry::KeyValue],
) -> R
where
F: futures::Future<Output = R>,
{
let (result, time) = time_future(future).await;
metric.record(metric_context, time.as_secs_f64(), key_value);
metric.record(time.as_secs_f64(), key_value);
result
}