Skip to content

Commit

Permalink
ssh connection metrics should be aggregated by clientId (#394)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yshayy authored Jan 30, 2024
1 parent 50deaa8 commit 5cd3e97
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tunnel-server/src/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
4 changes: 2 additions & 2 deletions tunnel-server/src/ssh/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, string>()
client
.on('forward', async (requestId, { path: tunnelPath, access, meta, inject }, localSocketPath, accept, reject) => {
Expand Down

0 comments on commit 5cd3e97

Please sign in to comment.