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