Merge pull request #44 from drift-labs/master

staging metrics change
This commit is contained in:
Nour Alharithi
2023-12-11 08:22:43 -08:00
committed by GitHub
3 changed files with 13 additions and 10 deletions

View File

@@ -132,10 +132,6 @@ const cacheHitCounter = meter.createCounter(METRIC_TYPES.cache_hit_count, {
description: 'Total redis cache hits', description: 'Total redis cache hits',
}); });
const cacheMissCounter = meter.createCounter(METRIC_TYPES.cache_miss_count, {
description: 'Total redis cache misses',
});
const accountUpdatesCounter = meter.createCounter( const accountUpdatesCounter = meter.createCounter(
METRIC_TYPES.account_updates_count, METRIC_TYPES.account_updates_count,
{ {
@@ -249,5 +245,4 @@ export {
setLastReceivedWsMsgTs, setLastReceivedWsMsgTs,
accountUpdatesCounter, accountUpdatesCounter,
cacheHitCounter, cacheHitCounter,
cacheMissCounter,
}; };

View File

@@ -39,7 +39,6 @@ import {
accountUpdatesCounter, accountUpdatesCounter,
cacheHitCounter, cacheHitCounter,
setLastReceivedWsMsgTs, setLastReceivedWsMsgTs,
cacheMissCounter,
} from './core/metrics'; } from './core/metrics';
import { handleResponseTime } from './core/middleware'; import { handleResponseTime } from './core/middleware';
import { import {
@@ -813,7 +812,9 @@ const main = async () => {
} }
if (l2Formatted) { if (l2Formatted) {
cacheHitCounter.add(1); cacheHitCounter.add(1, {
miss: false,
});
res.writeHead(200); res.writeHead(200);
res.end(l2Formatted); res.end(l2Formatted);
return; return;
@@ -871,7 +872,9 @@ const main = async () => {
); );
} }
} }
cacheMissCounter.add(1); cacheHitCounter.add(1, {
miss: true,
});
res.writeHead(200); res.writeHead(200);
res.end(JSON.stringify(l2Formatted)); res.end(JSON.stringify(l2Formatted));
} catch (err) { } catch (err) {
@@ -993,7 +996,9 @@ const main = async () => {
} }
if (l2Formatted) { if (l2Formatted) {
cacheHitCounter.add(1); cacheHitCounter.add(1, {
miss: false,
});
return l2Formatted; return l2Formatted;
} }
} }
@@ -1052,7 +1057,9 @@ const main = async () => {
); );
} }
} }
cacheMissCounter.add(1); cacheHitCounter.add(1, {
miss: true,
});
return l2Formatted; return l2Formatted;
}) })
); );

View File

@@ -149,6 +149,7 @@ const main = async () => {
accountSubscription = { accountSubscription = {
type: 'websocket', type: 'websocket',
commitment: stateCommitment, commitment: stateCommitment,
resubTimeoutMs: 30_000,
}; };
slotSubscriber = new SlotSubscriber(connection); slotSubscriber = new SlotSubscriber(connection);
await slotSubscriber.subscribe(); await slotSubscriber.subscribe();