From 5cd3e977ffd6dfb28b92c997884d8adf8b124334 Mon Sep 17 00:00:00 2001 From: Yshayy Date: Tue, 30 Jan 2024 15:44:28 +0200 Subject: [PATCH] ssh connection metrics should be aggregated by clientId (#394) --- tunnel-server/src/metrics.ts | 2 +- tunnel-server/src/ssh/index.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tunnel-server/src/metrics.ts b/tunnel-server/src/metrics.ts index 0a318e4f..ad8d05e5 100644 --- a/tunnel-server/src/metrics.ts +++ b/tunnel-server/src/metrics.ts @@ -4,7 +4,7 @@ import { Gauge, Counter, register } from 'prom-client' export const sshConnectionsGauge = new Gauge({ name: 'sshConnections', help: 'Current number of open SSH connections', - labelNames: ['envId'], + labelNames: ['clientId'], }) export const tunnelsGauge = new Gauge({ diff --git a/tunnel-server/src/ssh/index.ts b/tunnel-server/src/ssh/index.ts index 270d7e02..7197e2fa 100644 --- a/tunnel-server/src/ssh/index.ts +++ b/tunnel-server/src/ssh/index.ts @@ -28,8 +28,8 @@ export const createSshServer = ({ }) => { const onClient = (client: BaseSshClient) => { const { clientId, publicKey, envId, connectionId, publicKeyThumbprint, log } = client - sshConnectionsGauge.inc({ envId }) - const cleanupClient = once(() => { sshConnectionsGauge.dec({ envId }) }) + sshConnectionsGauge.inc({ clientId }) + const cleanupClient = once(() => { sshConnectionsGauge.dec({ clientId }) }) const tunnels = new Map() client .on('forward', async (requestId, { path: tunnelPath, access, meta, inject }, localSocketPath, accept, reject) => {