prometheusutils

package
v0.296.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMetricValueFromMetricPage

func GetMetricValueFromMetricPage(ctx context.Context, url string, metricName string) (value float64, err error)

func MustGetMetricValueFromMetricPage

func MustGetMetricValueFromMetricPage(ctx context.Context, url string, metricName string) (value float64)

Types

type PrometheusExpositionFormatParserService

type PrometheusExpositionFormatParserService struct{}

func NewPrometheusExpositionFormatParserService

func NewPrometheusExpositionFormatParserService() (p *PrometheusExpositionFormatParserService)

func PrometheusExpositionFormatParser

func PrometheusExpositionFormatParser() (p *PrometheusExpositionFormatParserService)

Can be used to parse Prometheus exposition format as documented here:

func (*PrometheusExpositionFormatParserService) MustParseString

func (p *PrometheusExpositionFormatParserService) MustParseString(toParse string) (parsed *PrometheusParsedMetrics)

func (*PrometheusExpositionFormatParserService) ParseString

func (p *PrometheusExpositionFormatParserService) ParseString(toParse string) (parsed *PrometheusParsedMetrics, err error)

type PrometheusMetric

type PrometheusMetric struct {
	// contains filtered or unexported fields
}

func NewPrometheusMetric

func NewPrometheusMetric() (p *PrometheusMetric)

func (*PrometheusMetric) GetHelp

func (p *PrometheusMetric) GetHelp() (help string, err error)

func (*PrometheusMetric) GetName

func (p *PrometheusMetric) GetName() (name string, err error)

func (*PrometheusMetric) GetValue

func (p *PrometheusMetric) GetValue() (value float64, err error)

func (*PrometheusMetric) GetValueAsFloat64

func (p *PrometheusMetric) GetValueAsFloat64() (value float64, err error)

func (*PrometheusMetric) MustGetHelp

func (p *PrometheusMetric) MustGetHelp() (help string)

func (*PrometheusMetric) MustGetName

func (p *PrometheusMetric) MustGetName() (name string)

func (*PrometheusMetric) MustGetValue

func (p *PrometheusMetric) MustGetValue() (value float64)

func (*PrometheusMetric) MustGetValueAsFloat64

func (p *PrometheusMetric) MustGetValueAsFloat64() (value float64)

func (*PrometheusMetric) MustSetHelp

func (p *PrometheusMetric) MustSetHelp(help string)

func (*PrometheusMetric) MustSetName

func (p *PrometheusMetric) MustSetName(name string)

func (*PrometheusMetric) MustSetValue

func (p *PrometheusMetric) MustSetValue(value float64)

func (*PrometheusMetric) MustSetValueByFloat64

func (p *PrometheusMetric) MustSetValueByFloat64(value float64)

func (*PrometheusMetric) SetHelp

func (p *PrometheusMetric) SetHelp(help string) (err error)

func (*PrometheusMetric) SetName

func (p *PrometheusMetric) SetName(name string) (err error)

func (*PrometheusMetric) SetValue

func (p *PrometheusMetric) SetValue(value float64) (err error)

func (*PrometheusMetric) SetValueByFloat64

func (p *PrometheusMetric) SetValueByFloat64(value float64) (err error)

type PrometheusMetricFamily

type PrometheusMetricFamily struct {
	// contains filtered or unexported fields
}

func GetPrometheusMetricFamilyFromNativeMetricFamily

func GetPrometheusMetricFamilyFromNativeMetricFamily(metricFamily *dto.MetricFamily) (p *PrometheusMetricFamily, err error)

func MustGetPrometheusMetricFamilyFromNativeMetricFamily

func MustGetPrometheusMetricFamilyFromNativeMetricFamily(metricFamily *dto.MetricFamily) (p *PrometheusMetricFamily)

func NewPrometheusMetricFamily

func NewPrometheusMetricFamily() (p *PrometheusMetricFamily)

func (*PrometheusMetricFamily) AddMetric

func (p *PrometheusMetricFamily) AddMetric(toAdd *PrometheusMetric) (err error)

