github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/util/metric/metric.proto (about) 1 // Copyright 2018 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 // metric.proto requires proto2 to import io.prometheus.client.MetricType. 12 syntax = "proto2"; 13 package cockroach.util.metric; 14 option go_package = "metric"; 15 16 import "gogoproto/gogo.proto"; 17 import "prometheus/client_model/metrics.proto"; 18 19 // metric.LabelPair is a proxy for io.prometheus.client.LabelPair. 20 // io.prometheus.client.LabelPair doesn't support gogoproto.marshaler 21 // and gogoproto.unmarshaler which are required by gRPC. metric.LabelPair 22 // stores information that is similarly structured, supports the requisite 23 // gogoproto options, and is convertible to io.prometheus.client.LabelPair 24 // to satisfy PrometheusExportable's GetLabels method. 25 message LabelPair { 26 optional string name = 1; 27 optional string value = 2; 28 } 29 30 // DisplayUnit describes how the metric's units should be displayed in charts. 31 enum Unit { 32 // UNSET expresses that the metric's DisplayUnit wasn't explicitly set. 33 UNSET = 0; 34 // BYTES expresses that the metric's measurement is in bytes. 35 BYTES = 1; 36 // CONST expresses that the metric's measurement is a constant value. 37 CONST = 2; 38 // COUNT expresses that the metric's measurement is a count. 39 COUNT = 3; 40 // NANOSECONDS expresses that the metric's measurement is in nanoseconds. 41 NANOSECONDS = 4; 42 // PERCENT expresses that the metric's measurement is a percentage value. 43 PERCENT = 5; 44 // SECONDS expresses that the metric's measurement is in seconds. 45 SECONDS = 6; 46 // TIMESTAMP_NS expresses that the metric's measurement is a time since the 47 // Unix epoch in nanoseconds. 48 TIMESTAMP_NS = 7; 49 // TIMESTAMP_SEC expresses that the metric's measurement is a time since the 50 // Unix epoch in seconds. 51 TIMESTAMP_SEC = 8; 52 } 53 54 // Metadata holds metadata about a metric. It must be embedded in 55 // each metric object. It's used to export information about the 56 // metric to Prometheus and for Admin UI charts. 57 message Metadata { 58 required string name = 1 [(gogoproto.nullable) = false]; 59 required string help = 2 [(gogoproto.nullable) = false]; 60 required string measurement = 3 [(gogoproto.nullable) = false]; 61 required Unit unit = 4 [(gogoproto.nullable) = false]; 62 optional io.prometheus.client.MetricType metricType = 5 [(gogoproto.nullable) = false]; 63 repeated LabelPair labels = 6; 64 }