Skip to content
This repository has been archived by the owner on Oct 2, 2022. It is now read-only.

Commit

Permalink
0.9.1: Metrics
Browse files Browse the repository at this point in the history
This release adds metrics for backend connections / failures.
  • Loading branch information
Janos Pasztor committed Apr 1, 2021
1 parent 90934e1 commit 8d9381b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.9.0 Initial version
## 0.9.1: Metrics

This release adds metrics for backend connections / failures.

## 0.9.0: Initial version

This version is the initial release of the SSH proxy module.
3 changes: 3 additions & 0 deletions networkConnectionHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ func (s *networkConnectionHandler) createBackendSSHConnection(username string) (
*ssh.Client,
error,
) {
s.backendRequestsMetric.Increment()
target := fmt.Sprintf("%s:%d", s.config.Server, s.config.Port)
tcpConn, err := s.createBackendTCPConnection(username, target)
if err != nil {
Expand All @@ -106,6 +107,7 @@ func (s *networkConnectionHandler) createBackendSSHConnection(username string) (

sshConn, newChannels, requests, err := ssh.NewClientConn(s.tcpConn, target, sshClientConfig)
if err != nil {
s.backendFailuresMetric.Increment(metrics.Label("failure", "handshake"))
return nil, nil, nil, nil, log.WrapUser(
err,
EBackendHandshakeFailed,
Expand Down Expand Up @@ -180,6 +182,7 @@ loop:
if lastError == nil {
return networkConnection, nil
}
s.backendFailuresMetric.Increment(metrics.Label("failure", "tcp"))
s.logger.Debug(log.WrapUser(
lastError,
EBackendConnectionFailed,
Expand Down

0 comments on commit 8d9381b

Please sign in to comment.