Skip to content

Commit

Permalink
fix: fetch latecny metric
Browse files Browse the repository at this point in the history
  • Loading branch information
joway committed Jul 24, 2023
1 parent baa0032 commit ebb4fcf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 1 addition & 4 deletions util/proctuner/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ import (

const latencyMetricName = "/sched/latencies:seconds"

var (
metricSamples = []metrics.Sample{{Name: latencyMetricName}}
)

func fetchSchedLatency() (p50, p90, p99, max float64) {
var metricSamples = []metrics.Sample{{Name: latencyMetricName}}
metrics.Read(metricSamples)
histogram := metricSamples[0].Value.Float64Histogram()

Expand Down
7 changes: 7 additions & 0 deletions util/proctuner/tuner.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ func WithP99LatencyThreshold(threshold float64) Option {
}
}

func WithMaxLatencyThreshold(threshold float64) Option {
return func(t *tuner) {
t.maxThreshold = threshold
}
}

func WithMonitorFrequency(duration time.Duration) Option {
return func(t *tuner) {
t.monitorFrequency = duration
Expand Down Expand Up @@ -94,6 +100,7 @@ type tuner struct {
p50Threshold float64
p90Threshold float64
p99Threshold float64
maxThreshold float64
monitorFrequency time.Duration
tuningFrequency time.Duration
}
Expand Down

0 comments on commit ebb4fcf

Please sign in to comment.