Documentation
¶
Overview ¶
Package io_metric_client provides metric types for Prometheus-compatible metrics. This is the native Go implementation without protobuf dependency.
Index ¶
- Variables
- type Bucket
- type BucketSpan
- type Counter
- type Exemplar
- type Gauge
- type Histogram
- func (x *Histogram) GetBucket() []*Bucket
- func (x *Histogram) GetCreatedTimestamp() *Timestamp
- func (x *Histogram) GetExemplars() []*Exemplar
- func (x *Histogram) GetNegativeCount() []float64
- func (x *Histogram) GetNegativeDelta() []int64
- func (x *Histogram) GetNegativeSpan() []*BucketSpan
- func (x *Histogram) GetPositiveCount() []float64
- func (x *Histogram) GetPositiveDelta() []int64
- func (x *Histogram) GetPositiveSpan() []*BucketSpan
- func (x *Histogram) GetSampleCount() uint64
- func (x *Histogram) GetSampleCountFloat() float64
- func (x *Histogram) GetSampleSum() float64
- func (x *Histogram) GetSchema() int32
- func (x *Histogram) GetZeroCount() uint64
- func (x *Histogram) GetZeroCountFloat() float64
- func (x *Histogram) GetZeroThreshold() float64
- func (x *Histogram) Reset()
- func (x *Histogram) String() string
- type LabelPair
- type Metric
- func (x *Metric) GetCounter() *Counter
- func (x *Metric) GetGauge() *Gauge
- func (x *Metric) GetHistogram() *Histogram
- func (x *Metric) GetLabel() []*LabelPair
- func (x *Metric) GetSummary() *Summary
- func (x *Metric) GetTimestampMs() int64
- func (x *Metric) GetUntyped() *Untyped
- func (x *Metric) Reset()
- func (x *Metric) String() string
- type MetricFamily
- type MetricType
- type Quantile
- type Summary
- type Timestamp
- type Untyped
Constants ¶
This section is empty.
Variables ¶
var MetricType_name = map[int32]string{
0: "COUNTER",
1: "GAUGE",
2: "SUMMARY",
3: "UNTYPED",
4: "HISTOGRAM",
5: "GAUGE_HISTOGRAM",
}
MetricType_name maps enum values to names.
var MetricType_value = map[string]int32{
"COUNTER": 0,
"GAUGE": 1,
"SUMMARY": 2,
"UNTYPED": 3,
"HISTOGRAM": 4,
"GAUGE_HISTOGRAM": 5,
}
MetricType_value maps names to enum values.
Functions ¶
This section is empty.
Types ¶
type Bucket ¶
type Bucket struct {
CumulativeCount *uint64 `json:"cumulative_count,omitempty"`
CumulativeCountFloat *float64 `json:"cumulative_count_float,omitempty"`
UpperBound *float64 `json:"upper_bound,omitempty"`
Exemplar *Exemplar `json:"exemplar,omitempty"`
}
Bucket represents a histogram bucket.
func (*Bucket) GetCumulativeCount ¶
GetCumulativeCount returns the CumulativeCount field value or 0 if nil.
func (*Bucket) GetCumulativeCountFloat ¶
GetCumulativeCountFloat returns the CumulativeCountFloat field value or 0 if nil.
func (*Bucket) GetExemplar ¶
GetExemplar returns the Exemplar field value or nil if not set.
func (*Bucket) GetUpperBound ¶
GetUpperBound returns the UpperBound field value or 0 if nil.
type BucketSpan ¶
type BucketSpan struct {
Offset *int32 `json:"offset,omitempty"`
Length *uint32 `json:"length,omitempty"`
}
BucketSpan defines a number of consecutive buckets in a native histogram.
func (*BucketSpan) GetLength ¶
func (x *BucketSpan) GetLength() uint32
GetLength returns the Length field value or 0 if nil.
func (*BucketSpan) GetOffset ¶
func (x *BucketSpan) GetOffset() int32
GetOffset returns the Offset field value or 0 if nil.
func (*BucketSpan) Reset ¶
func (x *BucketSpan) Reset()
Reset resets the BucketSpan to its zero value.
func (*BucketSpan) String ¶
func (x *BucketSpan) String() string
String returns the JSON representation of the BucketSpan.
type Counter ¶
type Counter struct {
Value *float64 `json:"value,omitempty"`
Exemplar *Exemplar `json:"exemplar,omitempty"`
CreatedTimestamp *Timestamp `json:"created_timestamp,omitempty"`
}
Counter represents a counter metric value.
func (*Counter) GetCreatedTimestamp ¶
GetCreatedTimestamp returns the CreatedTimestamp field value or nil if not set.
func (*Counter) GetExemplar ¶
GetExemplar returns the Exemplar field value or nil if not set.
type Exemplar ¶
type Exemplar struct {
Label []*LabelPair `json:"label,omitempty"`
Value *float64 `json:"value,omitempty"`
Timestamp *Timestamp `json:"timestamp,omitempty"`
}
Exemplar represents an exemplar for a metric.
func (*Exemplar) GetTimestamp ¶
GetTimestamp returns the Timestamp field value or nil if not set.
type Gauge ¶
type Gauge struct {
Value *float64 `json:"value,omitempty"`
}
Gauge represents a gauge metric value.
type Histogram ¶
type Histogram struct {
SampleCount *uint64 `json:"sample_count,omitempty"`
SampleCountFloat *float64 `json:"sample_count_float,omitempty"`
SampleSum *float64 `json:"sample_sum,omitempty"`
Bucket []*Bucket `json:"bucket,omitempty"`
CreatedTimestamp *Timestamp `json:"created_timestamp,omitempty"`
Schema *int32 `json:"schema,omitempty"`
ZeroThreshold *float64 `json:"zero_threshold,omitempty"`
ZeroCount *uint64 `json:"zero_count,omitempty"`
ZeroCountFloat *float64 `json:"zero_count_float,omitempty"`
NegativeSpan []*BucketSpan `json:"negative_span,omitempty"`
NegativeDelta []int64 `json:"negative_delta,omitempty"`
NegativeCount []float64 `json:"negative_count,omitempty"`
PositiveSpan []*BucketSpan `json:"positive_span,omitempty"`
PositiveDelta []int64 `json:"positive_delta,omitempty"`
PositiveCount []float64 `json:"positive_count,omitempty"`
Exemplars []*Exemplar `json:"exemplars,omitempty"`
}
Histogram represents a histogram metric value.
func (*Histogram) GetCreatedTimestamp ¶
GetCreatedTimestamp returns the CreatedTimestamp field value or nil if not set.
func (*Histogram) GetExemplars ¶
GetExemplars returns the Exemplars field slice or nil if not set.
func (*Histogram) GetNegativeCount ¶
GetNegativeCount returns the NegativeCount field slice or nil if not set.
func (*Histogram) GetNegativeDelta ¶
GetNegativeDelta returns the NegativeDelta field slice or nil if not set.
func (*Histogram) GetNegativeSpan ¶
func (x *Histogram) GetNegativeSpan() []*BucketSpan
GetNegativeSpan returns the NegativeSpan field slice or nil if not set.
func (*Histogram) GetPositiveCount ¶
GetPositiveCount returns the PositiveCount field slice or nil if not set.
func (*Histogram) GetPositiveDelta ¶
GetPositiveDelta returns the PositiveDelta field slice or nil if not set.
func (*Histogram) GetPositiveSpan ¶
func (x *Histogram) GetPositiveSpan() []*BucketSpan
GetPositiveSpan returns the PositiveSpan field slice or nil if not set.
func (*Histogram) GetSampleCount ¶
GetSampleCount returns the SampleCount field value or 0 if nil.
func (*Histogram) GetSampleCountFloat ¶
GetSampleCountFloat returns the SampleCountFloat field value or 0 if nil.
func (*Histogram) GetSampleSum ¶
GetSampleSum returns the SampleSum field value or 0 if nil.
func (*Histogram) GetZeroCount ¶
GetZeroCount returns the ZeroCount field value or 0 if nil.
func (*Histogram) GetZeroCountFloat ¶
GetZeroCountFloat returns the ZeroCountFloat field value or 0 if nil.
func (*Histogram) GetZeroThreshold ¶
GetZeroThreshold returns the ZeroThreshold field value or 0 if nil.
type LabelPair ¶
type LabelPair struct {
Name *string `json:"name,omitempty"`
Value *string `json:"value,omitempty"`
}
LabelPair is a name-value pair for metric labels.
type Metric ¶
type Metric struct {
Label []*LabelPair `json:"label,omitempty"`
Gauge *Gauge `json:"gauge,omitempty"`
Counter *Counter `json:"counter,omitempty"`
Summary *Summary `json:"summary,omitempty"`
Untyped *Untyped `json:"untyped,omitempty"`
Histogram *Histogram `json:"histogram,omitempty"`
TimestampMs *int64 `json:"timestamp_ms,omitempty"`
}
Metric represents a single metric with its labels and values.
func (*Metric) GetCounter ¶
GetCounter returns the Counter field value or nil if not set.
func (*Metric) GetHistogram ¶
GetHistogram returns the Histogram field value or nil if not set.
func (*Metric) GetSummary ¶
GetSummary returns the Summary field value or nil if not set.
func (*Metric) GetTimestampMs ¶
GetTimestampMs returns the TimestampMs field value or 0 if nil.
func (*Metric) GetUntyped ¶
GetUntyped returns the Untyped field value or nil if not set.
type MetricFamily ¶
type MetricFamily struct {
Name *string `json:"name,omitempty"`
Help *string `json:"help,omitempty"`
Type *MetricType `json:"type,omitempty"`
Metric []*Metric `json:"metric,omitempty"`
Unit *string `json:"unit,omitempty"`
}
MetricFamily is a collection of metrics with the same name and type.
func (*MetricFamily) GetHelp ¶
func (x *MetricFamily) GetHelp() string
GetHelp returns the Help field value or empty string if nil.
func (*MetricFamily) GetMetric ¶
func (x *MetricFamily) GetMetric() []*Metric
GetMetric returns the Metric field slice or nil if not set.
func (*MetricFamily) GetName ¶
func (x *MetricFamily) GetName() string
GetName returns the Name field value or empty string if nil.
func (*MetricFamily) GetType ¶
func (x *MetricFamily) GetType() MetricType
GetType returns the Type field value or MetricType_COUNTER if nil.
func (*MetricFamily) GetUnit ¶
func (x *MetricFamily) GetUnit() string
GetUnit returns the Unit field value or empty string if nil.
func (*MetricFamily) Reset ¶
func (x *MetricFamily) Reset()
Reset resets the MetricFamily to its zero value.
func (*MetricFamily) String ¶
func (x *MetricFamily) String() string
String returns the JSON representation of the MetricFamily.
type MetricType ¶
type MetricType int32
MetricType defines the type of a metric.
const ( // MetricType_COUNTER must use the Metric field "counter". MetricType_COUNTER MetricType = 0 // MetricType_GAUGE must use the Metric field "gauge". MetricType_GAUGE MetricType = 1 // MetricType_SUMMARY must use the Metric field "summary". MetricType_SUMMARY MetricType = 2 // MetricType_UNTYPED must use the Metric field "untyped". MetricType_UNTYPED MetricType = 3 // MetricType_HISTOGRAM must use the Metric field "histogram". MetricType_HISTOGRAM MetricType = 4 // MetricType_GAUGE_HISTOGRAM must use the Metric field "histogram". MetricType_GAUGE_HISTOGRAM MetricType = 5 )
func (MetricType) Enum ¶
func (x MetricType) Enum() *MetricType
Enum returns a pointer to the MetricType.
func (MetricType) String ¶
func (x MetricType) String() string
String returns the string representation of the MetricType.
type Quantile ¶
type Quantile struct {
Quantile *float64 `json:"quantile,omitempty"`
Value *float64 `json:"value,omitempty"`
}
Quantile represents a quantile value in a summary.
func (*Quantile) GetQuantile ¶
GetQuantile returns the Quantile field value or 0 if nil.
type Summary ¶
type Summary struct {
SampleCount *uint64 `json:"sample_count,omitempty"`
SampleSum *float64 `json:"sample_sum,omitempty"`
Quantile []*Quantile `json:"quantile,omitempty"`
CreatedTimestamp *Timestamp `json:"created_timestamp,omitempty"`
}
Summary represents a summary metric value.
func (*Summary) GetCreatedTimestamp ¶
GetCreatedTimestamp returns the CreatedTimestamp field value or nil if not set.
func (*Summary) GetQuantile ¶
GetQuantile returns the Quantile field slice or nil if not set.
func (*Summary) GetSampleCount ¶
GetSampleCount returns the SampleCount field value or 0 if nil.
func (*Summary) GetSampleSum ¶
GetSampleSum returns the SampleSum field value or 0 if nil.
type Timestamp ¶ added in v1.5.0
type Timestamp struct {
Seconds int64 `json:"seconds,omitempty"`
Nanos int32 `json:"nanos,omitempty"`
}
Timestamp represents a point in time.
func NewTimestamp ¶ added in v1.5.0
NewTimestamp creates a Timestamp from a time.Time.