github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/kv/kvserver/tscache/metrics.go (about) 1 // Copyright 2017 The Cockroach Authors. 2 // 3 // Use of this software is governed by the Business Source License 4 // included in the file licenses/BSL.txt. 5 // 6 // As of the Change Date specified in that file, in accordance with 7 // the Business Source License, use of this software will be governed 8 // by the Apache License, Version 2.0, included in the file 9 // licenses/APL.txt. 10 11 package tscache 12 13 import "github.com/cockroachdb/cockroach/pkg/util/metric" 14 15 // Metrics holds all metrics relating to a Cache. 16 type Metrics struct { 17 Skl sklMetrics 18 } 19 20 // sklMetrics holds all metrics relating to an intervalSkl. 21 type sklMetrics struct { 22 Pages *metric.Gauge 23 PageRotations *metric.Counter 24 } 25 26 // MetricStruct implements the metrics.Struct interface. 27 func (sklMetrics) MetricStruct() {} 28 29 var _ metric.Struct = sklMetrics{} 30 31 var ( 32 metaSklPages = metric.Metadata{ 33 Name: "tscache.skl.pages", 34 Help: "Number of pages in the timestamp cache", 35 Measurement: "Pages", 36 Unit: metric.Unit_COUNT, 37 } 38 metaSklRotations = metric.Metadata{ 39 Name: "tscache.skl.rotations", 40 Help: "Number of page rotations in the timestamp cache", 41 Measurement: "Page Rotations", 42 Unit: metric.Unit_COUNT, 43 } 44 ) 45 46 func makeMetrics() Metrics { 47 return Metrics{ 48 Skl: sklMetrics{ 49 Pages: metric.NewGauge(metaSklPages), 50 PageRotations: metric.NewCounter(metaSklRotations), 51 }, 52 } 53 }