mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 04:04:43 +08:00
build(deps): bump error-stack from version 0.3.1 to 0.4.1 (#4188)
This commit is contained in:
@ -9,7 +9,7 @@ use api_models::analytics::{
|
||||
GetApiEventMetricRequest, MetricsResponse,
|
||||
};
|
||||
use common_utils::errors::ReportSwitchExt;
|
||||
use error_stack::{IntoReport, ResultExt};
|
||||
use error_stack::ResultExt;
|
||||
use router_env::{
|
||||
instrument, logger,
|
||||
tracing::{self, Instrument},
|
||||
@ -36,7 +36,6 @@ pub async fn api_events_core(
|
||||
AnalyticsProvider::Sqlx(_) => Err(FiltersError::NotImplemented(
|
||||
"API Events not implemented for SQLX",
|
||||
))
|
||||
.into_report()
|
||||
.attach_printable("SQL Analytics is not implemented for API Events"),
|
||||
AnalyticsProvider::Clickhouse(pool) => get_api_event(&merchant_id, req, pool).await,
|
||||
AnalyticsProvider::CombinedSqlx(_sqlx_pool, ckh_pool)
|
||||
@ -64,7 +63,6 @@ pub async fn get_filters(
|
||||
AnalyticsProvider::Sqlx(_pool) => Err(FiltersError::NotImplemented(
|
||||
"API Events not implemented for SQLX",
|
||||
))
|
||||
.into_report()
|
||||
.attach_printable("SQL Analytics is not implemented for API Events"),
|
||||
AnalyticsProvider::Clickhouse(ckh_pool)
|
||||
| AnalyticsProvider::CombinedSqlx(_, ckh_pool)
|
||||
@ -134,7 +132,6 @@ pub async fn get_api_event_metrics(
|
||||
.join_next()
|
||||
.await
|
||||
.transpose()
|
||||
.into_report()
|
||||
.change_context(AnalyticsError::UnknownError)?
|
||||
{
|
||||
let data = data?;
|
||||
|
||||
@ -2,7 +2,7 @@ use std::sync::Arc;
|
||||
|
||||
use actix_web::http::StatusCode;
|
||||
use common_utils::errors::ParsingError;
|
||||
use error_stack::{IntoReport, Report, ResultExt};
|
||||
use error_stack::{report, Report, ResultExt};
|
||||
use router_env::logger;
|
||||
use time::PrimitiveDateTime;
|
||||
|
||||
@ -71,7 +71,6 @@ impl ClickhouseClient {
|
||||
.body(format!("{query}\nFORMAT JSON"))
|
||||
.send()
|
||||
.await
|
||||
.into_report()
|
||||
.change_context(ClickhouseError::ConnectionError)?;
|
||||
|
||||
logger::debug!(clickhouse_response=?response, query=?query, "Clickhouse response");
|
||||
@ -79,16 +78,14 @@ impl ClickhouseClient {
|
||||
response.text().await.map_or_else(
|
||||
|er| {
|
||||
Err(ClickhouseError::ResponseError)
|
||||
.into_report()
|
||||
.attach_printable_lazy(|| format!("Error: {er:?}"))
|
||||
},
|
||||
|t| Err(ClickhouseError::ResponseNotOK(t)).into_report(),
|
||||
|t| Err(report!(ClickhouseError::ResponseNotOK(t))),
|
||||
)
|
||||
} else {
|
||||
Ok(response
|
||||
.json::<CkhOutput<serde_json::Value>>()
|
||||
.await
|
||||
.into_report()
|
||||
.change_context(ClickhouseError::ResponseError)?
|
||||
.data)
|
||||
}
|
||||
@ -149,7 +146,7 @@ where
|
||||
{
|
||||
fn load_row(row: Self::Row) -> common_utils::errors::CustomResult<T, QueryExecutionError> {
|
||||
row.try_into()
|
||||
.change_context(QueryExecutionError::RowExtractionFailure)
|
||||
.map_err(|error| error.change_context(QueryExecutionError::RowExtractionFailure))
|
||||
}
|
||||
}
|
||||
|
||||
@ -188,11 +185,9 @@ impl TryInto<ApiLogsResult> for serde_json::Value {
|
||||
type Error = Report<ParsingError>;
|
||||
|
||||
fn try_into(self) -> Result<ApiLogsResult, Self::Error> {
|
||||
serde_json::from_value(self)
|
||||
.into_report()
|
||||
.change_context(ParsingError::StructParseFailure(
|
||||
"Failed to parse ApiLogsResult in clickhouse results",
|
||||
))
|
||||
serde_json::from_value(self).change_context(ParsingError::StructParseFailure(
|
||||
"Failed to parse ApiLogsResult in clickhouse results",
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
@ -200,11 +195,9 @@ impl TryInto<SdkEventsResult> for serde_json::Value {
|
||||
type Error = Report<ParsingError>;
|
||||
|
||||
fn try_into(self) -> Result<SdkEventsResult, Self::Error> {
|
||||
serde_json::from_value(self)
|
||||
.into_report()
|
||||
.change_context(ParsingError::StructParseFailure(
|
||||
"Failed to parse SdkEventsResult in clickhouse results",
|
||||
))
|
||||
serde_json::from_value(self).change_context(ParsingError::StructParseFailure(
|
||||
"Failed to parse SdkEventsResult in clickhouse results",
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
@ -212,11 +205,9 @@ impl TryInto<ConnectorEventsResult> for serde_json::Value {
|
||||
type Error = Report<ParsingError>;
|
||||
|
||||
fn try_into(self) -> Result<ConnectorEventsResult, Self::Error> {
|
||||
serde_json::from_value(self)
|
||||
.into_report()
|
||||
.change_context(ParsingError::StructParseFailure(
|
||||
"Failed to parse ConnectorEventsResult in clickhouse results",
|
||||
))
|
||||
serde_json::from_value(self).change_context(ParsingError::StructParseFailure(
|
||||
"Failed to parse ConnectorEventsResult in clickhouse results",
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
@ -224,11 +215,9 @@ impl TryInto<PaymentMetricRow> for serde_json::Value {
|
||||
type Error = Report<ParsingError>;
|
||||
|
||||
fn try_into(self) -> Result<PaymentMetricRow, Self::Error> {
|
||||
serde_json::from_value(self)
|
||||
.into_report()
|
||||
.change_context(ParsingError::StructParseFailure(
|
||||
"Failed to parse PaymentMetricRow in clickhouse results",
|
||||
))
|
||||
serde_json::from_value(self).change_context(ParsingError::StructParseFailure(
|
||||
"Failed to parse PaymentMetricRow in clickhouse results",
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
@ -236,11 +225,9 @@ impl TryInto<PaymentDistributionRow> for serde_json::Value {
|
||||
type Error = Report<ParsingError>;
|
||||
|
||||
fn try_into(self) -> Result<PaymentDistributionRow, Self::Error> {
|
||||
serde_json::from_value(self)
|
||||
.into_report()
|
||||
.change_context(ParsingError::StructParseFailure(
|
||||
"Failed to parse PaymentDistributionRow in clickhouse results",
|
||||
))
|
||||
serde_json::from_value(self).change_context(ParsingError::StructParseFailure(
|
||||
"Failed to parse PaymentDistributionRow in clickhouse results",
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
@ -248,11 +235,9 @@ impl TryInto<FilterRow> for serde_json::Value {
|
||||
type Error = Report<ParsingError>;
|
||||
|
||||
fn try_into(self) -> Result<FilterRow, Self::Error> {
|
||||
serde_json::from_value(self)
|
||||
.into_report()
|
||||
.change_context(ParsingError::StructParseFailure(
|
||||
"Failed to parse FilterRow in clickhouse results",
|
||||
))
|
||||
serde_json::from_value(self).change_context(ParsingError::StructParseFailure(
|
||||
"Failed to parse FilterRow in clickhouse results",
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
@ -260,11 +245,9 @@ impl TryInto<RefundMetricRow> for serde_json::Value {
|
||||
type Error = Report<ParsingError>;
|
||||
|
||||
fn try_into(self) -> Result<RefundMetricRow, Self::Error> {
|
||||
serde_json::from_value(self)
|
||||
.into_report()
|
||||
.change_context(ParsingError::StructParseFailure(
|
||||
"Failed to parse RefundMetricRow in clickhouse results",
|
||||
))
|
||||
serde_json::from_value(self).change_context(ParsingError::StructParseFailure(
|
||||
"Failed to parse RefundMetricRow in clickhouse results",
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
@ -272,22 +255,18 @@ impl TryInto<RefundFilterRow> for serde_json::Value {
|
||||
type Error = Report<ParsingError>;
|
||||
|
||||
fn try_into(self) -> Result<RefundFilterRow, Self::Error> {
|
||||
serde_json::from_value(self)
|
||||
.into_report()
|
||||
.change_context(ParsingError::StructParseFailure(
|
||||
"Failed to parse RefundFilterRow in clickhouse results",
|
||||
))
|
||||
serde_json::from_value(self).change_context(ParsingError::StructParseFailure(
|
||||
"Failed to parse RefundFilterRow in clickhouse results",
|
||||
))
|
||||
}
|
||||
}
|
||||
impl TryInto<DisputeMetricRow> for serde_json::Value {
|
||||
type Error = Report<ParsingError>;
|
||||
|
||||
fn try_into(self) -> Result<DisputeMetricRow, Self::Error> {
|
||||
serde_json::from_value(self)
|
||||
.into_report()
|
||||
.change_context(ParsingError::StructParseFailure(
|
||||
"Failed to parse DisputeMetricRow in clickhouse results",
|
||||
))
|
||||
serde_json::from_value(self).change_context(ParsingError::StructParseFailure(
|
||||
"Failed to parse DisputeMetricRow in clickhouse results",
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
@ -295,11 +274,9 @@ impl TryInto<DisputeFilterRow> for serde_json::Value {
|
||||
type Error = Report<ParsingError>;
|
||||
|
||||
fn try_into(self) -> Result<DisputeFilterRow, Self::Error> {
|
||||
serde_json::from_value(self)
|
||||
.into_report()
|
||||
.change_context(ParsingError::StructParseFailure(
|
||||
"Failed to parse DisputeFilterRow in clickhouse results",
|
||||
))
|
||||
serde_json::from_value(self).change_context(ParsingError::StructParseFailure(
|
||||
"Failed to parse DisputeFilterRow in clickhouse results",
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
@ -307,11 +284,9 @@ impl TryInto<ApiEventMetricRow> for serde_json::Value {
|
||||
type Error = Report<ParsingError>;
|
||||
|
||||
fn try_into(self) -> Result<ApiEventMetricRow, Self::Error> {
|
||||
serde_json::from_value(self)
|
||||
.into_report()
|
||||
.change_context(ParsingError::StructParseFailure(
|
||||
"Failed to parse ApiEventMetricRow in clickhouse results",
|
||||
))
|
||||
serde_json::from_value(self).change_context(ParsingError::StructParseFailure(
|
||||
"Failed to parse ApiEventMetricRow in clickhouse results",
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
@ -319,11 +294,9 @@ impl TryInto<LatencyAvg> for serde_json::Value {
|
||||
type Error = Report<ParsingError>;
|
||||
|
||||
fn try_into(self) -> Result<LatencyAvg, Self::Error> {
|
||||
serde_json::from_value(self)
|
||||
.into_report()
|
||||
.change_context(ParsingError::StructParseFailure(
|
||||
"Failed to parse LatencyAvg in clickhouse results",
|
||||
))
|
||||
serde_json::from_value(self).change_context(ParsingError::StructParseFailure(
|
||||
"Failed to parse LatencyAvg in clickhouse results",
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
@ -331,11 +304,9 @@ impl TryInto<SdkEventMetricRow> for serde_json::Value {
|
||||
type Error = Report<ParsingError>;
|
||||
|
||||
fn try_into(self) -> Result<SdkEventMetricRow, Self::Error> {
|
||||
serde_json::from_value(self)
|
||||
.into_report()
|
||||
.change_context(ParsingError::StructParseFailure(
|
||||
"Failed to parse SdkEventMetricRow in clickhouse results",
|
||||
))
|
||||
serde_json::from_value(self).change_context(ParsingError::StructParseFailure(
|
||||
"Failed to parse SdkEventMetricRow in clickhouse results",
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
@ -343,11 +314,9 @@ impl TryInto<SdkEventFilter> for serde_json::Value {
|
||||
type Error = Report<ParsingError>;
|
||||
|
||||
fn try_into(self) -> Result<SdkEventFilter, Self::Error> {
|
||||
serde_json::from_value(self)
|
||||
.into_report()
|
||||
.change_context(ParsingError::StructParseFailure(
|
||||
"Failed to parse SdkEventFilter in clickhouse results",
|
||||
))
|
||||
serde_json::from_value(self).change_context(ParsingError::StructParseFailure(
|
||||
"Failed to parse SdkEventFilter in clickhouse results",
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
@ -355,11 +324,9 @@ impl TryInto<ApiEventFilter> for serde_json::Value {
|
||||
type Error = Report<ParsingError>;
|
||||
|
||||
fn try_into(self) -> Result<ApiEventFilter, Self::Error> {
|
||||
serde_json::from_value(self)
|
||||
.into_report()
|
||||
.change_context(ParsingError::StructParseFailure(
|
||||
"Failed to parse ApiEventFilter in clickhouse results",
|
||||
))
|
||||
serde_json::from_value(self).change_context(ParsingError::StructParseFailure(
|
||||
"Failed to parse ApiEventFilter in clickhouse results",
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
@ -367,11 +334,9 @@ impl TryInto<OutgoingWebhookLogsResult> for serde_json::Value {
|
||||
type Error = Report<ParsingError>;
|
||||
|
||||
fn try_into(self) -> Result<OutgoingWebhookLogsResult, Self::Error> {
|
||||
serde_json::from_value(self)
|
||||
.into_report()
|
||||
.change_context(ParsingError::StructParseFailure(
|
||||
"Failed to parse OutgoingWebhookLogsResult in clickhouse results",
|
||||
))
|
||||
serde_json::from_value(self).change_context(ParsingError::StructParseFailure(
|
||||
"Failed to parse OutgoingWebhookLogsResult in clickhouse results",
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
@ -379,11 +344,9 @@ impl ToSql<ClickhouseClient> for PrimitiveDateTime {
|
||||
fn to_sql(&self, _table_engine: &TableEngine) -> error_stack::Result<String, ParsingError> {
|
||||
let format =
|
||||
time::format_description::parse("[year]-[month]-[day] [hour]:[minute]:[second]")
|
||||
.into_report()
|
||||
.change_context(ParsingError::DateTimeParsingError)
|
||||
.attach_printable("Failed to parse format description")?;
|
||||
self.format(&format)
|
||||
.into_report()
|
||||
.change_context(ParsingError::EncodeError(
|
||||
"failed to encode to clickhouse date-time format",
|
||||
))
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
use api_models::analytics::connector_events::ConnectorEventsRequest;
|
||||
use common_utils::errors::ReportSwitchExt;
|
||||
use error_stack::{IntoReport, ResultExt};
|
||||
use error_stack::ResultExt;
|
||||
|
||||
use super::events::{get_connector_events, ConnectorEventsResult};
|
||||
use crate::{errors::AnalyticsResult, types::FiltersError, AnalyticsProvider};
|
||||
@ -14,7 +14,6 @@ pub async fn connector_events_core(
|
||||
AnalyticsProvider::Sqlx(_) => Err(FiltersError::NotImplemented(
|
||||
"Connector Events not implemented for SQLX",
|
||||
))
|
||||
.into_report()
|
||||
.attach_printable("SQL Analytics is not implemented for Connector Events"),
|
||||
AnalyticsProvider::Clickhouse(ckh_pool)
|
||||
| AnalyticsProvider::CombinedSqlx(_, ckh_pool)
|
||||
|
||||
@ -8,7 +8,7 @@ use api_models::analytics::{
|
||||
AnalyticsMetadata, DisputeFilterValue, DisputeFiltersResponse, GetDisputeFilterRequest,
|
||||
GetDisputeMetricRequest, MetricsResponse,
|
||||
};
|
||||
use error_stack::{IntoReport, ResultExt};
|
||||
use error_stack::ResultExt;
|
||||
use router_env::{
|
||||
logger,
|
||||
tracing::{self, Instrument},
|
||||
@ -67,7 +67,6 @@ pub async fn get_metrics(
|
||||
.join_next()
|
||||
.await
|
||||
.transpose()
|
||||
.into_report()
|
||||
.change_context(AnalyticsError::UnknownError)?
|
||||
{
|
||||
let data = data?;
|
||||
|
||||
@ -2,7 +2,7 @@ use aws_config::{self, meta::region::RegionProviderChain, Region};
|
||||
use aws_sdk_lambda::{types::InvocationType::Event, Client};
|
||||
use aws_smithy_types::Blob;
|
||||
use common_utils::errors::CustomResult;
|
||||
use error_stack::{IntoReport, ResultExt};
|
||||
use error_stack::{report, ResultExt};
|
||||
|
||||
use crate::errors::AnalyticsError;
|
||||
|
||||
@ -25,10 +25,9 @@ pub async fn invoke_lambda(
|
||||
.payload(Blob::new(json_bytes.to_owned()))
|
||||
.send()
|
||||
.await
|
||||
.into_report()
|
||||
.map_err(|er| {
|
||||
let er_rep = format!("{er:?}");
|
||||
er.attach_printable(er_rep)
|
||||
report!(er).attach_printable(er_rep)
|
||||
})
|
||||
.change_context(AnalyticsError::UnknownError)
|
||||
.attach_printable("Lambda invocation failed")?;
|
||||
|
||||
@ -43,7 +43,7 @@ use api_models::analytics::{
|
||||
};
|
||||
use clickhouse::ClickhouseClient;
|
||||
pub use clickhouse::ClickhouseConfig;
|
||||
use error_stack::IntoReport;
|
||||
use error_stack::report;
|
||||
use router_env::{
|
||||
logger,
|
||||
tracing::{self, instrument},
|
||||
@ -512,7 +512,7 @@ impl AnalyticsProvider {
|
||||
time_range: &TimeRange,
|
||||
) -> types::MetricsResult<Vec<(SdkEventMetricsBucketIdentifier, SdkEventMetricRow)>> {
|
||||
match self {
|
||||
Self::Sqlx(_pool) => Err(MetricsError::NotImplemented).into_report(),
|
||||
Self::Sqlx(_pool) => Err(report!(MetricsError::NotImplemented)),
|
||||
Self::Clickhouse(pool) => {
|
||||
metric
|
||||
.load_metrics(dimensions, pub_key, filters, granularity, time_range, pool)
|
||||
@ -544,7 +544,7 @@ impl AnalyticsProvider {
|
||||
time_range: &TimeRange,
|
||||
) -> types::MetricsResult<Vec<(ApiEventMetricsBucketIdentifier, ApiEventMetricRow)>> {
|
||||
match self {
|
||||
Self::Sqlx(_pool) => Err(MetricsError::NotImplemented).into_report(),
|
||||
Self::Sqlx(_pool) => Err(report!(MetricsError::NotImplemented)),
|
||||
Self::Clickhouse(ckh_pool)
|
||||
| Self::CombinedCkh(_, ckh_pool)
|
||||
| Self::CombinedSqlx(_, ckh_pool) => {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
use api_models::analytics::outgoing_webhook_event::OutgoingWebhookLogsRequest;
|
||||
use common_utils::errors::ReportSwitchExt;
|
||||
use error_stack::{IntoReport, ResultExt};
|
||||
use error_stack::ResultExt;
|
||||
|
||||
use super::events::{get_outgoing_webhook_event, OutgoingWebhookLogsResult};
|
||||
use crate::{errors::AnalyticsResult, types::FiltersError, AnalyticsProvider};
|
||||
@ -14,7 +14,6 @@ pub async fn outgoing_webhook_events_core(
|
||||
AnalyticsProvider::Sqlx(_) => Err(FiltersError::NotImplemented(
|
||||
"Outgoing Webhook Events Logs not implemented for SQLX",
|
||||
))
|
||||
.into_report()
|
||||
.attach_printable("SQL Analytics is not implemented for Outgoing Webhook Events"),
|
||||
AnalyticsProvider::Clickhouse(ckh_pool)
|
||||
| AnalyticsProvider::CombinedSqlx(_, ckh_pool)
|
||||
|
||||
@ -10,7 +10,7 @@ use api_models::analytics::{
|
||||
MetricsResponse, PaymentFiltersResponse,
|
||||
};
|
||||
use common_utils::errors::CustomResult;
|
||||
use error_stack::{IntoReport, ResultExt};
|
||||
use error_stack::ResultExt;
|
||||
use router_env::{
|
||||
instrument, logger,
|
||||
tracing::{self, Instrument},
|
||||
@ -115,7 +115,6 @@ pub async fn get_metrics(
|
||||
.join_next()
|
||||
.await
|
||||
.transpose()
|
||||
.into_report()
|
||||
.change_context(AnalyticsError::UnknownError)?
|
||||
{
|
||||
match task_type {
|
||||
|
||||
@ -18,7 +18,7 @@ use api_models::{
|
||||
};
|
||||
use common_utils::errors::{CustomResult, ParsingError};
|
||||
use diesel_models::enums as storage_enums;
|
||||
use error_stack::{IntoReport, ResultExt};
|
||||
use error_stack::ResultExt;
|
||||
use router_env::{logger, Flow};
|
||||
|
||||
use super::types::{AnalyticsCollection, AnalyticsDataSource, LoadRow, TableEngine};
|
||||
@ -179,7 +179,6 @@ impl SeriesBucket for Granularity {
|
||||
time::Time::MIDNIGHT.replace_hour(clip_start(value.hour(), i))
|
||||
}
|
||||
}
|
||||
.into_report()
|
||||
.change_context(PostProcessingError::BucketClipping)?;
|
||||
|
||||
Ok(value.replace_time(clipped_time))
|
||||
@ -206,7 +205,6 @@ impl SeriesBucket for Granularity {
|
||||
time::Time::MIDNIGHT.replace_hour(clip_end(value.hour(), i))
|
||||
}
|
||||
}
|
||||
.into_report()
|
||||
.change_context(PostProcessingError::BucketClipping)
|
||||
.attach_printable_lazy(|| format!("Bucket Clip Error: {value}"))?;
|
||||
|
||||
@ -644,8 +642,7 @@ where
|
||||
if self.columns.is_empty() {
|
||||
Err(QueryBuildingError::InvalidQuery(
|
||||
"No select fields provided",
|
||||
))
|
||||
.into_report()?;
|
||||
))?;
|
||||
}
|
||||
let mut query = String::from("SELECT ");
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ use api_models::analytics::{
|
||||
AnalyticsMetadata, GetRefundFilterRequest, GetRefundMetricRequest, MetricsResponse,
|
||||
RefundFilterValue, RefundFiltersResponse,
|
||||
};
|
||||
use error_stack::{IntoReport, ResultExt};
|
||||
use error_stack::ResultExt;
|
||||
use router_env::{
|
||||
logger,
|
||||
tracing::{self, Instrument},
|
||||
@ -66,7 +66,6 @@ pub async fn get_metrics(
|
||||
.join_next()
|
||||
.await
|
||||
.transpose()
|
||||
.into_report()
|
||||
.change_context(AnalyticsError::UnknownError)?
|
||||
{
|
||||
let data = data?;
|
||||
|
||||
@ -8,7 +8,7 @@ use api_models::analytics::{
|
||||
SdkEventFiltersResponse,
|
||||
};
|
||||
use common_utils::errors::ReportSwitchExt;
|
||||
use error_stack::{IntoReport, ResultExt};
|
||||
use error_stack::ResultExt;
|
||||
use router_env::{instrument, logger, tracing};
|
||||
|
||||
use super::{
|
||||
@ -32,7 +32,6 @@ pub async fn sdk_events_core(
|
||||
AnalyticsProvider::Sqlx(_) => Err(FiltersError::NotImplemented(
|
||||
"SDK Events not implemented for SQLX",
|
||||
))
|
||||
.into_report()
|
||||
.attach_printable("SQL Analytics is not implemented for Sdk Events"),
|
||||
AnalyticsProvider::Clickhouse(pool) => get_sdk_event(&publishable_key, req, pool).await,
|
||||
AnalyticsProvider::CombinedSqlx(_sqlx_pool, ckh_pool)
|
||||
@ -80,7 +79,6 @@ pub async fn get_metrics(
|
||||
.join_next()
|
||||
.await
|
||||
.transpose()
|
||||
.into_report()
|
||||
.change_context(AnalyticsError::UnknownError)?
|
||||
{
|
||||
logger::info!("Logging Result {:?}", data);
|
||||
@ -165,7 +163,6 @@ pub async fn get_filters(
|
||||
AnalyticsProvider::Sqlx(_pool) => Err(FiltersError::NotImplemented(
|
||||
"SDK Events not implemented for SQLX",
|
||||
))
|
||||
.into_report()
|
||||
.attach_printable("SQL Analytics is not implemented for SDK Events"),
|
||||
AnalyticsProvider::Clickhouse(pool) => {
|
||||
get_sdk_event_filter_for_dimension(dim, publishable_key, &req.time_range, pool)
|
||||
|
||||
@ -8,7 +8,7 @@ use common_utils::errors::{CustomResult, ParsingError};
|
||||
use diesel_models::enums::{
|
||||
AttemptStatus, AuthenticationType, Currency, PaymentMethod, RefundStatus,
|
||||
};
|
||||
use error_stack::{IntoReport, ResultExt};
|
||||
use error_stack::ResultExt;
|
||||
use masking::PeekInterface;
|
||||
use sqlx::{
|
||||
postgres::{PgArgumentBuffer, PgPoolOptions, PgRow, PgTypeInfo, PgValueRef},
|
||||
@ -138,9 +138,7 @@ where
|
||||
for<'a> T: FromRow<'a, PgRow>,
|
||||
{
|
||||
fn load_row(row: PgRow) -> CustomResult<T, QueryExecutionError> {
|
||||
T::from_row(&row)
|
||||
.into_report()
|
||||
.change_context(QueryExecutionError::RowExtractionFailure)
|
||||
T::from_row(&row).change_context(QueryExecutionError::RowExtractionFailure)
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,7 +161,6 @@ impl AnalyticsDataSource for SqlxClient {
|
||||
sqlx::query(&format!("{query};"))
|
||||
.fetch_all(&self.pool)
|
||||
.await
|
||||
.into_report()
|
||||
.change_context(QueryExecutionError::DatabaseError)
|
||||
.attach_printable_lazy(|| format!("Failed to run query {query}"))?
|
||||
.into_iter()
|
||||
@ -179,7 +176,6 @@ impl HealthCheck for SqlxClient {
|
||||
.fetch_all(&self.pool)
|
||||
.await
|
||||
.map(|_| ())
|
||||
.into_report()
|
||||
.change_context(QueryExecutionError::DatabaseError)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user