Documentation
¶
Overview ¶
Package v2 Copied from prometheus.
Index ¶
- Constants
- func FromFloatHistogram(timestamp int64, fh *histogram.FloatHistogram) prompb.Histogram
- func FromIntHistogram(timestamp int64, h *histogram.Histogram) prompb.Histogram
- func FromMetadataType(t model.MetricType) prompb.MetricMetadata_MetricType
- type Format
- func (s *Format) AddPrometheusMetadata(name string, unit string, help string, pType string) error
- func (s *Format) AddPrometheusMetric(ts int64, value float64, lbls labels.Labels, h *histogram.Histogram, ...) error
- func (s *Format) Marshal(handle func(map[string]string, []byte) error) error
- func (s *Format) Unmarshal(meta map[string]string, buf []byte) (items []types.Datum, err error)
- type Metadata
- func (m Metadata) Bytes() []byte
- func (m Metadata) FileFormat() types.FileFormat
- func (m Metadata) Free()
- func (m Metadata) IsMeta() bool
- func (metadata *Metadata) Marshal(b []byte)
- func (metadata *Metadata) MarshalPlain(tn int, b []byte) (n int)
- func (metadata *Metadata) NestedMarshal(tn int, b []byte, id uint16) (n int)
- func (metadata *Metadata) NestedSize(id uint16) (s int)
- func (metadata *Metadata) NestedUnmarshal(tn int, b []byte, r []uint16, id uint16) (n int, err error)
- func (metadata *Metadata) Size() int
- func (metadata *Metadata) SizePlain() (s int)
- func (m Metadata) Type() types.Type
- func (metadata *Metadata) Unmarshal(b []byte) (err error)
- func (metadata *Metadata) UnmarshalPlain(tn int, b []byte) (n int, err error)
- type Metric
- func (m Metric) Bytes() []byte
- func (m Metric) FileFormat() types.FileFormat
- func (m *Metric) Free()
- func (m Metric) Hash() uint64
- func (m Metric) IsHistogram() bool
- func (metric *Metric) Marshal(b []byte)
- func (metric *Metric) MarshalPlain(tn int, b []byte) (n int)
- func (metric *Metric) NestedMarshal(tn int, b []byte, id uint16) (n int)
- func (metric *Metric) NestedSize(id uint16) (s int)
- func (metric *Metric) NestedUnmarshal(tn int, b []byte, r []uint16, id uint16) (n int, err error)
- func (metric *Metric) Size() int
- func (metric *Metric) SizePlain() (s int)
- func (m Metric) TimeStampMS() int64
- func (m Metric) Type() types.Type
- func (metric *Metric) Unmarshal(b []byte) (err error)
- func (metric *Metric) UnmarshalPlain(tn int, b []byte) (n int, err error)
Constants ¶
const PrometheusExemplar = uint8(2)
const PrometheusMetadata = uint8(3)
const PrometheusMetric = uint8(1)
Variables ¶
This section is empty.
Functions ¶
func FromFloatHistogram ¶
func FromFloatHistogram(timestamp int64, fh *histogram.FloatHistogram) prompb.Histogram
FromFloatHistogram returns remote Histogram from the float Histogram.
func FromIntHistogram ¶
FromIntHistogram returns remote Histogram from the integer Histogram.
func FromMetadataType ¶
func FromMetadataType(t model.MetricType) prompb.MetricMetadata_MetricType
FromMetadataType transforms a Prometheus metricType into prompb metricType. Since the former is a string we need to transform it to an enum.
Types ¶
type Format ¶
type Format struct {
// contains filtered or unexported fields
}
Format describe the v2 data format.
func (*Format) AddPrometheusMetadata ¶
func (*Format) AddPrometheusMetric ¶
func (s *Format) AddPrometheusMetric(ts int64, value float64, lbls labels.Labels, h *histogram.Histogram, fh *histogram.FloatHistogram, e exemplar.Exemplar, externalLabels map[string]string) error
AddPrometheusMetric marshals a prometheus metric to its prombpb.TimeSeries representation and writes it to the buffer.
type Metadata ¶
type Metadata struct {
Buf []byte
}
Struct - metadata
func (Metadata) FileFormat ¶
func (m Metadata) FileFormat() types.FileFormat
func (*Metadata) MarshalPlain ¶
MarshalPlain - metadata
func (*Metadata) NestedMarshal ¶
Nested Marshal - metadata
func (*Metadata) NestedSize ¶
Nested Size - metadata
func (*Metadata) NestedUnmarshal ¶
func (metadata *Metadata) NestedUnmarshal(tn int, b []byte, r []uint16, id uint16) (n int, err error)
Nested Unmarshal - metadata
type Metric ¶
Struct - metric
func (Metric) Bytes ¶
Bytes represents the underlying data and should not be handled aside from Build* functions that understand the Type.
func (Metric) FileFormat ¶
func (m Metric) FileFormat() types.FileFormat
func (Metric) IsHistogram ¶
func (*Metric) MarshalPlain ¶
MarshalPlain - metric
func (*Metric) NestedMarshal ¶
Nested Marshal - metric
func (*Metric) NestedSize ¶
Nested Size - metric
func (*Metric) NestedUnmarshal ¶
Nested Unmarshal - metric