Documentation ¶
Overview ¶
Package metrics is a generated protocol buffer package.
It is generated from these files:
model.proto
It has these top-level messages:
LabelPair Metadata MetricFamily MetricData CounterData CounterRateData GaugeData HistogramData Bucket Percentile
Index ¶
- Variables
- func ExportedLabel(name string) string
- func ExportedName(name string) string
- type Bucket
- func (*Bucket) Descriptor() ([]byte, []int)
- func (m *Bucket) Marshal() (dAtA []byte, err error)
- func (m *Bucket) MarshalTo(dAtA []byte) (int, error)
- func (*Bucket) ProtoMessage()
- func (m *Bucket) Reset()
- func (m *Bucket) Size() (n int)
- func (m *Bucket) String() string
- func (m *Bucket) Unmarshal(dAtA []byte) error
- type CounterData
- func (*CounterData) Descriptor() ([]byte, []int)
- func (m *CounterData) Marshal() (dAtA []byte, err error)
- func (m *CounterData) MarshalTo(dAtA []byte) (int, error)
- func (*CounterData) ProtoMessage()
- func (m *CounterData) Reset()
- func (m *CounterData) Size() (n int)
- func (m *CounterData) String() string
- func (m *CounterData) Unmarshal(dAtA []byte) error
- type CounterRateData
- func (*CounterRateData) Descriptor() ([]byte, []int)
- func (m *CounterRateData) Marshal() (dAtA []byte, err error)
- func (m *CounterRateData) MarshalTo(dAtA []byte) (int, error)
- func (*CounterRateData) ProtoMessage()
- func (m *CounterRateData) Reset()
- func (m *CounterRateData) Size() (n int)
- func (m *CounterRateData) String() string
- func (m *CounterRateData) Unmarshal(dAtA []byte) error
- type ExportTimer
- type Exporter
- type GaugeData
- func (*GaugeData) Descriptor() ([]byte, []int)
- func (m *GaugeData) Marshal() (dAtA []byte, err error)
- func (m *GaugeData) MarshalTo(dAtA []byte) (int, error)
- func (*GaugeData) ProtoMessage()
- func (m *GaugeData) Reset()
- func (m *GaugeData) Size() (n int)
- func (m *GaugeData) String() string
- func (m *GaugeData) Unmarshal(dAtA []byte) error
- type HistogramData
- func (*HistogramData) Descriptor() ([]byte, []int)
- func (m *HistogramData) Marshal() (dAtA []byte, err error)
- func (m *HistogramData) MarshalTo(dAtA []byte) (int, error)
- func (*HistogramData) ProtoMessage()
- func (m *HistogramData) Reset()
- func (m *HistogramData) Size() (n int)
- func (m *HistogramData) String() string
- func (m *HistogramData) Unmarshal(dAtA []byte) error
- type LabelPair
- func (*LabelPair) Descriptor() ([]byte, []int)
- func (m *LabelPair) Marshal() (dAtA []byte, err error)
- func (m *LabelPair) MarshalTo(dAtA []byte) (int, error)
- func (*LabelPair) ProtoMessage()
- func (m *LabelPair) Reset()
- func (m *LabelPair) Size() (n int)
- func (m *LabelPair) String() string
- func (m *LabelPair) Unmarshal(dAtA []byte) error
- type Metadata
- func (m *Metadata) AddLabel(name, value string)
- func (*Metadata) Descriptor() ([]byte, []int)
- func (m *Metadata) Marshal() (dAtA []byte, err error)
- func (m *Metadata) MarshalTo(dAtA []byte) (int, error)
- func (*Metadata) ProtoMessage()
- func (m *Metadata) Reset()
- func (m *Metadata) Size() (n int)
- func (m *Metadata) String() string
- func (m *Metadata) Unmarshal(dAtA []byte) error
- type Metric
- type MetricData
- func (*MetricData) Descriptor() ([]byte, []int)
- func (m *MetricData) Marshal() (dAtA []byte, err error)
- func (m *MetricData) MarshalTo(dAtA []byte) (int, error)
- func (*MetricData) ProtoMessage()
- func (m *MetricData) Reset()
- func (m *MetricData) Size() (n int)
- func (m *MetricData) String() string
- func (m *MetricData) Unmarshal(dAtA []byte) error
- type MetricFamily
- func (*MetricFamily) Descriptor() ([]byte, []int)
- func (m *MetricFamily) Marshal() (dAtA []byte, err error)
- func (m *MetricFamily) MarshalTo(dAtA []byte) (int, error)
- func (*MetricFamily) ProtoMessage()
- func (m *MetricFamily) Reset()
- func (m *MetricFamily) Size() (n int)
- func (m *MetricFamily) String() string
- func (m *MetricFamily) Unmarshal(dAtA []byte) error
- type MetricFamilySlice
- type MetricStruct
- type MetricType
- type Percentile
- func (*Percentile) Descriptor() ([]byte, []int)
- func (m *Percentile) Marshal() (dAtA []byte, err error)
- func (m *Percentile) MarshalTo(dAtA []byte) (int, error)
- func (*Percentile) ProtoMessage()
- func (m *Percentile) Reset()
- func (m *Percentile) Size() (n int)
- func (m *Percentile) String() string
- func (m *Percentile) Unmarshal(dAtA []byte) error
- type Registry
- func (r *Registry) AddLabel(name, value string)
- func (r *Registry) AddMetric(metric ...Metric)
- func (r *Registry) AddMetricStruct(metricStruct interface{})
- func (r *Registry) Each(f func(name string, val Metric))
- func (r *Registry) FindMetric(name string) (m Metric)
- func (r *Registry) GetLabels() (labels []LabelPair)
- func (r *Registry) MarshalJSON() ([]byte, error)
- type Unit
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidLengthModel = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowModel = fmt.Errorf("proto: integer overflow") )
var MetricType_name = map[int32]string{
0: "UNTYPED",
1: "COUNTER",
2: "COUNTERRATE",
3: "GAUGE",
4: "HISTOGRAM",
}
var MetricType_value = map[string]int32{
"UNTYPED": 0,
"COUNTER": 1,
"COUNTERRATE": 2,
"GAUGE": 3,
"HISTOGRAM": 4,
}
var Unit_name = map[int32]string{
0: "UNSET",
1: "BYTES",
2: "CONST",
3: "COUNT",
4: "NANOSECONDS",
5: "PERCENT",
6: "SECONDS",
}
var Unit_value = map[string]int32{
"UNSET": 0,
"BYTES": 1,
"CONST": 2,
"COUNT": 3,
"NANOSECONDS": 4,
"PERCENT": 5,
"SECONDS": 6,
}
Functions ¶
func ExportedLabel ¶
ExportedLabel generates a valid metric label.
func ExportedName ¶
ExportedName generates a valid metric name.
Types ¶
type Bucket ¶
type Bucket struct { CumulativeCount uint64 `protobuf:"varint,1,opt,name=cumulative_count,json=cumulativeCount,proto3" json:"cumulative_count,omitempty"` UpperBound float64 `protobuf:"fixed64,2,opt,name=upper_bound,json=upperBound,proto3" json:"upper_bound,omitempty"` }
func (*Bucket) Descriptor ¶
func (*Bucket) ProtoMessage ¶
func (*Bucket) ProtoMessage()
type CounterData ¶
type CounterData struct {
Value float64 `protobuf:"fixed64,1,opt,name=value,proto3" json:"value,omitempty"`
}
func (*CounterData) Descriptor ¶
func (*CounterData) Descriptor() ([]byte, []int)
func (*CounterData) Marshal ¶
func (m *CounterData) Marshal() (dAtA []byte, err error)
func (*CounterData) ProtoMessage ¶
func (*CounterData) ProtoMessage()
func (*CounterData) Reset ¶
func (m *CounterData) Reset()
func (*CounterData) Size ¶
func (m *CounterData) Size() (n int)
func (*CounterData) String ¶
func (m *CounterData) String() string
func (*CounterData) Unmarshal ¶
func (m *CounterData) Unmarshal(dAtA []byte) error
type CounterRateData ¶
type CounterRateData struct { TotalValue float64 `protobuf:"fixed64,1,opt,name=total_value,json=totalValue,proto3" json:"total_value,omitempty"` WindowValue float64 `protobuf:"fixed64,2,opt,name=window_value,json=windowValue,proto3" json:"window_value,omitempty"` AvgValue float64 `protobuf:"fixed64,3,opt,name=avg_value,json=avgValue,proto3" json:"avg_value,omitempty"` }
func (*CounterRateData) Descriptor ¶
func (*CounterRateData) Descriptor() ([]byte, []int)
func (*CounterRateData) Marshal ¶
func (m *CounterRateData) Marshal() (dAtA []byte, err error)
func (*CounterRateData) ProtoMessage ¶
func (*CounterRateData) ProtoMessage()
func (*CounterRateData) Reset ¶
func (m *CounterRateData) Reset()
func (*CounterRateData) Size ¶
func (m *CounterRateData) Size() (n int)
func (*CounterRateData) String ¶
func (m *CounterRateData) String() string
func (*CounterRateData) Unmarshal ¶
func (m *CounterRateData) Unmarshal(dAtA []byte) error
type ExportTimer ¶
func NewExportTimer ¶
func NewExportTimer(ctx context.Context, interval time.Duration) *ExportTimer
func (*ExportTimer) AddExporter ¶
func (t *ExportTimer) AddExporter(exporter ...Exporter)
func (*ExportTimer) AddRegistry ¶
func (t *ExportTimer) AddRegistry(registry ...*Registry)
func (*ExportTimer) Start ¶
func (t *ExportTimer) Start() error
type Exporter ¶
type Exporter interface { DumpRegistry([]*Registry) GetMetric() map[string]*MetricFamily PrintText(io.Writer) error }
Exporter export metrics in Registry.
type GaugeData ¶
type GaugeData struct {
Value float64 `protobuf:"fixed64,1,opt,name=value,proto3" json:"value,omitempty"`
}
func (*GaugeData) Descriptor ¶
func (*GaugeData) ProtoMessage ¶
func (*GaugeData) ProtoMessage()
type HistogramData ¶
type HistogramData struct { SampleCount uint64 `protobuf:"varint,1,opt,name=sample_count,json=sampleCount,proto3" json:"sample_count,omitempty"` SampleSum float64 `protobuf:"fixed64,2,opt,name=sample_sum,json=sampleSum,proto3" json:"sample_sum,omitempty"` Buckets []Bucket `protobuf:"bytes,3,rep,name=buckets" json:"buckets"` Pts []Percentile `protobuf:"bytes,4,rep,name=pts" json:"pts"` }
func (*HistogramData) Descriptor ¶
func (*HistogramData) Descriptor() ([]byte, []int)
func (*HistogramData) Marshal ¶
func (m *HistogramData) Marshal() (dAtA []byte, err error)
func (*HistogramData) ProtoMessage ¶
func (*HistogramData) ProtoMessage()
func (*HistogramData) Reset ¶
func (m *HistogramData) Reset()
func (*HistogramData) Size ¶
func (m *HistogramData) Size() (n int)
func (*HistogramData) String ¶
func (m *HistogramData) String() string
func (*HistogramData) Unmarshal ¶
func (m *HistogramData) Unmarshal(dAtA []byte) error
type LabelPair ¶
type LabelPair struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` }
func (*LabelPair) Descriptor ¶
func (*LabelPair) ProtoMessage ¶
func (*LabelPair) ProtoMessage()
type Metadata ¶
type Metadata struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Help string `protobuf:"bytes,2,opt,name=help,proto3" json:"help,omitempty"` Unit Unit `protobuf:"varint,3,opt,name=unit,proto3,enum=Unit" json:"unit,omitempty"` Labels []LabelPair `protobuf:"bytes,4,rep,name=labels" json:"labels"` }
Metadata holds metadata about a metric.
func (*Metadata) Descriptor ¶
func (*Metadata) ProtoMessage ¶
func (*Metadata) ProtoMessage()
type Metric ¶
type Metric interface { // GetMetadata returns the metric's metadata. GetMetadata() Metadata // GetType returns the type enum for this metric. GetType() MetricType // Inspect calls the given closure with each contained item. Inspect(func(Metric)) // ExportMetric returns a filled-in metric data of the right type for the given metric. ExportMetric() *MetricData }
Metric provides a method for metric objects.
type MetricData ¶
type MetricData struct { Counter *CounterData `protobuf:"bytes,1,opt,name=counter" json:"counter,omitempty"` CounterRate *CounterRateData `protobuf:"bytes,2,opt,name=counter_rate,json=counterRate" json:"counter_rate,omitempty"` Gauge *GaugeData `protobuf:"bytes,3,opt,name=gauge" json:"gauge,omitempty"` Histogram *HistogramData `protobuf:"bytes,4,opt,name=histogram" json:"histogram,omitempty"` Labels []LabelPair `protobuf:"bytes,5,rep,name=labels" json:"labels"` Unit Unit `protobuf:"varint,6,opt,name=unit,proto3,enum=Unit" json:"unit,omitempty"` TimestampNs int64 `protobuf:"varint,7,opt,name=TimestampNs,proto3" json:"TimestampNs,omitempty"` }
MetricData holds exported data of metrics
func (*MetricData) Descriptor ¶
func (*MetricData) Descriptor() ([]byte, []int)
func (*MetricData) Marshal ¶
func (m *MetricData) Marshal() (dAtA []byte, err error)
func (*MetricData) ProtoMessage ¶
func (*MetricData) ProtoMessage()
func (*MetricData) Reset ¶
func (m *MetricData) Reset()
func (*MetricData) Size ¶
func (m *MetricData) Size() (n int)
func (*MetricData) String ¶
func (m *MetricData) String() string
func (*MetricData) Unmarshal ¶
func (m *MetricData) Unmarshal(dAtA []byte) error
type MetricFamily ¶
type MetricFamily struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Help string `protobuf:"bytes,2,opt,name=help,proto3" json:"help,omitempty"` Type MetricType `protobuf:"varint,3,opt,name=type,proto3,enum=MetricType" json:"type,omitempty"` Metrics []MetricData `protobuf:"bytes,4,rep,name=metrics" json:"metrics"` }
MetricFamily contains a list of metrics with the same name (a metric with multiple labels).
func (*MetricFamily) Descriptor ¶
func (*MetricFamily) Descriptor() ([]byte, []int)
func (*MetricFamily) Marshal ¶
func (m *MetricFamily) Marshal() (dAtA []byte, err error)
func (*MetricFamily) ProtoMessage ¶
func (*MetricFamily) ProtoMessage()
func (*MetricFamily) Reset ¶
func (m *MetricFamily) Reset()
func (*MetricFamily) Size ¶
func (m *MetricFamily) Size() (n int)
func (*MetricFamily) String ¶
func (m *MetricFamily) String() string
func (*MetricFamily) Unmarshal ¶
func (m *MetricFamily) Unmarshal(dAtA []byte) error
type MetricFamilySlice ¶
type MetricFamilySlice []*MetricFamily
func (MetricFamilySlice) Len ¶
func (s MetricFamilySlice) Len() int
func (MetricFamilySlice) Swap ¶
func (s MetricFamilySlice) Swap(i int, j int)
type MetricStruct ¶
type MetricStruct interface {
MetricStruct()
}
MetricStruct can be implemented by the types of members of a metric container, so that the members get automatically registered.
type MetricType ¶
type MetricType int32
MetricType describes the type of metric.
const ( // UNSET expresses that the metric's type wasn't explicitly set. MetricType_UNTYPED MetricType = 0 MetricType_COUNTER MetricType = 1 MetricType_COUNTERRATE MetricType = 2 MetricType_GAUGE MetricType = 3 MetricType_HISTOGRAM MetricType = 4 )
func (MetricType) EnumDescriptor ¶
func (MetricType) EnumDescriptor() ([]byte, []int)
func (MetricType) String ¶
func (x MetricType) String() string
type Percentile ¶
type Percentile struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Unit float64 `protobuf:"fixed64,2,opt,name=unit,proto3" json:"unit,omitempty"` Value float64 `protobuf:"fixed64,3,opt,name=value,proto3" json:"value,omitempty"` }
func (*Percentile) Descriptor ¶
func (*Percentile) Descriptor() ([]byte, []int)
func (*Percentile) Marshal ¶
func (m *Percentile) Marshal() (dAtA []byte, err error)
func (*Percentile) ProtoMessage ¶
func (*Percentile) ProtoMessage()
func (*Percentile) Reset ¶
func (m *Percentile) Reset()
func (*Percentile) Size ¶
func (m *Percentile) Size() (n int)
func (*Percentile) String ¶
func (m *Percentile) String() string
func (*Percentile) Unmarshal ¶
func (m *Percentile) Unmarshal(dAtA []byte) error
type Registry ¶
Registry is a list of metrics. It provides a simple way of iterating over them. A registry can have label pairs that will be applied to all its metrics when exported.
func (*Registry) AddMetricStruct ¶
func (r *Registry) AddMetricStruct(metricStruct interface{})
AddMetricStruct adds all Metric or MetricStruct fields to the registry.
func (*Registry) FindMetric ¶
FindMetric looking for metric based on name.
func (*Registry) MarshalJSON ¶
MarshalJSON marshals to JSON.
type Unit ¶
type Unit int32
Unit describes how the metric's units should be displayed.
const ( // UNSET expresses that the metric's DisplayUnit wasn't explicitly set. Unit_UNSET Unit = 0 // BYTES expresses that the metric's measurement is in bytes. Unit_BYTES Unit = 1 // CONST expresses that the metric's measurement is a constant value. Unit_CONST Unit = 2 // COUNT expresses that the metric's measurement is a count. Unit_COUNT Unit = 3 // NANOSECONDS expresses that the metric's measurement is in nanoseconds. Unit_NANOSECONDS Unit = 4 // PERCENT expresses that the metric's measurement is a percentage value. Unit_PERCENT Unit = 5 // SECONDS expresses that the metric's measurement is in seconds. Unit_SECONDS Unit = 6 )