Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LabelsToString ¶ added in v1.110.15
LabelsToString converts labels to Prometheus-compatible string
func MetricMetadataTypeToString ¶ added in v1.110.24
MetricMetadataTypeToString maps given uint32 value to the human read-able string
Types ¶
type MetricMetadata ¶ added in v1.102.25
type MetricMetadata struct {
// Represents the metric type, these match the set from Prometheus.
// Refer to https://github.com/prometheus/common/blob/95acce133ca2c07a966a71d475fb936fc282db18/model/metadata.go for details.
Type uint32
MetricFamilyName string
Help string
Unit string
// Additional fields to allow storing and querying metadata in multitenancy.
AccountID uint32
ProjectID uint32
}
MetricMetadata represents additional meta information for specific MetricFamilyName Refer to https://github.com/prometheus/prometheus/blob/c5282933765ec322a0664d0a0268f8276e83b156/prompb/types.proto#L21
func ResetMetadata ¶ added in v1.110.15
func ResetMetadata(mms []MetricMetadata) []MetricMetadata
ResetMetadata clears all the GC references from mms and returns an empty mms ready for further use.
type MetricMetadataType ¶ added in v1.110.16
type MetricMetadataType int32
MetricMetadataType represents the Prometheus type of a metric. https://github.com/prometheus/prometheus/blob/c5282933765ec322a0664d0a0268f8276e83b156/prompb/types.pb.go#L28C1-L39C2 https://github.com/prometheus/OpenMetrics/blob/v1.0.0/specification/OpenMetrics.md#metric-types
const ( // MetricMetadataUNKNOWN represents a Prometheus Unknown-typed metric MetricMetadataUNKNOWN MetricMetadataType = 0 // MetricMetadataCOUNTER represents a Prometheus Counter MetricMetadataCOUNTER MetricMetadataType = 1 // MetricMetadataGAUGE represents a Prometheus Gauge MetricMetadataGAUGE MetricMetadataType = 2 // MetricMetadataHISTOGRAM represents a Prometheus Histogram MetricMetadataHISTOGRAM MetricMetadataType = 3 // MetricMetadataGAUGEHISTOGRAM represents a Prometheus GaugeHistogram MetricMetadataGAUGEHISTOGRAM MetricMetadataType = 4 // MetricMetadataSUMMARY represents a Prometheus Summary MetricMetadataSUMMARY MetricMetadataType = 5 // MetricMetadataINFO represents a Prometheus Info metric MetricMetadataINFO MetricMetadataType = 6 // MetricMetadataSTATESET represents a Prometheus StateSet metric MetricMetadataSTATESET MetricMetadataType = 7 )
type Sample ¶
type Sample struct {
// Value is sample value.
Value float64
// Timestamp is unix timestamp for the sample in milliseconds.
Timestamp int64
}
Sample is a timeseries sample.
type TimeSeries ¶
type TimeSeries struct {
// Labels is a list of labels for the given TimeSeries
Labels []Label
// Samples is a list of samples for the given TimeSeries
Samples []Sample
}
TimeSeries is a timeseries.
func ResetTimeSeries ¶ added in v1.110.15
func ResetTimeSeries(tss []TimeSeries) []TimeSeries
ResetTimeSeries clears all the GC references from tss and returns an empty tss ready for further use.
type WriteRequest ¶
type WriteRequest struct {
// Timeseries is a list of time series in the given WriteRequest
Timeseries []TimeSeries
// Metadata is a list of metadata info in the given WriteRequest
Metadata []MetricMetadata
}
WriteRequest represents Prometheus remote write API request.
func (*WriteRequest) IsEmpty ¶ added in v1.110.16
func (m *WriteRequest) IsEmpty() bool
IsEmpty checks if the WriteRequest has data to push.
func (*WriteRequest) MarshalProtobuf ¶ added in v1.110.15
func (wr *WriteRequest) MarshalProtobuf(dst []byte) []byte
MarshalProtobuf marshals wr to dst and returns the result.
type WriteRequestUnmarshaler ¶ added in v1.110.16
type WriteRequestUnmarshaler struct {
// contains filtered or unexported fields
}
WriteRequestUnmarshaler is reusable unmarshaler for WriteRequest protobuf messages. It maintains internal pools for labels and samples to reduce memory allocations. See UnmarshalProtobuf for details on how to use it.
func (*WriteRequestUnmarshaler) Reset ¶ added in v1.110.16
func (wru *WriteRequestUnmarshaler) Reset()
func (*WriteRequestUnmarshaler) UnmarshalProtobuf ¶ added in v1.110.16
func (wru *WriteRequestUnmarshaler) UnmarshalProtobuf(src []byte) (*WriteRequest, error)
UnmarshalProtobuf parses the given Protobuf-encoded `src` into an internal WriteRequest instance and returns a pointer to it. This method avoids allocations by reusing preallocated slices and pools.
Notes:
- The `src` slice must remain unchanged for the lifetime of the returned WriteRequest, as the WriteRequest retain references to it.
- The returned WriteRequest is only valid until the next call to UnmarshalProtobuf, which reuses internal buffers and structs.