Merge pull request #52 from drift-labs/server-lite

Server lite
This commit is contained in:
Nour Alharithi
2023-12-14 17:13:25 -08:00
committed by GitHub
4 changed files with 479 additions and 17 deletions

View File

@@ -39,6 +39,7 @@ import {
accountUpdatesCounter,
cacheHitCounter,
setLastReceivedWsMsgTs,
runtimeSpecsGauge,
} from './core/metrics';
import { handleResponseTime } from './core/middleware';
import {
@@ -125,6 +126,17 @@ app.use((req, _res, next) => {
next();
});
// Metrics defined here
const bootTimeMs = Date.now();
runtimeSpecsGauge.addCallback((obs) => {
obs.observe(bootTimeMs, {
commit: commitHash,
driftEnv,
rpcEndpoint: endpoint,
wsEndpoint: wsEndpoint,
});
});
app.use(errorHandler);
const server = http.createServer(app);