prometheus

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2021 License: MIT Imports: 0 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FormatMode added in v0.13.0

type FormatMode string

Format switches between Table, Time series, or Heatmap. Table will only work in the Table panel. Heatmap is suitable for displaying metrics of the Histogram type on a Heatmap panel. Under the hood, it converts cumulative histograms to regular ones and sorts series by the bucket bound.

const (
	FormatTable      FormatMode = "table"
	FormatHeatmap    FormatMode = "heatmap"
	FormatTimeSeries FormatMode = "time_series"
)

type Option

type Option func(target *Prometheus)

Option represents an option that can be used to configure a prometheus query.

func Format added in v0.13.0

func Format(format FormatMode) Option

Format indicates how the data should be returned.

func Hide added in v0.11.3

func Hide() Option

Hide the query. Grafana does not send hidden queries to the data source, but they can still be referenced in alerts.

func Instant added in v0.13.0

func Instant() Option

Instant marks the query as "instant, which means Prometheus will only return the latest scrapped value.

func IntervalFactor added in v0.13.0

func IntervalFactor(factor int) Option

IntervalFactor sets the resolution factor.

func Legend

func Legend(legend string) Option

Legend sets the legend format.

func Ref

func Ref(ref string) Option

Ref sets the reference ID for this query.

type Prometheus

type Prometheus struct {
	Ref            string
	Hidden         bool
	Expr           string
	IntervalFactor int
	Interval       string
	Step           int
	LegendFormat   string
	Instant        bool
	Format         string
}

Prometheus represents a prometheus query.

func New

func New(query string, options ...Option) *Prometheus

New creates a new prometheus query.

Jump to

Keyboard shortcuts

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