prometheus

package
v1.129.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2025 License: Apache-2.0 Imports: 9 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AreIdenticalSeriesFast added in v1.66.0

func AreIdenticalSeriesFast(s1, s2 string) bool

AreIdenticalSeriesFast returns true if s1 and s2 contains identical Prometheus series with possible different values.

This function is optimized for speed.

func GetRowsDiff added in v1.66.0

func GetRowsDiff(s1, s2 string) string

GetRowsDiff returns rows from s1, which are missing in s2.

The returned rows have default value 0 and have no timestamps.

func MustParsePromMetrics added in v1.102.15

func MustParsePromMetrics(s string, offsetMsecs int64) []prompb.TimeSeries

MustParsePromMetrics parses metrics in Prometheus text exposition format from s and returns them.

Metrics must be delimited with newlines.

offsetMsecs is added to every timestamp in parsed metrics.

This function is for testing purposes only. Do not use it in non-test code.

func UnmarshalWithMetadata added in v1.110.16

func UnmarshalWithMetadata(dstRows Rows, dstMeta MetadataRows, s string, errLogger func(s string)) (Rows, MetadataRows)

UnmarshalWithMetadata unmarshals Prometheus exposition text into dstRows and dstMeta. See https://github.com/prometheus/docs/blob/e39897e4ee6e67d49d47204a34d120e3314e82f9/docs/instrumenting/exposition_formats.md#comments-help-text-and-type-information.

s shouldn't be modified while dstRows and dstMeta are in use.

Types

type Metadata added in v1.110.16

type Metadata struct {
	Metric string
	Type   uint32
	Help   string
}

Metadata contains HELP or TYPE message in prometheus exposition format. See https://github.com/prometheus/docs/blob/e39897e4ee6e67d49d47204a34d120e3314e82f9/docs/instrumenting/exposition_formats.md#comments-help-text-and-type-information.

For example: # HELP alertmanager_alerts How many alerts by state. # TYPE alertmanager_alerts gauge

type MetadataRows added in v1.110.16

type MetadataRows struct {
	Rows []Metadata
}

MetadataRows contains parsed Prometheus metadata rows.

func (*MetadataRows) Reset added in v1.110.16

func (ms *MetadataRows) Reset()

Reset resets ms.

type Row

type Row struct {
	Metric    string
	Tags      []Tag
	Value     float64
	Timestamp int64
}

Row is a single Prometheus row.

type Rows

type Rows struct {
	Rows []Row
	// contains filtered or unexported fields
}

Rows contains parsed Prometheus rows.

func (*Rows) Reset

func (rs *Rows) Reset()

Reset resets rs.

func (*Rows) UnmarshalWithErrLogger added in v1.34.0

func (rs *Rows) UnmarshalWithErrLogger(s string, errLogger func(s string))

UnmarshalWithErrLogger unmarshals only samples from Prometheus exposition text.

See https://github.com/prometheus/docs/blob/e39897e4ee6e67d49d47204a34d120e3314e82f9/docs/instrumenting/exposition_formats.md#line-format

s shouldn't be modified while rs is in use.

type Tag

type Tag struct {
	Key   string
	Value string
}

Tag is a Prometheus tag.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL