Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release-23.1: metrics: assign histogram metric type on histogram construction #109632

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pkg/ts/catalog/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ var histogramMetricsNames = map[string]struct{}{
"kv.replica_read_batch_evaluate.latency": {},
"kv.replica_write_batch_evaluate.latency": {},
"leases.requests.latency": {},
"changefeed.nprocs_flush_nanos": {},
"changefeed.nprocs_consume_event_nanos": {},
"rebalancing.replicas.queriespersecond": {},
"rebalancing.replicas.cpunanospersecond": {},
"sql.pre_serve.mem.max": {},
}

func allInternalTSMetricsNames() []string {
Expand Down
2 changes: 2 additions & 0 deletions pkg/util/metric/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ type HistogramOptions struct {
}

func NewHistogram(opt HistogramOptions) IHistogram {
opt.Metadata.MetricType = prometheusgo.MetricType_HISTOGRAM
if hdrEnabled && opt.Mode != HistogramModePrometheus {
if opt.Mode == HistogramModePreferHdrLatency {
return NewHdrLatency(opt.Metadata, opt.Duration)
Expand Down Expand Up @@ -481,6 +482,7 @@ func NewManualWindowHistogram(
panic(err.Error())
}

meta.MetricType = prometheusgo.MetricType_HISTOGRAM
h := &ManualWindowHistogram{
Metadata: meta,
}
Expand Down
1 change: 1 addition & 0 deletions pkg/util/schedulerlatency/histogram.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func newRuntimeHistogram(metadata metric.Metadata, buckets []float64) *runtimeHi
if buckets[0] == math.Inf(-1) {
buckets = buckets[1:]
}
metadata.MetricType = prometheusgo.MetricType_HISTOGRAM
h := &runtimeHistogram{
Metadata: metadata,
// Go runtime histograms as of go1.19 are always in seconds whereas
Expand Down