Skip to content

Commit

Permalink
Merge branch '44-fix-histogram-metrics' into 'master'
Browse files Browse the repository at this point in the history
Fix metrics histogram negative value addition

Closes #44

See merge request pace/go-microservice!35
  • Loading branch information
Florian Hübsch committed Dec 17, 2018
2 parents 78221f2 + 887bd07 commit 16b3e8c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion backend/postgres/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package postgres

import (
"fmt"
"math"
"time"

"github.com/caarlos0/env"
Expand Down Expand Up @@ -190,7 +191,7 @@ func metricsAdapter(event *pg.QueryProcessedEvent, opts *pg.Options) {
} else {
r := event.Result
pacePostgresQueryRowsTotal.With(labels).Add(float64(r.RowsReturned()))
pacePostgresQueryAffectedTotal.With(labels).Add(float64(r.RowsAffected()))
pacePostgresQueryAffectedTotal.With(labels).Add(math.Max(0, float64(r.RowsAffected())))
}

pacePostgresQueryDurationSeconds.With(labels).Observe(dur)
Expand Down

0 comments on commit 16b3e8c

Please sign in to comment.