TP-5555 | metrics integration
This commit is contained in:
@@ -121,7 +121,7 @@ class AmeyoAdapter implements IAdapter {
|
||||
this.metricProcessor = new MetricsProcessor(this.metricUrl, this.metricFlowName, this.metricTransporter);
|
||||
|
||||
}
|
||||
this.metricProcessor.pushCounterMetric({metricName: 'initSdk', flow: "", metaData: this.metricMetadata})
|
||||
this.metricProcessor.pushCounterMetric({metricName: 'initSdk', flow: "sdk_init_count", metaData: this.metricMetadata})
|
||||
}
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ class AmeyoAdapter implements IAdapter {
|
||||
loadCredentials({accountName, userName, domain, password});
|
||||
loadCallOptions();
|
||||
sipRegister({domain: domainOnly, port});
|
||||
this.metricProcessor.pushCounterMetric({metricName: 'sipStackInitialised',flow: 'ameyo-adapter', metaData: this.metricMetadata})
|
||||
this.metricProcessor.pushCounterMetric({metricName: 'sipStackInitialised',flow: 'ameyo-sip-stack_init_count', metaData: this.metricMetadata})
|
||||
|
||||
|
||||
}
|
||||
@@ -145,11 +145,11 @@ class AmeyoAdapter implements IAdapter {
|
||||
|
||||
_onListenForCorsBypassResponse = (payload: GenericObject) => {
|
||||
console.log('universal sdk', payload);
|
||||
this.metricProcessor.pushCounterMetric({metricName: `ameyo-api-call-count`, metaData: this.metricMetadata, flow: payload?.data?.requestKey})
|
||||
this.metricProcessor.pushHistogramMetric({metricName: `ameyo-api-latency-${payload?.data?.requestKey}`, metaData: this.metricMetadata, flow:'api-latency', value: payload?.data?.time} )
|
||||
this.metricProcessor.pushCounterMetric({metricName: `ameyo-api-call-count`, metaData: this.metricMetadata, flow: 'api-call-count', subFlow: payload?.data?.requestKey})
|
||||
this.metricProcessor.pushHistogramMetric({metricName: `ameyo-api-latency-${payload?.data?.requestKey}`, metaData: this.metricMetadata, flow:'api-latency', subFlow: payload?.data?.requestKey,value: payload?.data?.time} )
|
||||
|
||||
if(payload?.data?.err) {
|
||||
this.metricProcessor.pushCounterMetric({metricName: `ameyo-api-err`, metaData: this.metricMetadata, flow: payload?.data?.requestKey})
|
||||
this.metricProcessor.pushCounterMetric({metricName: `ameyo-api-err-count`, metaData: this.metricMetadata, flow: 'api-error-count', subFlow: payload?.data?.requestKey})
|
||||
}
|
||||
|
||||
if (payload?.data?.requestKey === RequestKeys.AMEYO_LOGIN) {
|
||||
@@ -214,6 +214,8 @@ class AmeyoAdapter implements IAdapter {
|
||||
}
|
||||
|
||||
_registerMessageListener = async ({data}: GenericObject) => {
|
||||
this.metricProcessor.pushCounterMetric({metricName: `ameyo-events-count`, metaData: this.metricMetadata, flow: 'api-events-count', subFlow:data?.type})
|
||||
|
||||
if (data?.type === MessagingType.SET_RESPONSE_WITHOUT_CORS) {
|
||||
this._onListenForCorsBypassResponse(data);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ export type CounterMetricPayload = {
|
||||
metricName: string;
|
||||
metaData?: Record<string, any>;
|
||||
flow: string;
|
||||
subFlow?: string;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -36,30 +36,35 @@ class MetricsProcessor {
|
||||
body: JSON.stringify(finalPayload)
|
||||
})
|
||||
}
|
||||
pushCounterMetric({metricName, flow, metaData}: CounterMetricPayload ) {
|
||||
pushCounterMetric({metricName, flow, metaData, subFlow}: CounterMetricPayload ) {
|
||||
this._sendMetricToMetricServer({
|
||||
flow: flow,
|
||||
metadata: metaData,
|
||||
metricType: MetricType.COUNTER,
|
||||
subflow:subFlow,
|
||||
metricName,
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
pushHistogramMetric({metricName, value, flow, metaData}: HistogramMetricPayload) {
|
||||
pushHistogramMetric({metricName, value, flow, metaData, subFlow}: HistogramMetricPayload) {
|
||||
this._sendMetricToMetricServer({
|
||||
flow: flow,
|
||||
metadata: metaData,
|
||||
metricType: MetricType.HISTOGRAM,
|
||||
subflow: subFlow,
|
||||
metricName,
|
||||
value
|
||||
value,
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
pushGaugeMetric({metricName, value, flow, metaData}: GaugeMetricPayload) {
|
||||
pushGaugeMetric({metricName, value, flow, metaData, subFlow}: GaugeMetricPayload) {
|
||||
this._sendMetricToMetricServer({
|
||||
flow: flow,
|
||||
metadata: metaData,
|
||||
metricType: MetricType.GAUGE,
|
||||
subflow: subFlow,
|
||||
metricName,
|
||||
value,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user