prometheus

package
v0.0.0-...-7d8b796 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AreIdenticalSeriesFast

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

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 ParseStream

func ParseStream(r io.Reader, defaultTimestamp int64, isGzipped bool, callback func(rows []Row) error, errLogger func(string)) error

ParseStream parses lines with Prometheus exposition format from r and calls callback for the parsed rows.

The callback can be called concurrently multiple times for streamed data from r.

callback shouldn't hold rows after returning.

Types

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) Unmarshal

func (rs *Rows) Unmarshal(s string)

Unmarshal unmarshals Prometheus exposition text rows from s.

See https://github.com/prometheus/docs/blob/master/content/docs/instrumenting/exposition_formats.md#text-format-details

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

func (*Rows) UnmarshalWithErrLogger

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

UnmarshalWithErrLogger unmarshal Prometheus exposition text rows from s.

It calls errLogger for logging parsing errors.

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

type Tag

type Tag struct {
	Key   string
	Value string
}

Tag is a Prometheus tag.

Jump to

Keyboard shortcuts

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