add histogram for gpa fetch

This commit is contained in:
wphan
2023-11-30 18:59:31 -08:00
parent 06b428e386
commit a11c5b67d3
2 changed files with 18 additions and 1 deletions

View File

@@ -33,7 +33,7 @@ import {
import { logger, setLogLevel } from './utils/logger';
import * as http from 'http';
import { handleHealthCheck } from './core/metrics';
import { gpaFetchDurationHistogram, handleHealthCheck } from './core/metrics';
import { handleResponseTime } from './core/middleware';
import {
SubscriberLookup,
@@ -279,7 +279,9 @@ const main = async () => {
if (useWebsocket && !FEATURE_FLAGS.DISABLE_GPA_REFRESH) {
const recursiveFetch = (delay = WS_FALLBACK_FETCH_INTERVAL) => {
setTimeout(() => {
const startFetch = Date.now();
dlobProvider.fetch().then(() => {
gpaFetchDurationHistogram.record(Date.now() - startFetch);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
recursiveFetch();
});