Skip to content

Commit

Permalink
refactor: removed dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
sagarnaikjuspay committed Dec 19, 2023
1 parent 37aca6e commit 02a6964
Showing 1 changed file with 0 additions and 112 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<systemMetricsSingleStateSeries>,
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<DynamicSingleStat.columns<systemMetricsSingleStateMetrics>> = [
{
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()

<DynamicSingleStat
entity={singleStatEntity}
startTimeFilterKey
endTimeFilterKey
filterKeys={[ApiName, Status_code]->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
Expand Down

0 comments on commit 02a6964

Please sign in to comment.