Skip to content

Commit

Permalink
Merge pull request #109632 from ericharmeling/backport23.1-108597
Browse files Browse the repository at this point in the history
release-23.1: metrics: assign histogram metric type on histogram construction
  • Loading branch information
ericharmeling authored Aug 29, 2023
2 parents 4fe1f7f + 8e79004 commit dfe52dc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
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

0 comments on commit dfe52dc

Please sign in to comment.