Skip to content
This repository was archived by the owner on Aug 4, 2021. It is now read-only.

Commit f5b4c4e

Browse files
Minor fixes
1 parent 564d9ca commit f5b4c4e

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

main.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ var (
9393
},
9494
[]string{"path"},
9595
)
96-
writeThroughtput = util.NewThroughputCalc(tickInterval)
97-
election util.Election
96+
writeThroughput = util.NewThroughputCalc(tickInterval)
97+
election util.Election
9898
)
9999

100100
func init() {
@@ -103,7 +103,7 @@ func init() {
103103
prometheus.MustRegister(failedSamples)
104104
prometheus.MustRegister(sentBatchDuration)
105105
prometheus.MustRegister(httpRequestDuration)
106-
writeThroughtput.Start()
106+
writeThroughput.Start()
107107
}
108108

109109
func main() {
@@ -241,10 +241,10 @@ func write(writer writer) http.Handler {
241241
if err != nil {
242242
log.Warn("msg", "Couldn't get a counter", "labelValue", writer.Name(), "err", err)
243243
}
244-
writeThroughtput.SetCurrent(getCounterValue(counter))
244+
writeThroughput.SetCurrent(getCounterValue(counter))
245245

246246
select {
247-
case d := <-writeThroughtput.Values:
247+
case d := <-writeThroughput.Values:
248248
log.Info("msg", "Samples write throughput", "samples/sec", d)
249249
default:
250250
}

util/lock.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func (l *PgAdvisoryLock) TryLock() (bool, error) {
9494
}
9595
defer rows.Close()
9696
if !rows.Next() {
97-
return false, fmt.Errorf("error while trying to read reponse rows from `pg_try_advisory_lock` function")
97+
return false, fmt.Errorf("error while trying to read response rows from `pg_try_advisory_lock` function")
9898
}
9999
var success bool
100100
if err := rows.Scan(&success); err != nil {

util/util.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import (
88
"github.com/timescale/prometheus-postgresql-adapter/log"
99
)
1010

11-
//ThroughtputCalc runs on scheduled interval to calculate the throughput per second and sends results to a channel
12-
type ThroughtputCalc struct {
11+
//ThroughputCalc runs on scheduled interval to calculate the throughput per second and sends results to a channel
12+
type ThroughputCalc struct {
1313
tickInterval time.Duration
1414
previous float64
1515
current chan float64
@@ -18,18 +18,18 @@ type ThroughtputCalc struct {
1818
lock sync.Mutex
1919
}
2020

21-
func NewThroughputCalc(interval time.Duration) *ThroughtputCalc {
22-
return &ThroughtputCalc{tickInterval: interval, current: make(chan float64, 1), Values: make(chan float64, 1)}
21+
func NewThroughputCalc(interval time.Duration) *ThroughputCalc {
22+
return &ThroughputCalc{tickInterval: interval, current: make(chan float64, 1), Values: make(chan float64, 1)}
2323
}
2424

25-
func (dt *ThroughtputCalc) SetCurrent(value float64) {
25+
func (dt *ThroughputCalc) SetCurrent(value float64) {
2626
select {
2727
case dt.current <- value:
2828
default:
2929
}
3030
}
3131

32-
func (dt *ThroughtputCalc) Start() {
32+
func (dt *ThroughputCalc) Start() {
3333
dt.lock.Lock()
3434
defer dt.lock.Unlock()
3535
if !dt.running {

0 commit comments

Comments
 (0)