Skip to content

Commit

Permalink
chore: cherry pick PR #2734 (#2735)
Browse files Browse the repository at this point in the history
fix: The relay metrics are not exposed in the websocket server (#2734)

Signed-off-by: Victor Yanev <victor.yanev@limechain.tech>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>

Revert "fix: The relay metrics are not exposed in the websocket server (#2734)"

This reverts commit 0d5bd6b.

Reapply "fix: The relay metrics are not exposed in the websocket server (#2734)"

This reverts commit f39638840544685865994b4fa976b86f7671162c.

Co-authored-by: Victor Yanev <161485803+victor-yanev@users.noreply.github.com>
  • Loading branch information
quiet-node and victor-yanev authored Jul 23, 2024
1 parent c4b8a81 commit 347b286
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/ws-server/src/webSocketServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import pino from 'pino';
import dotenv from 'dotenv';
import { v4 as uuid } from 'uuid';
import websockify from 'koa-websocket';
import { Registry } from 'prom-client';
import { collectDefaultMetrics, Registry } from 'prom-client';
import { getRequestResult } from './controllers';
import { WS_CONSTANTS } from './utils/constants';
import { formatIdMessage } from './utils/formatters';
Expand Down Expand Up @@ -202,6 +202,8 @@ app.ws.use(async (ctx) => {
});

const httpApp = new KoaJsonRpc(logger, register).getKoaApp();
collectDefaultMetrics({ register, prefix: 'rpc_relay_' });

httpApp.use(async (ctx, next) => {
// prometheus metrics exposure
if (ctx.url === '/metrics') {
Expand Down

0 comments on commit 347b286

Please sign in to comment.