add histogram for gpa fetch
This commit is contained in:
@@ -37,6 +37,7 @@ enum METRIC_TYPES {
|
|||||||
runtime_specs = 'runtime_specs',
|
runtime_specs = 'runtime_specs',
|
||||||
endpoint_response_times_histogram = 'endpoint_response_times_histogram',
|
endpoint_response_times_histogram = 'endpoint_response_times_histogram',
|
||||||
endpoint_response_status = 'endpoint_response_status',
|
endpoint_response_status = 'endpoint_response_status',
|
||||||
|
gpa_fetch_duration = 'endpoint_response_status',
|
||||||
health_status = 'health_status',
|
health_status = 'health_status',
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,6 +71,12 @@ const meterProvider = new MeterProvider({
|
|||||||
meterName,
|
meterName,
|
||||||
aggregation: createHistogramBuckets(0, 20, 30),
|
aggregation: createHistogramBuckets(0, 20, 30),
|
||||||
}),
|
}),
|
||||||
|
new View({
|
||||||
|
instrumentName: METRIC_TYPES.gpa_fetch_duration,
|
||||||
|
instrumentType: InstrumentType.HISTOGRAM,
|
||||||
|
meterName,
|
||||||
|
aggregation: createHistogramBuckets(0, 500, 20),
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
meterProvider.addMetricReader(exporter);
|
meterProvider.addMetricReader(exporter);
|
||||||
@@ -109,6 +116,13 @@ const endpointResponseTimeHistogram = meter.createHistogram(
|
|||||||
unit: 'ms',
|
unit: 'ms',
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const gpaFetchDurationHistogram = meter.createHistogram(
|
||||||
|
METRIC_TYPES.gpa_fetch_duration,
|
||||||
|
{
|
||||||
|
description: 'Duration of GPA fetches',
|
||||||
|
unit: 'ms',
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
const responseStatusCounter = meter.createCounter(
|
const responseStatusCounter = meter.createCounter(
|
||||||
METRIC_TYPES.endpoint_response_status,
|
METRIC_TYPES.endpoint_response_status,
|
||||||
@@ -170,6 +184,7 @@ const handleHealthCheck = (slotSource: SlotSource) => {
|
|||||||
|
|
||||||
export {
|
export {
|
||||||
endpointResponseTimeHistogram,
|
endpointResponseTimeHistogram,
|
||||||
|
gpaFetchDurationHistogram,
|
||||||
responseStatusCounter,
|
responseStatusCounter,
|
||||||
handleHealthCheck,
|
handleHealthCheck,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import {
|
|||||||
import { logger, setLogLevel } from './utils/logger';
|
import { logger, setLogLevel } from './utils/logger';
|
||||||
|
|
||||||
import * as http from 'http';
|
import * as http from 'http';
|
||||||
import { handleHealthCheck } from './core/metrics';
|
import { gpaFetchDurationHistogram, handleHealthCheck } from './core/metrics';
|
||||||
import { handleResponseTime } from './core/middleware';
|
import { handleResponseTime } from './core/middleware';
|
||||||
import {
|
import {
|
||||||
SubscriberLookup,
|
SubscriberLookup,
|
||||||
@@ -279,7 +279,9 @@ const main = async () => {
|
|||||||
if (useWebsocket && !FEATURE_FLAGS.DISABLE_GPA_REFRESH) {
|
if (useWebsocket && !FEATURE_FLAGS.DISABLE_GPA_REFRESH) {
|
||||||
const recursiveFetch = (delay = WS_FALLBACK_FETCH_INTERVAL) => {
|
const recursiveFetch = (delay = WS_FALLBACK_FETCH_INTERVAL) => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
const startFetch = Date.now();
|
||||||
dlobProvider.fetch().then(() => {
|
dlobProvider.fetch().then(() => {
|
||||||
|
gpaFetchDurationHistogram.record(Date.now() - startFetch);
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
recursiveFetch();
|
recursiveFetch();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user