func (*PrometheusMetricFamily) GetHelp

func (p *PrometheusMetricFamily) GetHelp() (help string, err error)

func (*PrometheusMetricFamily) GetMetrics

func (p *PrometheusMetricFamily) GetMetrics() (metrics []*PrometheusMetric, err error)

func (*PrometheusMetricFamily) GetName

func (p *PrometheusMetricFamily) GetName() (name string, err error)

func (*PrometheusMetricFamily) GetValueAsFloat64

func (p *PrometheusMetricFamily) GetValueAsFloat64() (value float64, err error)

func (*PrometheusMetricFamily) MustAddMetric

func (p *PrometheusMetricFamily) MustAddMetric(toAdd *PrometheusMetric)

func (*PrometheusMetricFamily) MustGetHelp

func (p *PrometheusMetricFamily) MustGetHelp() (help string)

func (*PrometheusMetricFamily) MustGetMetrics

func (p *PrometheusMetricFamily) MustGetMetrics() (metrics []*PrometheusMetric)

func (*PrometheusMetricFamily) MustGetName

func (p *PrometheusMetricFamily) MustGetName() (name string)

func (*PrometheusMetricFamily) MustGetValueAsFloat64

func (p *PrometheusMetricFamily) MustGetValueAsFloat64() (value float64)

func (*PrometheusMetricFamily) MustSetHelp

func (p *PrometheusMetricFamily) MustSetHelp(help string)

func (*PrometheusMetricFamily) MustSetMetrics

func (p *PrometheusMetricFamily) MustSetMetrics(metrics []*PrometheusMetric)

func (*PrometheusMetricFamily) MustSetName

func (p *PrometheusMetricFamily) MustSetName(name string)

func (*PrometheusMetricFamily) SetHelp

func (p *PrometheusMetricFamily) SetHelp(help string) (err error)

func (*PrometheusMetricFamily) SetMetrics

func (p *PrometheusMetricFamily) SetMetrics(metrics []*PrometheusMetric) (err error)

func (*PrometheusMetricFamily) SetName

func (p *PrometheusMetricFamily) SetName(name string) (err error)

type PrometheusParsedMetrics

type PrometheusParsedMetrics struct {
	// contains filtered or unexported fields
}

func GetParsedMetricPage

func GetParsedMetricPage(ctx context.Context, url string) (metrics *PrometheusParsedMetrics, err error)

Use a get request to retrieve the exposed metrics from the given url. Then the already parsed PrometheusParsedMetrics are returned.

func NewPrometheusParsedMetrics

func NewPrometheusParsedMetrics() (p *PrometheusParsedMetrics)

func (*PrometheusParsedMetrics) GetMetricValueAsFloat64

func (p *PrometheusParsedMetrics) GetMetricValueAsFloat64(metricName string) (metricValue float64, err error)

Get the value of the metric 'metricName' as float64. If the metric is not unique (e.g. a Vector with more than one value) this function will return an error.

func (*PrometheusParsedMetrics) GetNativeMetricFamilies

func (p *PrometheusParsedMetrics) GetNativeMetricFamilies() (nativeMetricFamilies map[string]*dto.MetricFamily, err error)

func (*PrometheusParsedMetrics) MustGetMetricValueAsFloat64

func (p *PrometheusParsedMetrics) MustGetMetricValueAsFloat64(metricName string) (metricValue float64)

func (*PrometheusParsedMetrics) MustGetNativeMetricFamilies

func (p *PrometheusParsedMetrics) MustGetNativeMetricFamilies() (nativeMetricFamilies map[string]*dto.MetricFamily)

func (*PrometheusParsedMetrics) MustSetNativeMetricFamilies

func (p *PrometheusParsedMetrics) MustSetNativeMetricFamilies(nativeMetricFamilies map[string]*dto.MetricFamily)

func (*PrometheusParsedMetrics) SetNativeMetricFamilies

func (p *PrometheusParsedMetrics) SetNativeMetricFamilies(nativeMetricFamilies map[string]*dto.MetricFamily) (err error)

Jump to

Keyboard shortcuts

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