fix metrics name
This commit is contained in:
@@ -39,7 +39,7 @@ enum METRIC_TYPES {
|
||||
endpoint_response_status = 'endpoint_response_status',
|
||||
gpa_fetch_duration = 'gpa_fetch_duration',
|
||||
last_ws_message_received_ts = 'last_ws_message_received_ts',
|
||||
account_updates_per_sec = 'account_updates_per_sec',
|
||||
account_updates_count = 'account_updates_count',
|
||||
current_system_ts = 'current_system_ts',
|
||||
health_status = 'health_status',
|
||||
}
|
||||
@@ -126,19 +126,12 @@ lastWsReceivedTsGauge.addCallback((obs: ObservableResult) => {
|
||||
obs.observe(lastWsMsgReceivedTs, {});
|
||||
});
|
||||
|
||||
let lastAccountUpdatesPerSecond = 0;
|
||||
const setAccountUpdatesPerSecond = (updatesPerSecond: number) => {
|
||||
lastAccountUpdatesPerSecond = updatesPerSecond;
|
||||
};
|
||||
const accountUpdatesPerSecondGauge = meter.createObservableGauge(
|
||||
METRIC_TYPES.account_updates_per_sec,
|
||||
const accountUpdatesCounter = meter.createCounter(
|
||||
METRIC_TYPES.account_updates_count,
|
||||
{
|
||||
description: 'Updates per second, the last second',
|
||||
description: 'Total accounts update',
|
||||
}
|
||||
);
|
||||
accountUpdatesPerSecondGauge.addCallback((obs: ObservableResult) => {
|
||||
obs.observe(lastAccountUpdatesPerSecond, {});
|
||||
});
|
||||
|
||||
const currentSystemTsGauge = meter.createObservableGauge(
|
||||
METRIC_TYPES.current_system_ts,
|
||||
@@ -244,5 +237,5 @@ export {
|
||||
responseStatusCounter,
|
||||
handleHealthCheck,
|
||||
setLastReceivedWsMsgTs,
|
||||
setAccountUpdatesPerSecond as setLastAccountUpdatesPerSecond,
|
||||
accountUpdatesCounter,
|
||||
};
|
||||
|
||||
20
src/index.ts
20
src/index.ts
@@ -38,7 +38,7 @@ import * as http from 'http';
|
||||
import {
|
||||
gpaFetchDurationHistogram,
|
||||
handleHealthCheck,
|
||||
setLastAccountUpdatesPerSecond,
|
||||
accountUpdatesCounter,
|
||||
setLastReceivedWsMsgTs,
|
||||
} from './core/metrics';
|
||||
import { handleResponseTime } from './core/middleware';
|
||||
@@ -255,7 +255,7 @@ const main = async () => {
|
||||
};
|
||||
}
|
||||
|
||||
let updatesPerTenSecond = 0;
|
||||
let updatesReceivedTotal = 0;
|
||||
const orderSubscriber = new OrderSubscriber({
|
||||
driftClient,
|
||||
subscriptionConfig,
|
||||
@@ -264,13 +264,10 @@ const main = async () => {
|
||||
'updateReceived',
|
||||
(_pubkey: PublicKey, _slot: number, _dataType: 'raw' | 'decoded') => {
|
||||
setLastReceivedWsMsgTs(Date.now());
|
||||
updatesPerTenSecond++;
|
||||
updatesReceivedTotal++;
|
||||
accountUpdatesCounter.add(1);
|
||||
}
|
||||
);
|
||||
setInterval(() => {
|
||||
setLastAccountUpdatesPerSecond(updatesPerTenSecond / 10);
|
||||
updatesPerTenSecond = 0;
|
||||
}, 10_000);
|
||||
|
||||
dlobProvider = getDLOBProviderFromOrderSubscriber(orderSubscriber);
|
||||
|
||||
@@ -308,6 +305,9 @@ const main = async () => {
|
||||
);
|
||||
logger.info(`dlob provider size ${dlobProvider.size()}`);
|
||||
|
||||
logger.info(
|
||||
`GPA refresh?: ${useWebsocket && !FEATURE_FLAGS.DISABLE_GPA_REFRESH}`
|
||||
);
|
||||
if (useWebsocket && !FEATURE_FLAGS.DISABLE_GPA_REFRESH) {
|
||||
const recursiveFetch = (delay = WS_FALLBACK_FETCH_INTERVAL) => {
|
||||
setTimeout(() => {
|
||||
@@ -479,9 +479,11 @@ const main = async () => {
|
||||
auctionEndPrice: order.auctionEndPrice.toString(),
|
||||
maxTs: order.maxTs.toString(),
|
||||
};
|
||||
if (order.quoteAssetAmount) {
|
||||
if (order.quoteAssetAmountFilled) {
|
||||
orderHuman['quoteAssetAmount'] =
|
||||
order.quoteAssetAmount.toString();
|
||||
order.quoteAssetAmountFilled.toString();
|
||||
orderHuman['quoteAssetAmountFilled'] =
|
||||
order.quoteAssetAmountFilled.toString();
|
||||
}
|
||||
|
||||
orders.push({
|
||||
|
||||
Reference in New Issue
Block a user