Files
metric/client/metrics_grpc.go
zeekay ed527efb09 feat: make protobuf optional via build tag
- Add native Go structs with JSON encoding (default, //go:build !grpc)
- Move protobuf types to //go:build grpc
- Add convert.go bridge to grpc build only
- Add client package tests for native types

Users can now build without protobuf dependency by default.
Use -tags=grpc to enable protobuf support.
2026-01-26 22:01:32 -08:00

1137 lines
36 KiB
Go

//go:build grpc
// Copyright 2013 Prometheus Team
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc v6.33.0
// source: io/metric/client/metrics.proto
package io_metric_client
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type MetricType int32
const (
// COUNTER must use the Metric field "counter".
MetricType_COUNTER MetricType = 0
// GAUGE must use the Metric field "gauge".
MetricType_GAUGE MetricType = 1
// SUMMARY must use the Metric field "summary".
MetricType_SUMMARY MetricType = 2
// UNTYPED must use the Metric field "untyped".
MetricType_UNTYPED MetricType = 3
// HISTOGRAM must use the Metric field "histogram".
MetricType_HISTOGRAM MetricType = 4
// GAUGE_HISTOGRAM must use the Metric field "histogram".
MetricType_GAUGE_HISTOGRAM MetricType = 5
)
// Enum value maps for MetricType.
var (
MetricType_name = map[int32]string{
0: "COUNTER",
1: "GAUGE",
2: "SUMMARY",
3: "UNTYPED",
4: "HISTOGRAM",
5: "GAUGE_HISTOGRAM",
}
MetricType_value = map[string]int32{
"COUNTER": 0,
"GAUGE": 1,
"SUMMARY": 2,
"UNTYPED": 3,
"HISTOGRAM": 4,
"GAUGE_HISTOGRAM": 5,
}
)
func (x MetricType) Enum() *MetricType {
p := new(MetricType)
*p = x
return p
}
func (x MetricType) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (MetricType) Descriptor() protoreflect.EnumDescriptor {
return file_io_metric_client_metrics_proto_enumTypes[0].Descriptor()
}
func (MetricType) Type() protoreflect.EnumType {
return &file_io_metric_client_metrics_proto_enumTypes[0]
}
func (x MetricType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Do not use.
func (x *MetricType) UnmarshalJSON(b []byte) error {
num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)
if err != nil {
return err
}
*x = MetricType(num)
return nil
}
// Deprecated: Use MetricType.Descriptor instead.
func (MetricType) EnumDescriptor() ([]byte, []int) {
return file_io_metric_client_metrics_proto_rawDescGZIP(), []int{0}
}
type LabelPair struct {
state protoimpl.MessageState `protogen:"open.v1"`
Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
Value *string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *LabelPair) Reset() {
*x = LabelPair{}
mi := &file_io_metric_client_metrics_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *LabelPair) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LabelPair) ProtoMessage() {}
func (x *LabelPair) ProtoReflect() protoreflect.Message {
mi := &file_io_metric_client_metrics_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use LabelPair.ProtoReflect.Descriptor instead.
func (*LabelPair) Descriptor() ([]byte, []int) {
return file_io_metric_client_metrics_proto_rawDescGZIP(), []int{0}
}
func (x *LabelPair) GetName() string {
if x != nil && x.Name != nil {
return *x.Name
}
return ""
}
func (x *LabelPair) GetValue() string {
if x != nil && x.Value != nil {
return *x.Value
}
return ""
}
type Gauge struct {
state protoimpl.MessageState `protogen:"open.v1"`
Value *float64 `protobuf:"fixed64,1,opt,name=value" json:"value,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Gauge) Reset() {
*x = Gauge{}
mi := &file_io_metric_client_metrics_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Gauge) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Gauge) ProtoMessage() {}
func (x *Gauge) ProtoReflect() protoreflect.Message {
mi := &file_io_metric_client_metrics_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Gauge.ProtoReflect.Descriptor instead.
func (*Gauge) Descriptor() ([]byte, []int) {
return file_io_metric_client_metrics_proto_rawDescGZIP(), []int{1}
}
func (x *Gauge) GetValue() float64 {
if x != nil && x.Value != nil {
return *x.Value
}
return 0
}
type Counter struct {
state protoimpl.MessageState `protogen:"open.v1"`
Value *float64 `protobuf:"fixed64,1,opt,name=value" json:"value,omitempty"`
Exemplar *Exemplar `protobuf:"bytes,2,opt,name=exemplar" json:"exemplar,omitempty"`
CreatedTimestamp *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=created_timestamp,json=createdTimestamp" json:"created_timestamp,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Counter) Reset() {
*x = Counter{}
mi := &file_io_metric_client_metrics_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Counter) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Counter) ProtoMessage() {}
func (x *Counter) ProtoReflect() protoreflect.Message {
mi := &file_io_metric_client_metrics_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Counter.ProtoReflect.Descriptor instead.
func (*Counter) Descriptor() ([]byte, []int) {
return file_io_metric_client_metrics_proto_rawDescGZIP(), []int{2}
}
func (x *Counter) GetValue() float64 {
if x != nil && x.Value != nil {
return *x.Value
}
return 0
}
func (x *Counter) GetExemplar() *Exemplar {
if x != nil {
return x.Exemplar
}
return nil
}
func (x *Counter) GetCreatedTimestamp() *timestamppb.Timestamp {
if x != nil {
return x.CreatedTimestamp
}
return nil
}
type Quantile struct {
state protoimpl.MessageState `protogen:"open.v1"`
Quantile *float64 `protobuf:"fixed64,1,opt,name=quantile" json:"quantile,omitempty"`
Value *float64 `protobuf:"fixed64,2,opt,name=value" json:"value,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Quantile) Reset() {
*x = Quantile{}
mi := &file_io_metric_client_metrics_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Quantile) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Quantile) ProtoMessage() {}
func (x *Quantile) ProtoReflect() protoreflect.Message {
mi := &file_io_metric_client_metrics_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Quantile.ProtoReflect.Descriptor instead.
func (*Quantile) Descriptor() ([]byte, []int) {
return file_io_metric_client_metrics_proto_rawDescGZIP(), []int{3}
}
func (x *Quantile) GetQuantile() float64 {
if x != nil && x.Quantile != nil {
return *x.Quantile
}
return 0
}
func (x *Quantile) GetValue() float64 {
if x != nil && x.Value != nil {
return *x.Value
}
return 0
}
type Summary struct {
state protoimpl.MessageState `protogen:"open.v1"`
SampleCount *uint64 `protobuf:"varint,1,opt,name=sample_count,json=sampleCount" json:"sample_count,omitempty"`
SampleSum *float64 `protobuf:"fixed64,2,opt,name=sample_sum,json=sampleSum" json:"sample_sum,omitempty"`
Quantile []*Quantile `protobuf:"bytes,3,rep,name=quantile" json:"quantile,omitempty"`
CreatedTimestamp *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=created_timestamp,json=createdTimestamp" json:"created_timestamp,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Summary) Reset() {
*x = Summary{}
mi := &file_io_metric_client_metrics_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Summary) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Summary) ProtoMessage() {}
func (x *Summary) ProtoReflect() protoreflect.Message {
mi := &file_io_metric_client_metrics_proto_msgTypes[4]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Summary.ProtoReflect.Descriptor instead.
func (*Summary) Descriptor() ([]byte, []int) {
return file_io_metric_client_metrics_proto_rawDescGZIP(), []int{4}
}
func (x *Summary) GetSampleCount() uint64 {
if x != nil && x.SampleCount != nil {
return *x.SampleCount
}
return 0
}
func (x *Summary) GetSampleSum() float64 {
if x != nil && x.SampleSum != nil {
return *x.SampleSum
}
return 0
}
func (x *Summary) GetQuantile() []*Quantile {
if x != nil {
return x.Quantile
}
return nil
}
func (x *Summary) GetCreatedTimestamp() *timestamppb.Timestamp {
if x != nil {
return x.CreatedTimestamp
}
return nil
}
type Untyped struct {
state protoimpl.MessageState `protogen:"open.v1"`
Value *float64 `protobuf:"fixed64,1,opt,name=value" json:"value,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Untyped) Reset() {
*x = Untyped{}
mi := &file_io_metric_client_metrics_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Untyped) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Untyped) ProtoMessage() {}
func (x *Untyped) ProtoReflect() protoreflect.Message {
mi := &file_io_metric_client_metrics_proto_msgTypes[5]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Untyped.ProtoReflect.Descriptor instead.
func (*Untyped) Descriptor() ([]byte, []int) {
return file_io_metric_client_metrics_proto_rawDescGZIP(), []int{5}
}
func (x *Untyped) GetValue() float64 {
if x != nil && x.Value != nil {
return *x.Value
}
return 0
}
type Histogram struct {
state protoimpl.MessageState `protogen:"open.v1"`
SampleCount *uint64 `protobuf:"varint,1,opt,name=sample_count,json=sampleCount" json:"sample_count,omitempty"`
SampleCountFloat *float64 `protobuf:"fixed64,4,opt,name=sample_count_float,json=sampleCountFloat" json:"sample_count_float,omitempty"` // Overrides sample_count if > 0.
SampleSum *float64 `protobuf:"fixed64,2,opt,name=sample_sum,json=sampleSum" json:"sample_sum,omitempty"`
// Buckets for the conventional histogram.
Bucket []*Bucket `protobuf:"bytes,3,rep,name=bucket" json:"bucket,omitempty"` // Ordered in increasing order of upper_bound, +Inf bucket is optional.
CreatedTimestamp *timestamppb.Timestamp `protobuf:"bytes,15,opt,name=created_timestamp,json=createdTimestamp" json:"created_timestamp,omitempty"`
// schema defines the bucket schema. Currently, valid numbers are -4 <= n <= 8.
// They are all for base-2 bucket schemas, where 1 is a bucket boundary in each case, and
// then each power of two is divided into 2^n logarithmic buckets.
// Or in other words, each bucket boundary is the previous boundary times 2^(2^-n).
// In the future, more bucket schemas may be added using numbers < -4 or > 8.
Schema *int32 `protobuf:"zigzag32,5,opt,name=schema" json:"schema,omitempty"`
ZeroThreshold *float64 `protobuf:"fixed64,6,opt,name=zero_threshold,json=zeroThreshold" json:"zero_threshold,omitempty"` // Breadth of the zero bucket.
ZeroCount *uint64 `protobuf:"varint,7,opt,name=zero_count,json=zeroCount" json:"zero_count,omitempty"` // Count in zero bucket.
ZeroCountFloat *float64 `protobuf:"fixed64,8,opt,name=zero_count_float,json=zeroCountFloat" json:"zero_count_float,omitempty"` // Overrides sb_zero_count if > 0.
// Negative buckets for the native histogram.
NegativeSpan []*BucketSpan `protobuf:"bytes,9,rep,name=negative_span,json=negativeSpan" json:"negative_span,omitempty"`
// Use either "negative_delta" or "negative_count", the former for
// regular histograms with integer counts, the latter for float
// histograms.
NegativeDelta []int64 `protobuf:"zigzag64,10,rep,name=negative_delta,json=negativeDelta" json:"negative_delta,omitempty"` // Count delta of each bucket compared to previous one (or to zero for 1st bucket).
NegativeCount []float64 `protobuf:"fixed64,11,rep,name=negative_count,json=negativeCount" json:"negative_count,omitempty"` // Absolute count of each bucket.
// Positive buckets for the native histogram.
// Use a no-op span (offset 0, length 0) for a native histogram without any
// observations yet and with a zero_threshold of 0. Otherwise, it would be
// indistinguishable from a classic histogram.
PositiveSpan []*BucketSpan `protobuf:"bytes,12,rep,name=positive_span,json=positiveSpan" json:"positive_span,omitempty"`
// Use either "positive_delta" or "positive_count", the former for
// regular histograms with integer counts, the latter for float
// histograms.
PositiveDelta []int64 `protobuf:"zigzag64,13,rep,name=positive_delta,json=positiveDelta" json:"positive_delta,omitempty"` // Count delta of each bucket compared to previous one (or to zero for 1st bucket).
PositiveCount []float64 `protobuf:"fixed64,14,rep,name=positive_count,json=positiveCount" json:"positive_count,omitempty"` // Absolute count of each bucket.
// Only used for native histograms. These exemplars MUST have a timestamp.
Exemplars []*Exemplar `protobuf:"bytes,16,rep,name=exemplars" json:"exemplars,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Histogram) Reset() {
*x = Histogram{}
mi := &file_io_metric_client_metrics_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Histogram) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Histogram) ProtoMessage() {}
func (x *Histogram) ProtoReflect() protoreflect.Message {
mi := &file_io_metric_client_metrics_proto_msgTypes[6]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Histogram.ProtoReflect.Descriptor instead.
func (*Histogram) Descriptor() ([]byte, []int) {
return file_io_metric_client_metrics_proto_rawDescGZIP(), []int{6}
}
func (x *Histogram) GetSampleCount() uint64 {
if x != nil && x.SampleCount != nil {
return *x.SampleCount
}
return 0
}
func (x *Histogram) GetSampleCountFloat() float64 {
if x != nil && x.SampleCountFloat != nil {
return *x.SampleCountFloat
}
return 0
}
func (x *Histogram) GetSampleSum() float64 {
if x != nil && x.SampleSum != nil {
return *x.SampleSum
}
return 0
}
func (x *Histogram) GetBucket() []*Bucket {
if x != nil {
return x.Bucket
}
return nil
}
func (x *Histogram) GetCreatedTimestamp() *timestamppb.Timestamp {
if x != nil {
return x.CreatedTimestamp
}
return nil
}
func (x *Histogram) GetSchema() int32 {
if x != nil && x.Schema != nil {
return *x.Schema
}
return 0
}
func (x *Histogram) GetZeroThreshold() float64 {
if x != nil && x.ZeroThreshold != nil {
return *x.ZeroThreshold
}
return 0
}
func (x *Histogram) GetZeroCount() uint64 {
if x != nil && x.ZeroCount != nil {
return *x.ZeroCount
}
return 0
}
func (x *Histogram) GetZeroCountFloat() float64 {
if x != nil && x.ZeroCountFloat != nil {
return *x.ZeroCountFloat
}
return 0
}
func (x *Histogram) GetNegativeSpan() []*BucketSpan {
if x != nil {
return x.NegativeSpan
}
return nil
}
func (x *Histogram) GetNegativeDelta() []int64 {
if x != nil {
return x.NegativeDelta
}
return nil
}
func (x *Histogram) GetNegativeCount() []float64 {
if x != nil {
return x.NegativeCount
}
return nil
}
func (x *Histogram) GetPositiveSpan() []*BucketSpan {
if x != nil {
return x.PositiveSpan
}
return nil
}
func (x *Histogram) GetPositiveDelta() []int64 {
if x != nil {
return x.PositiveDelta
}
return nil
}
func (x *Histogram) GetPositiveCount() []float64 {
if x != nil {
return x.PositiveCount
}
return nil
}
func (x *Histogram) GetExemplars() []*Exemplar {
if x != nil {
return x.Exemplars
}
return nil
}
// A Bucket of a conventional histogram, each of which is treated as
// an individual counter-like time series by Prometheus.
type Bucket struct {
state protoimpl.MessageState `protogen:"open.v1"`
CumulativeCount *uint64 `protobuf:"varint,1,opt,name=cumulative_count,json=cumulativeCount" json:"cumulative_count,omitempty"` // Cumulative in increasing order.
CumulativeCountFloat *float64 `protobuf:"fixed64,4,opt,name=cumulative_count_float,json=cumulativeCountFloat" json:"cumulative_count_float,omitempty"` // Overrides cumulative_count if > 0.
UpperBound *float64 `protobuf:"fixed64,2,opt,name=upper_bound,json=upperBound" json:"upper_bound,omitempty"` // Inclusive.
Exemplar *Exemplar `protobuf:"bytes,3,opt,name=exemplar" json:"exemplar,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Bucket) Reset() {
*x = Bucket{}
mi := &file_io_metric_client_metrics_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Bucket) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Bucket) ProtoMessage() {}
func (x *Bucket) ProtoReflect() protoreflect.Message {
mi := &file_io_metric_client_metrics_proto_msgTypes[7]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Bucket.ProtoReflect.Descriptor instead.
func (*Bucket) Descriptor() ([]byte, []int) {
return file_io_metric_client_metrics_proto_rawDescGZIP(), []int{7}
}
func (x *Bucket) GetCumulativeCount() uint64 {
if x != nil && x.CumulativeCount != nil {
return *x.CumulativeCount
}
return 0
}
func (x *Bucket) GetCumulativeCountFloat() float64 {
if x != nil && x.CumulativeCountFloat != nil {
return *x.CumulativeCountFloat
}
return 0
}
func (x *Bucket) GetUpperBound() float64 {
if x != nil && x.UpperBound != nil {
return *x.UpperBound
}
return 0
}
func (x *Bucket) GetExemplar() *Exemplar {
if x != nil {
return x.Exemplar
}
return nil
}
// A BucketSpan defines a number of consecutive buckets in a native
// histogram with their offset. Logically, it would be more
// straightforward to include the bucket counts in the Span. However,
// the protobuf representation is more compact in the way the data is
// structured here (with all the buckets in a single array separate
// from the Spans).
type BucketSpan struct {
state protoimpl.MessageState `protogen:"open.v1"`
Offset *int32 `protobuf:"zigzag32,1,opt,name=offset" json:"offset,omitempty"` // Gap to previous span, or starting point for 1st span (which can be negative).
Length *uint32 `protobuf:"varint,2,opt,name=length" json:"length,omitempty"` // Length of consecutive buckets.
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *BucketSpan) Reset() {
*x = BucketSpan{}
mi := &file_io_metric_client_metrics_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *BucketSpan) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*BucketSpan) ProtoMessage() {}
func (x *BucketSpan) ProtoReflect() protoreflect.Message {
mi := &file_io_metric_client_metrics_proto_msgTypes[8]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use BucketSpan.ProtoReflect.Descriptor instead.
func (*BucketSpan) Descriptor() ([]byte, []int) {
return file_io_metric_client_metrics_proto_rawDescGZIP(), []int{8}
}
func (x *BucketSpan) GetOffset() int32 {
if x != nil && x.Offset != nil {
return *x.Offset
}
return 0
}
func (x *BucketSpan) GetLength() uint32 {
if x != nil && x.Length != nil {
return *x.Length
}
return 0
}
type Exemplar struct {
state protoimpl.MessageState `protogen:"open.v1"`
Label []*LabelPair `protobuf:"bytes,1,rep,name=label" json:"label,omitempty"`
Value *float64 `protobuf:"fixed64,2,opt,name=value" json:"value,omitempty"`
Timestamp *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=timestamp" json:"timestamp,omitempty"` // OpenMetrics-style.
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Exemplar) Reset() {
*x = Exemplar{}
mi := &file_io_metric_client_metrics_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Exemplar) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Exemplar) ProtoMessage() {}
func (x *Exemplar) ProtoReflect() protoreflect.Message {
mi := &file_io_metric_client_metrics_proto_msgTypes[9]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Exemplar.ProtoReflect.Descriptor instead.
func (*Exemplar) Descriptor() ([]byte, []int) {
return file_io_metric_client_metrics_proto_rawDescGZIP(), []int{9}
}
func (x *Exemplar) GetLabel() []*LabelPair {
if x != nil {
return x.Label
}
return nil
}
func (x *Exemplar) GetValue() float64 {
if x != nil && x.Value != nil {
return *x.Value
}
return 0
}
func (x *Exemplar) GetTimestamp() *timestamppb.Timestamp {
if x != nil {
return x.Timestamp
}
return nil
}
type Metric struct {
state protoimpl.MessageState `protogen:"open.v1"`
Label []*LabelPair `protobuf:"bytes,1,rep,name=label" json:"label,omitempty"`
Gauge *Gauge `protobuf:"bytes,2,opt,name=gauge" json:"gauge,omitempty"`
Counter *Counter `protobuf:"bytes,3,opt,name=counter" json:"counter,omitempty"`
Summary *Summary `protobuf:"bytes,4,opt,name=summary" json:"summary,omitempty"`
Untyped *Untyped `protobuf:"bytes,5,opt,name=untyped" json:"untyped,omitempty"`
Histogram *Histogram `protobuf:"bytes,7,opt,name=histogram" json:"histogram,omitempty"`
TimestampMs *int64 `protobuf:"varint,6,opt,name=timestamp_ms,json=timestampMs" json:"timestamp_ms,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Metric) Reset() {
*x = Metric{}
mi := &file_io_metric_client_metrics_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Metric) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Metric) ProtoMessage() {}
func (x *Metric) ProtoReflect() protoreflect.Message {
mi := &file_io_metric_client_metrics_proto_msgTypes[10]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Metric.ProtoReflect.Descriptor instead.
func (*Metric) Descriptor() ([]byte, []int) {
return file_io_metric_client_metrics_proto_rawDescGZIP(), []int{10}
}
func (x *Metric) GetLabel() []*LabelPair {
if x != nil {
return x.Label
}
return nil
}
func (x *Metric) GetGauge() *Gauge {
if x != nil {
return x.Gauge
}
return nil
}
func (x *Metric) GetCounter() *Counter {
if x != nil {
return x.Counter
}
return nil
}
func (x *Metric) GetSummary() *Summary {
if x != nil {
return x.Summary
}
return nil
}
func (x *Metric) GetUntyped() *Untyped {
if x != nil {
return x.Untyped
}
return nil
}
func (x *Metric) GetHistogram() *Histogram {
if x != nil {
return x.Histogram
}
return nil
}
func (x *Metric) GetTimestampMs() int64 {
if x != nil && x.TimestampMs != nil {
return *x.TimestampMs
}
return 0
}
type MetricFamily struct {
state protoimpl.MessageState `protogen:"open.v1"`
Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
Help *string `protobuf:"bytes,2,opt,name=help" json:"help,omitempty"`
Type *MetricType `protobuf:"varint,3,opt,name=type,enum=io.metric.client.MetricType" json:"type,omitempty"`
Metric []*Metric `protobuf:"bytes,4,rep,name=metric" json:"metric,omitempty"`
Unit *string `protobuf:"bytes,5,opt,name=unit" json:"unit,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *MetricFamily) Reset() {
*x = MetricFamily{}
mi := &file_io_metric_client_metrics_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *MetricFamily) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MetricFamily) ProtoMessage() {}
func (x *MetricFamily) ProtoReflect() protoreflect.Message {
mi := &file_io_metric_client_metrics_proto_msgTypes[11]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use MetricFamily.ProtoReflect.Descriptor instead.
func (*MetricFamily) Descriptor() ([]byte, []int) {
return file_io_metric_client_metrics_proto_rawDescGZIP(), []int{11}
}
func (x *MetricFamily) GetName() string {
if x != nil && x.Name != nil {
return *x.Name
}
return ""
}
func (x *MetricFamily) GetHelp() string {
if x != nil && x.Help != nil {
return *x.Help
}
return ""
}
func (x *MetricFamily) GetType() MetricType {
if x != nil && x.Type != nil {
return *x.Type
}
return MetricType_COUNTER
}
func (x *MetricFamily) GetMetric() []*Metric {
if x != nil {
return x.Metric
}
return nil
}
func (x *MetricFamily) GetUnit() string {
if x != nil && x.Unit != nil {
return *x.Unit
}
return ""
}
var File_io_metric_client_metrics_proto protoreflect.FileDescriptor
const file_io_metric_client_metrics_proto_rawDesc = "" +
"\n" +
"\x1eio/metric/client/metrics.proto\x12\x10io.metric.client\x1a\x1fgoogle/protobuf/timestamp.proto\"5\n" +
"\tLabelPair\x12\x12\n" +
"\x04name\x18\x01 \x01(\tR\x04name\x12\x14\n" +
"\x05value\x18\x02 \x01(\tR\x05value\"\x1d\n" +
"\x05Gauge\x12\x14\n" +
"\x05value\x18\x01 \x01(\x01R\x05value\"\xa0\x01\n" +
"\aCounter\x12\x14\n" +
"\x05value\x18\x01 \x01(\x01R\x05value\x126\n" +
"\bexemplar\x18\x02 \x01(\v2\x1a.io.metric.client.ExemplarR\bexemplar\x12G\n" +
"\x11created_timestamp\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampR\x10createdTimestamp\"<\n" +
"\bQuantile\x12\x1a\n" +
"\bquantile\x18\x01 \x01(\x01R\bquantile\x12\x14\n" +
"\x05value\x18\x02 \x01(\x01R\x05value\"\xcc\x01\n" +
"\aSummary\x12!\n" +
"\fsample_count\x18\x01 \x01(\x04R\vsampleCount\x12\x1d\n" +
"\n" +
"sample_sum\x18\x02 \x01(\x01R\tsampleSum\x126\n" +
"\bquantile\x18\x03 \x03(\v2\x1a.io.metric.client.QuantileR\bquantile\x12G\n" +
"\x11created_timestamp\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampR\x10createdTimestamp\"\x1f\n" +
"\aUntyped\x12\x14\n" +
"\x05value\x18\x01 \x01(\x01R\x05value\"\xda\x05\n" +
"\tHistogram\x12!\n" +
"\fsample_count\x18\x01 \x01(\x04R\vsampleCount\x12,\n" +
"\x12sample_count_float\x18\x04 \x01(\x01R\x10sampleCountFloat\x12\x1d\n" +
"\n" +
"sample_sum\x18\x02 \x01(\x01R\tsampleSum\x120\n" +
"\x06bucket\x18\x03 \x03(\v2\x18.io.metric.client.BucketR\x06bucket\x12G\n" +
"\x11created_timestamp\x18\x0f \x01(\v2\x1a.google.protobuf.TimestampR\x10createdTimestamp\x12\x16\n" +
"\x06schema\x18\x05 \x01(\x11R\x06schema\x12%\n" +
"\x0ezero_threshold\x18\x06 \x01(\x01R\rzeroThreshold\x12\x1d\n" +
"\n" +
"zero_count\x18\a \x01(\x04R\tzeroCount\x12(\n" +
"\x10zero_count_float\x18\b \x01(\x01R\x0ezeroCountFloat\x12A\n" +
"\rnegative_span\x18\t \x03(\v2\x1c.io.metric.client.BucketSpanR\fnegativeSpan\x12%\n" +
"\x0enegative_delta\x18\n" +
" \x03(\x12R\rnegativeDelta\x12%\n" +
"\x0enegative_count\x18\v \x03(\x01R\rnegativeCount\x12A\n" +
"\rpositive_span\x18\f \x03(\v2\x1c.io.metric.client.BucketSpanR\fpositiveSpan\x12%\n" +
"\x0epositive_delta\x18\r \x03(\x12R\rpositiveDelta\x12%\n" +
"\x0epositive_count\x18\x0e \x03(\x01R\rpositiveCount\x128\n" +
"\texemplars\x18\x10 \x03(\v2\x1a.io.metric.client.ExemplarR\texemplars\"\xc2\x01\n" +
"\x06Bucket\x12)\n" +
"\x10cumulative_count\x18\x01 \x01(\x04R\x0fcumulativeCount\x124\n" +
"\x16cumulative_count_float\x18\x04 \x01(\x01R\x14cumulativeCountFloat\x12\x1f\n" +
"\vupper_bound\x18\x02 \x01(\x01R\n" +
"upperBound\x126\n" +
"\bexemplar\x18\x03 \x01(\v2\x1a.io.metric.client.ExemplarR\bexemplar\"<\n" +
"\n" +
"BucketSpan\x12\x16\n" +
"\x06offset\x18\x01 \x01(\x11R\x06offset\x12\x16\n" +
"\x06length\x18\x02 \x01(\rR\x06length\"\x8d\x01\n" +
"\bExemplar\x121\n" +
"\x05label\x18\x01 \x03(\v2\x1b.io.metric.client.LabelPairR\x05label\x12\x14\n" +
"\x05value\x18\x02 \x01(\x01R\x05value\x128\n" +
"\ttimestamp\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampR\ttimestamp\"\xe7\x02\n" +
"\x06Metric\x121\n" +
"\x05label\x18\x01 \x03(\v2\x1b.io.metric.client.LabelPairR\x05label\x12-\n" +
"\x05gauge\x18\x02 \x01(\v2\x17.io.metric.client.GaugeR\x05gauge\x123\n" +
"\acounter\x18\x03 \x01(\v2\x19.io.metric.client.CounterR\acounter\x123\n" +
"\asummary\x18\x04 \x01(\v2\x19.io.metric.client.SummaryR\asummary\x123\n" +
"\auntyped\x18\x05 \x01(\v2\x19.io.metric.client.UntypedR\auntyped\x129\n" +
"\thistogram\x18\a \x01(\v2\x1b.io.metric.client.HistogramR\thistogram\x12!\n" +
"\ftimestamp_ms\x18\x06 \x01(\x03R\vtimestampMs\"\xae\x01\n" +
"\fMetricFamily\x12\x12\n" +
"\x04name\x18\x01 \x01(\tR\x04name\x12\x12\n" +
"\x04help\x18\x02 \x01(\tR\x04help\x120\n" +
"\x04type\x18\x03 \x01(\x0e2\x1c.io.metric.client.MetricTypeR\x04type\x120\n" +
"\x06metric\x18\x04 \x03(\v2\x18.io.metric.client.MetricR\x06metric\x12\x12\n" +
"\x04unit\x18\x05 \x01(\tR\x04unit*b\n" +
"\n" +
"MetricType\x12\v\n" +
"\aCOUNTER\x10\x00\x12\t\n" +
"\x05GAUGE\x10\x01\x12\v\n" +
"\aSUMMARY\x10\x02\x12\v\n" +
"\aUNTYPED\x10\x03\x12\r\n" +
"\tHISTOGRAM\x10\x04\x12\x13\n" +
"\x0fGAUGE_HISTOGRAM\x10\x05BC\n" +
"\x10io.metric.clientZ/github.com/luxfi/metric/client;io_metric_client"
var (
file_io_metric_client_metrics_proto_rawDescOnce sync.Once
file_io_metric_client_metrics_proto_rawDescData []byte
)
func file_io_metric_client_metrics_proto_rawDescGZIP() []byte {
file_io_metric_client_metrics_proto_rawDescOnce.Do(func() {
file_io_metric_client_metrics_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_io_metric_client_metrics_proto_rawDesc), len(file_io_metric_client_metrics_proto_rawDesc)))
})
return file_io_metric_client_metrics_proto_rawDescData
}
var file_io_metric_client_metrics_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_io_metric_client_metrics_proto_msgTypes = make([]protoimpl.MessageInfo, 12)
var file_io_metric_client_metrics_proto_goTypes = []any{
(MetricType)(0), // 0: io.metric.client.MetricType
(*LabelPair)(nil), // 1: io.metric.client.LabelPair
(*Gauge)(nil), // 2: io.metric.client.Gauge
(*Counter)(nil), // 3: io.metric.client.Counter
(*Quantile)(nil), // 4: io.metric.client.Quantile
(*Summary)(nil), // 5: io.metric.client.Summary
(*Untyped)(nil), // 6: io.metric.client.Untyped
(*Histogram)(nil), // 7: io.metric.client.Histogram
(*Bucket)(nil), // 8: io.metric.client.Bucket
(*BucketSpan)(nil), // 9: io.metric.client.BucketSpan
(*Exemplar)(nil), // 10: io.metric.client.Exemplar
(*Metric)(nil), // 11: io.metric.client.Metric
(*MetricFamily)(nil), // 12: io.metric.client.MetricFamily
(*timestamppb.Timestamp)(nil), // 13: google.protobuf.Timestamp
}
var file_io_metric_client_metrics_proto_depIdxs = []int32{
10, // 0: io.metric.client.Counter.exemplar:type_name -> io.metric.client.Exemplar
13, // 1: io.metric.client.Counter.created_timestamp:type_name -> google.protobuf.Timestamp
4, // 2: io.metric.client.Summary.quantile:type_name -> io.metric.client.Quantile
13, // 3: io.metric.client.Summary.created_timestamp:type_name -> google.protobuf.Timestamp
8, // 4: io.metric.client.Histogram.bucket:type_name -> io.metric.client.Bucket
13, // 5: io.metric.client.Histogram.created_timestamp:type_name -> google.protobuf.Timestamp
9, // 6: io.metric.client.Histogram.negative_span:type_name -> io.metric.client.BucketSpan
9, // 7: io.metric.client.Histogram.positive_span:type_name -> io.metric.client.BucketSpan
10, // 8: io.metric.client.Histogram.exemplars:type_name -> io.metric.client.Exemplar
10, // 9: io.metric.client.Bucket.exemplar:type_name -> io.metric.client.Exemplar
1, // 10: io.metric.client.Exemplar.label:type_name -> io.metric.client.LabelPair
13, // 11: io.metric.client.Exemplar.timestamp:type_name -> google.protobuf.Timestamp
1, // 12: io.metric.client.Metric.label:type_name -> io.metric.client.LabelPair
2, // 13: io.metric.client.Metric.gauge:type_name -> io.metric.client.Gauge
3, // 14: io.metric.client.Metric.counter:type_name -> io.metric.client.Counter
5, // 15: io.metric.client.Metric.summary:type_name -> io.metric.client.Summary
6, // 16: io.metric.client.Metric.untyped:type_name -> io.metric.client.Untyped
7, // 17: io.metric.client.Metric.histogram:type_name -> io.metric.client.Histogram
0, // 18: io.metric.client.MetricFamily.type:type_name -> io.metric.client.MetricType
11, // 19: io.metric.client.MetricFamily.metric:type_name -> io.metric.client.Metric
20, // [20:20] is the sub-list for method output_type
20, // [20:20] is the sub-list for method input_type
20, // [20:20] is the sub-list for extension type_name
20, // [20:20] is the sub-list for extension extendee
0, // [0:20] is the sub-list for field type_name
}
func init() { file_io_metric_client_metrics_proto_init() }
func file_io_metric_client_metrics_proto_init() {
if File_io_metric_client_metrics_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_io_metric_client_metrics_proto_rawDesc), len(file_io_metric_client_metrics_proto_rawDesc)),
NumEnums: 1,
NumMessages: 12,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_io_metric_client_metrics_proto_goTypes,
DependencyIndexes: file_io_metric_client_metrics_proto_depIdxs,
EnumInfos: file_io_metric_client_metrics_proto_enumTypes,
MessageInfos: file_io_metric_client_metrics_proto_msgTypes,
}.Build()
File_io_metric_client_metrics_proto = out.File
file_io_metric_client_metrics_proto_goTypes = nil
file_io_metric_client_metrics_proto_depIdxs = nil
}