Skip to content

Commit

Permalink
Fix metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
mostafa committed Oct 15, 2023
1 parent f02a31f commit 8013cb9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions network/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ func (c *Client) Reconnect() error {

if c.conn != nil {
c.Close()
} else {
metrics.ServerConnections.Dec()
}
c.connected.Store(false)

Expand Down
4 changes: 4 additions & 0 deletions network/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/gatewayd-io/gatewayd/logging"
"github.com/gatewayd-io/gatewayd/plugin"
"github.com/gatewayd-io/gatewayd/pool"
"github.com/prometheus/client_golang/prometheus"
"github.com/rs/zerolog"
"github.com/stretchr/testify/assert"
"google.golang.org/grpc"
Expand All @@ -25,6 +26,9 @@ import (
func TestRunServer(t *testing.T) {
errs := make(chan error)

// Reset prometheus metrics.
prometheus.DefaultRegisterer = prometheus.NewRegistry()

logger := logging.NewLogger(context.Background(), logging.LoggerConfig{
Output: []config.LogOutput{
config.File,
Expand Down

0 comments on commit 8013cb9

Please sign in to comment.