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

@ -12,7 +12,6 @@ use common_utils::errors::ReportSwitchExt;
use error_stack::ResultExt;
use router_env::{
instrument, logger,
metrics::add_attributes,
tracing::{self, Instrument},
};
@ -136,14 +135,14 @@ pub async fn get_api_event_metrics(
.change_context(AnalyticsError::UnknownError)?
{
let data = data?;
let attributes = &add_attributes([
let attributes = router_env::metric_attributes!(
("metric_type", metric.to_string()),
("source", pool.to_string()),
]);
);
let value = u64::try_from(data.len());
if let Ok(val) = value {
metrics::BUCKETS_FETCHED.record(&metrics::CONTEXT, val, attributes);
metrics::BUCKETS_FETCHED.record(val, attributes);
logger::debug!("Attributes: {:?}, Buckets fetched: {}", attributes, val);
}
for (id, value) in data {

View File

@ -11,7 +11,6 @@ use api_models::analytics::{
use error_stack::ResultExt;
use router_env::{
logger,
metrics::add_attributes,
tracing::{self, Instrument},
};
@ -72,14 +71,14 @@ pub async fn get_metrics(
.change_context(AnalyticsError::UnknownError)?
{
let data = data?;
let attributes = &add_attributes([
let attributes = router_env::metric_attributes!(
("metric_type", metric.to_string()),
("source", pool.to_string()),
]);
);
let value = u64::try_from(data.len());
if let Ok(val) = value {
metrics::BUCKETS_FETCHED.record(&metrics::CONTEXT, val, attributes);
metrics::BUCKETS_FETCHED.record(val, attributes);
logger::debug!("Attributes: {:?}, Buckets fetched: {}", attributes, val);
}

View File

@ -9,7 +9,6 @@ use api_models::analytics::{
use error_stack::ResultExt;
use router_env::{
logger,
metrics::add_attributes,
tracing::{self, Instrument},
};
@ -66,13 +65,13 @@ pub async fn get_metrics(
{
let data = data?;
let attributes = &add_attributes([
let attributes = router_env::metric_attributes!(
("metric_type", metric.to_string()),
("source", pool.to_string()),
]);
);
let value = u64::try_from(data.len());
if let Ok(val) = value {
metrics::BUCKETS_FETCHED.record(&metrics::CONTEXT, val, attributes);
metrics::BUCKETS_FETCHED.record(val, attributes);
logger::debug!("Attributes: {:?}, Buckets fetched: {}", attributes, val);
}

View File

@ -1,9 +1,8 @@
use router_env::{global_meter, histogram_metric, histogram_metric_u64, metrics_context};
use router_env::{global_meter, histogram_metric_f64, histogram_metric_u64};
metrics_context!(CONTEXT);
global_meter!(GLOBAL_METER, "ROUTER_API");
histogram_metric!(METRIC_FETCH_TIME, GLOBAL_METER);
histogram_metric_f64!(METRIC_FETCH_TIME, GLOBAL_METER);
histogram_metric_u64!(BUCKETS_FETCHED, GLOBAL_METER);
pub mod request;

View File

@ -1,7 +1,5 @@
use std::time;
use router_env::metrics::add_attributes;
#[inline]
pub async fn record_operation_time<F, R, T>(
future: F,
@ -14,12 +12,12 @@ where
T: ToString,
{
let (result, time) = time_future(future).await;
let attributes = &add_attributes([
let attributes = router_env::metric_attributes!(
("metric_name", metric_name.to_string()),
("source", source.to_string()),
]);
);
let value = time.as_secs_f64();
metric.record(&super::CONTEXT, value, attributes);
metric.record(value, attributes);
router_env::logger::debug!("Attributes: {:?}, Time: {}", attributes, value);
result

View File

@ -16,7 +16,6 @@ use currency_conversion::{conversion::convert, types::ExchangeRates};
use error_stack::ResultExt;
use router_env::{
instrument, logger,
metrics::add_attributes,
tracing::{self, Instrument},
};
@ -118,14 +117,14 @@ pub async fn get_metrics(
match task_type {
TaskType::MetricTask(metric, data) => {
let data = data?;
let attributes = &add_attributes([
let attributes = router_env::metric_attributes!(
("metric_type", metric.to_string()),
("source", pool.to_string()),
]);
);
let value = u64::try_from(data.len());
if let Ok(val) = value {
metrics::BUCKETS_FETCHED.record(&metrics::CONTEXT, val, attributes);
metrics::BUCKETS_FETCHED.record(val, attributes);
logger::debug!("Attributes: {:?}, Buckets fetched: {}", attributes, val);
}

View File

@ -16,7 +16,6 @@ use currency_conversion::{conversion::convert, types::ExchangeRates};
use error_stack::ResultExt;
use router_env::{
instrument, logger,
metrics::add_attributes,
tracing::{self, Instrument},
};
@ -126,14 +125,14 @@ pub async fn get_metrics(
match task_type {
TaskType::MetricTask(metric, data) => {
let data = data?;
let attributes = &add_attributes([
let attributes = router_env::metric_attributes!(
("metric_type", metric.to_string()),
("source", pool.to_string()),
]);
);
let value = u64::try_from(data.len());
if let Ok(val) = value {
metrics::BUCKETS_FETCHED.record(&metrics::CONTEXT, val, attributes);
metrics::BUCKETS_FETCHED.record(val, attributes);
logger::debug!("Attributes: {:?}, Buckets fetched: {}", attributes, val);
}
@ -193,14 +192,14 @@ pub async fn get_metrics(
}
TaskType::DistributionTask(distribution, data) => {
let data = data?;
let attributes = &add_attributes([
let attributes = router_env::metric_attributes!(
("distribution_type", distribution.to_string()),
("source", pool.to_string()),
]);
);
let value = u64::try_from(data.len());
if let Ok(val) = value {
metrics::BUCKETS_FETCHED.record(&metrics::CONTEXT, val, attributes);
metrics::BUCKETS_FETCHED.record(val, attributes);
logger::debug!("Attributes: {:?}, Buckets fetched: {}", attributes, val);
}

View File

@ -16,7 +16,6 @@ use currency_conversion::{conversion::convert, types::ExchangeRates};
use error_stack::ResultExt;
use router_env::{
logger,
metrics::add_attributes,
tracing::{self, Instrument},
};
@ -121,14 +120,14 @@ pub async fn get_metrics(
match task_type {
TaskType::MetricTask(metric, data) => {
let data = data?;
let attributes = &add_attributes([
let attributes = router_env::metric_attributes!(
("metric_type", metric.to_string()),
("source", pool.to_string()),
]);
);
let value = u64::try_from(data.len());
if let Ok(val) = value {
metrics::BUCKETS_FETCHED.record(&metrics::CONTEXT, val, attributes);
metrics::BUCKETS_FETCHED.record(val, attributes);
logger::debug!("Attributes: {:?}, Buckets fetched: {}", attributes, val);
}
@ -168,13 +167,13 @@ pub async fn get_metrics(
}
TaskType::DistributionTask(distribution, data) => {
let data = data?;
let attributes = &add_attributes([
let attributes = router_env::metric_attributes!(
("distribution_type", distribution.to_string()),
("source", pool.to_string()),
]);
);
let value = u64::try_from(data.len());
if let Ok(val) = value {
metrics::BUCKETS_FETCHED.record(&metrics::CONTEXT, val, attributes);
metrics::BUCKETS_FETCHED.record(val, attributes);
logger::debug!("Attributes: {:?}, Buckets fetched: {}", attributes, val);
}