diff --git a/src/screens/HyperSwitch/Analytics/SystemMetrics/SystemMetricsAnalytics.res b/src/screens/HyperSwitch/Analytics/SystemMetrics/SystemMetricsAnalytics.res index 79dea5d7c..2513cbdbd 100644 --- a/src/screens/HyperSwitch/Analytics/SystemMetrics/SystemMetricsAnalytics.res +++ b/src/screens/HyperSwitch/Analytics/SystemMetrics/SystemMetricsAnalytics.res @@ -74,118 +74,6 @@ module APITableInfo = { } } -module ConnectorLatency = { - open DynamicSingleStat - open SystemMetricsAnalyticsUtils - open HSAnalyticsUtils - open AnalyticsTypes - @react.component - let make = () => { - let (_totalVolume, setTotalVolume) = React.useState(_ => 0) - - let getStatData = ( - singleStatData: systemMetricsObjectType, - timeSeriesData: array, - deltaTimestampData: DynamicSingleStat.deltaRange, - colType, - _mode, - ) => { - switch colType { - | Latency | _ => { - title: "Payments Confirm Latency", - tooltipText: "Average time taken for the entire Payments Confirm API call.", - deltaTooltipComponent: AnalyticsUtils.singlestatDeltaTooltipFormat( - singleStatData.latency, - deltaTimestampData.currentSr, - ), - value: singleStatData.latency /. 1000.0, - delta: { - singleStatData.latency - }, - data: constructData("latency", timeSeriesData), - statType: "LatencyMs", - showDelta: false, - } - } - } - - let defaultColumns: array> = [ - { - sectionName: "", - columns: [Latency], - }, - ] - - let singleStatBodyMake = (singleStatBodyEntity: singleStatBodyEntity) => { - let filters = - [ - ("api_name", ["PaymentsConfirm"->Js.Json.string]->Js.Json.array), - ("status_code", [200.0->Js.Json.number]->Js.Json.array), - ("flow_type", ["Payment"->Js.Json.string]->Js.Json.array), - ] - ->Js.Dict.fromArray - ->Js.Json.object_ - - [ - AnalyticsUtils.getFilterRequestBody( - ~filter=filters->Some, - ~metrics=singleStatBodyEntity.metrics, - ~delta=?singleStatBodyEntity.delta, - ~startDateTime=singleStatBodyEntity.startDateTime, - ~endDateTime=singleStatBodyEntity.endDateTime, - ~mode=singleStatBodyEntity.mode, - ~customFilter=?singleStatBodyEntity.customFilter, - ~source=?singleStatBodyEntity.source, - ~granularity=singleStatBodyEntity.granularity, - ~prefix=singleStatBodyEntity.prefix, - (), - )->Js.Json.object_, - ] - ->Js.Json.array - ->Js.Json.stringify - } - - let getStatEntity: 'a => DynamicSingleStat.entityType<'colType, 't, 't2> = metrics => { - urlConfig: [ - { - uri: `${HSwitchGlobalVars.hyperSwitchApiPrefix}/analytics/v1/metrics/${domain}`, - metrics: metrics->getStringListFromArrayDict, - singleStatBody: singleStatBodyMake, - singleStatTimeSeriesBody: singleStatBodyMake, - }, - ], - getObjects: itemToObjMapper, - getTimeSeriesObject: timeSeriesObjMapper, - defaultColumns, - getData: getStatData, - totalVolumeCol: None, - matrixUriMapper: _ => - `${HSwitchGlobalVars.hyperSwitchApiPrefix}/analytics/v1/metrics/${domain}`, - } - - let metrics = [Latency->getStringFromVarient]->Js.Array2.map(key => { - [("name", key->Js.Json.string)]->Js.Dict.fromArray->Js.Json.object_ - }) - - let singleStatEntity = getStatEntity(metrics) - let dateDict = HSwitchRemoteFilter.getDateFilteredObject() - - Js.Array2.map(getStringFromVarient)} - moduleName="SystemMetrics" - defaultStartDate={dateDict.start_time} - defaultEndDate={dateDict.end_time} - setTotalVolume - showPercentage=false - isHomePage=false - statSentiment={singleStatEntity.statSentiment->Belt.Option.getWithDefault(Js.Dict.empty())} - /> - } -} - module HSiwtchPaymentConfirmLatency = { open DynamicSingleStat open SystemMetricsAnalyticsUtils