Documentation
¶
Index ¶
- func AnnotationToMetaLabels(lbls labels.Labels, annotation types.MetricAnnotations) labels.Labels
- func CollectorToFamilies(metrics []prometheus.Metric) ([]*dto.MetricFamily, error)
- func DTO2Labels(name string, input []*dto.LabelPair) map[string]string
- func DropMetaLabels(lbls labels.Labels) labels.Labels
- func DropMetaLabelsFromFamilies(families []*dto.MetricFamily)
- func FamiliesDeepCopy(families []*dto.MetricFamily) []*dto.MetricFamily
- func FamiliesToCollector(families []*dto.MetricFamily) ([]prometheus.Metric, error)
- func FamiliesToMetricPoints(defaultTS time.Time, families []*dto.MetricFamily, dropMetaLabels bool) []types.MetricPoint
- func FamiliesToNameAndItem(families []*dto.MetricFamily)
- func FamilyConvertType(mf *dto.MetricFamily, targetType dto.MetricType)
- func FixType(m *dto.Metric, wantType dto.MetricType)
- func Labels2DTO(lbls labels.Labels) []*dto.LabelPair
- func MetaLabelsToAnnotation(lbls labels.Labels) types.MetricAnnotations
- func MetricPointsToFamilies(points []types.MetricPoint) []*dto.MetricFamily
- func SamplesToMetricFamily(samples []promql.Sample, mType *dto.MetricType) (*dto.MetricFamily, error)
- func SendPointsToAppender(points []types.MetricPoint, app storage.Appender) error
- type AppenableOfAppender
- type BufferAppender
- func (a *BufferAppender) Append(_ storage.SeriesRef, l labels.Labels, t int64, v float64) (storage.SeriesRef, error)
- func (a *BufferAppender) AppendCTZeroSample(_ storage.SeriesRef, _ labels.Labels, _, _ int64) (storage.SeriesRef, error)
- func (a *BufferAppender) AppendExemplar(storage.SeriesRef, labels.Labels, exemplar.Exemplar) (storage.SeriesRef, error)
- func (a *BufferAppender) AppendHistogram(storage.SeriesRef, labels.Labels, int64, *histogram.Histogram, ...) (storage.SeriesRef, error)
- func (a *BufferAppender) AsMF() ([]*dto.MetricFamily, error)
- func (a *BufferAppender) Commit() error
- func (a *BufferAppender) CommitCopyAndReset(app storage.Appender) error
- func (a *BufferAppender) CopyTo(app storage.Appender) error
- func (a *BufferAppender) FixSampleTimestamp(ts time.Time)
- func (a *BufferAppender) Reset()
- func (a *BufferAppender) Rollback() error
- func (a *BufferAppender) UpdateMetadata(storage.SeriesRef, labels.Labels, metadata.Metadata) (storage.SeriesRef, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnnotationToMetaLabels ¶
AnnotationToMetaLabels convert annotation to meta-labels (labels starting with __) and append them to existing labels. It's valid to provide nil for initial labels.
func CollectorToFamilies ¶
func CollectorToFamilies(metrics []prometheus.Metric) ([]*dto.MetricFamily, error)
func DropMetaLabels ¶
DropMetaLabels delete all labels which start with __ (with exception to __name__). The input is modified.
func DropMetaLabelsFromFamilies ¶
func DropMetaLabelsFromFamilies(families []*dto.MetricFamily)
DropMetaLabelsFromFamilies delete all labels which start with __ (with exception to __name__). The input is modified.
func FamiliesDeepCopy ¶
func FamiliesDeepCopy(families []*dto.MetricFamily) []*dto.MetricFamily
func FamiliesToCollector ¶
func FamiliesToCollector(families []*dto.MetricFamily) ([]prometheus.Metric, error)
FamiliesToCollector convert metric family to prometheus.Metric. Note: meta-label are not kept in this conversion.
func FamiliesToMetricPoints ¶
func FamiliesToMetricPoints( defaultTS time.Time, families []*dto.MetricFamily, dropMetaLabels bool, ) []types.MetricPoint
func FamiliesToNameAndItem ¶
func FamiliesToNameAndItem(families []*dto.MetricFamily)
FamiliesToNameAndItem converts labels of each metrics to just name + item. It kept meta-label unchanged. The input is modified.
func FamilyConvertType ¶
func FamilyConvertType(mf *dto.MetricFamily, targetType dto.MetricType)
FamilyConvertType convert a MetricFamilty to another type. Some information may be lost in the process.
func FixType ¶
func FixType(m *dto.Metric, wantType dto.MetricType)
FixType changes the type of a metric. Some information may be lost in the process.
func MetaLabelsToAnnotation ¶
func MetaLabelsToAnnotation(lbls labels.Labels) types.MetricAnnotations
MetaLabelsToAnnotation extract from meta-labels some annotations. It mostly does the opposite of AnnotationToMetaLabels. Labels aren't modified.
func MetricPointsToFamilies ¶
func MetricPointsToFamilies(points []types.MetricPoint) []*dto.MetricFamily
func SamplesToMetricFamily ¶
func SamplesToMetricFamily(samples []promql.Sample, mType *dto.MetricType) (*dto.MetricFamily, error)
SamplesToMetricFamily convert a list of sample to a MetricFamilty of given type. The mType could be nil which will use the default of MetricType_UNTYPED. All samples must belong to the same family, that is have the same name.
func SendPointsToAppender ¶
func SendPointsToAppender(points []types.MetricPoint, app storage.Appender) error
SendPointsToAppender append all points to given appender. It will mutate points's labels to include some meta-labels known by Registry for some annotation. This method will not Commit or Rollback on the Appender.
Types ¶
type AppenableOfAppender ¶
type AppenableOfAppender struct {
// contains filtered or unexported fields
}
func NewFromAppender ¶
func NewFromAppender(app storage.Appender) *AppenableOfAppender
NewFromAppender create an Appenable from an appender. The result appenders created from this Appendable are thread-safe, but call to Commit() or Rollback() will affect all appenders.
type BufferAppender ¶
type BufferAppender struct {
// contains filtered or unexported fields
}
func NewBufferAppender ¶
func NewBufferAppender() *BufferAppender
NewBufferAppender return a new appender that store sample in-memory.
func (*BufferAppender) AppendCTZeroSample ¶
func (*BufferAppender) AppendExemplar ¶
func (*BufferAppender) AppendHistogram ¶
func (*BufferAppender) AsMF ¶
func (a *BufferAppender) AsMF() ([]*dto.MetricFamily, error)
func (*BufferAppender) Commit ¶
func (a *BufferAppender) Commit() error
func (*BufferAppender) CommitCopyAndReset ¶
func (a *BufferAppender) CommitCopyAndReset(app storage.Appender) error
CommitCopyAndReset calls Commit, CopyTo and Reset atomically.
func (*BufferAppender) CopyTo ¶
func (a *BufferAppender) CopyTo(app storage.Appender) error
CopyTo copy committed sample to given appender. It don't call Commit() on any Appender.
func (*BufferAppender) FixSampleTimestamp ¶
func (a *BufferAppender) FixSampleTimestamp(ts time.Time)
func (*BufferAppender) Reset ¶
func (a *BufferAppender) Reset()
func (*BufferAppender) Rollback ¶
func (a *BufferAppender) Rollback() error