prometheus

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2021 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Overview

Copyright 2020 The micro-boot Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetDefaultCounterConstLabels

func SetDefaultCounterConstLabels(labels map[string]string)

func SetDefaultCounterLabelNames

func SetDefaultCounterLabelNames(labels []string)

func SetDefaultGaugeConstLabels

func SetDefaultGaugeConstLabels(labels map[string]string)

func SetDefaultGaugeLabelNames

func SetDefaultGaugeLabelNames(labels []string)

func SetDefaultHandlerDisableCompression

func SetDefaultHandlerDisableCompression(n bool)

func SetDefaultHandlerErrorHandling

func SetDefaultHandlerErrorHandling(n promhttp.HandlerErrorHandling)

func SetDefaultHandlerMaxRequestsInFlight

func SetDefaultHandlerMaxRequestsInFlight(n int)

func SetDefaultHandlerTimeout

func SetDefaultHandlerTimeout(d time.Duration)

func SetDefaultHistogramBuckets

func SetDefaultHistogramBuckets(buckets []float64)

func SetDefaultHistogramConstLabels

func SetDefaultHistogramConstLabels(labels map[string]string)

func SetDefaultHistogramLabelNames

func SetDefaultHistogramLabelNames(labels []string)

func SetDefaultOptionsConstLabels

func SetDefaultOptionsConstLabels(labels map[string]string)

func SetDefaultOptionsLabelNames

func SetDefaultOptionsLabelNames(labels []string)

func SetDefaultPrometheusFlagsPrefix

func SetDefaultPrometheusFlagsPrefix(val string)

func SetDefaultPrometheusPath

func SetDefaultPrometheusPath(val string)

func SetDefaultSummaryAgeBuckets

func SetDefaultSummaryAgeBuckets(num uint32)

func SetDefaultSummaryBufCap

func SetDefaultSummaryBufCap(num uint32)

func SetDefaultSummaryConstLabels

func SetDefaultSummaryConstLabels(labels map[string]string)

func SetDefaultSummaryLabelNames

func SetDefaultSummaryLabelNames(labels []string)

func SetDefaultSummaryMaxAge

func SetDefaultSummaryMaxAge(d time.Duration)

func SetDefaultSummaryObjectives

func SetDefaultSummaryObjectives(objectives map[float64]float64)

Types

type Config

type Config struct {
	Path           string         `json:"path" yaml:"path"`
	HandlerOptions HandlerOptions `json:"handler-options" yaml:"handler-options"`

	CounterOptions   map[string]CounterOptions   `json:"counter-options" yaml:"counter-options"`
	GaugeOptions     map[string]GaugeOptions     `json:"gauge-options" yaml:"gauge-options"`
	SummaryOptions   map[string]SummaryOptions   `json:"summary-options" yaml:"summary-options"`
	HistogramOptions map[string]HistogramOptions `json:"histogram-options" yaml:"histogram-options"`

	// CustomBindFlagsFunc defines custom bind flags behaviour for structure, if CustomBindFlagsFunc is nil, default  bind flags behaviour will be used
	CustomBindFlagsFunc func(fs *bootflag.FlagSet) `json:"-" yaml:"-"`

	// CustomParseFunc defines custom parse behaviour for structure, if CustomParseFunc is nil, default parse behaviour will be used
	CustomParseFunc func() (err error) `json:"-" yaml:"-"`
}

Config to boot prometheus

func (*Config) BindFlags

func (c *Config) BindFlags(fs *bootflag.FlagSet)

func (*Config) Parse

func (c *Config) Parse() (err error)

type CounterOptions

type CounterOptions Options

CounterOptions is a bridge between prometheus.CounterOpts and boot configuration

See the official prometheus Golang client docs https://godoc.org/github.com/prometheus/client_golang/prometheus#CounterOpts for more details

func (*CounterOptions) BindFlags

func (o *CounterOptions) BindFlags(fs *bootflag.FlagSet)

BindFlags binds the fields of CounterOptions with command line flags

func (*CounterOptions) Parse

func (o *CounterOptions) Parse() (err error)

Parse will check if CounterOptions is a valid configuration for prometheus.CounterOpts

func (*CounterOptions) Standardize

func (o *CounterOptions) Standardize() prometheus.CounterOpts

Standardize returns a standard prometheus.CounterOpts

type GaugeOptions

type GaugeOptions Options

GaugeOptions is a bridge between prometheus.CounterOpts and boot configuration

See the official prometheus Golang client docs https://godoc.org/github.com/prometheus/client_golang/prometheus#GaugeOpts for more details

func (*GaugeOptions) BindFlags

func (o *GaugeOptions) BindFlags(fs *bootflag.FlagSet)

BindFlags binds the fields of GaugeOptions with command line flags

func (*GaugeOptions) Parse

func (o *GaugeOptions) Parse() (err error)

Parse will check if GaugeOptions is a valid configuration for prometheus.GaugeOpts

func (*GaugeOptions) Standardize

func (o *GaugeOptions) Standardize() prometheus.GaugeOpts

Standardize returns a standard prometheus.GaugeOpts

type HandlerOptions

type HandlerOptions struct {
	DisableCompression bool `json:"compression" yaml:"compression"`

	MaxRequestsInFlight int `json:"max-requests-in-flight" yaml:"max-requests-in-flight"`

	Timeout time.Duration `json:"timeout" yaml:"timeout"`

	ErrorHandling promhttp.HandlerErrorHandling `json:"error-handling" yaml:"error-handling"`

	// CustomBindFlagsFunc defines custom bind flags behaviour for structure, if CustomBindFlagsFunc is nil, default  bind flags behaviour will be used
	CustomBindFlagsFunc func(fs *bootflag.FlagSet) `json:"-" yaml:"-"`

	// CustomParseFunc defines custom parse behaviour for structure, if CustomParseFunc is nil, default parse behaviour will be used
	CustomParseFunc func() (err error) `json:"-" yaml:"-"`
}

HandlerOptions is a bridge between promhttp.HandlerOpts and boot configuration

See the official prometheus Golang client docs https://godoc.org/github.com/prometheus/client_golang/prometheus/promhttp#HandlerOpts for more details

func (*HandlerOptions) BindFlags

func (o *HandlerOptions) BindFlags(fs *bootflag.FlagSet)

BindFlags binds the fields of HandlerOptions with command line flags

func (*HandlerOptions) Parse

func (o *HandlerOptions) Parse() (err error)

func (HandlerOptions) Standardize

func (o HandlerOptions) Standardize() (opts promhttp.HandlerOpts)

Standardize returns a standard promhttp.HandlerOpts.

type HistogramOptions

type HistogramOptions struct {
	Namespace           string                     `json:"namespace" yaml:"namespace"`
	Subsystem           string                     `json:"subsystem" yaml:"subsystem"`
	Name                string                     `json:"name" yaml:"name"`
	Help                string                     `json:"help" yaml:"help"`
	ConstLabels         map[string]string          `json:"labels" yaml:"labels"`
	LabelNames          []string                   `json:"label-names" yaml:"label-names"`
	Buckets             []float64                  `json:"buckets" yaml:"buckets"`
	CustomBindFlagsFunc func(fs *bootflag.FlagSet) `json:"-" yaml:"-"`
	CustomParseFunc     func() (err error)         `json:"-" yaml:"-"`
}

HistogramOptions is a bridge between prometheus.HistogramOpts and boot configuration

See the official prometheus Golang client docs https://godoc.org/github.com/prometheus/client_golang/prometheus#HistogramOpts for more details

func (*HistogramOptions) BindFlags

func (o *HistogramOptions) BindFlags(fs *bootflag.FlagSet)

BindFlags binds the fields of HistogramOptions with command line flags

func (*HistogramOptions) Parse

func (o *HistogramOptions) Parse() (err error)

Parse will check if HistogramOptions is a valid configuration for prometheus.HistogramOpts

func (*HistogramOptions) Standardize

func (o *HistogramOptions) Standardize() prometheus.HistogramOpts

Standardize returns a standard prometheus.HistogramOpts

type Options

type Options struct {
	Namespace           string                     `json:"namespace" yaml:"namespace"`
	Subsystem           string                     `json:"subsystem" yaml:"subsystem"`
	Name                string                     `json:"name" yaml:"name"`
	Help                string                     `json:"help" yaml:"help"`
	ConstLabels         map[string]string          `json:"labels" yaml:"labels"`
	LabelNames          []string                   `json:"label-names" yaml:"label-names"`
	CustomBindFlagsFunc func(fs *bootflag.FlagSet) `json:"-" yaml:"-"`
	CustomParseFunc     func() (err error)         `json:"-" yaml:"-"`
}

Options is a bridge between prometheus.Opts and boot configuration

See the official prometheus Golang client docs https://godoc.org/github.com/prometheus/client_golang/prometheus#Opts for more details

func (*Options) BindFlags

func (o *Options) BindFlags(fs *bootflag.FlagSet)

BindFlags binds the fields of Options with command line flags

func (*Options) Parse

func (o *Options) Parse() (err error)

Parse will check if Options is a valid configuration for prometheus.Opts

func (*Options) Standardize

func (o *Options) Standardize() prometheus.Opts

Standardize returns a standard prometheus.Opts

type SummaryOptions

type SummaryOptions struct {
	Namespace           string                     `json:"namespace" yaml:"namespace"`
	Subsystem           string                     `json:"subsystem" yaml:"subsystem"`
	Name                string                     `json:"name" yaml:"name"`
	Help                string                     `json:"help" yaml:"help"`
	ConstLabels         map[string]string          `json:"labels" yaml:"labels"`
	LabelNames          []string                   `json:"label-names" yaml:"label-names"`
	Objectives          map[float64]float64        `json:"objectives" yaml:"objectives"`
	MaxAge              time.Duration              `json:"max-age" yaml:"max-age"`
	AgeBuckets          uint32                     `json:"age-buckets" yaml:"age-buckets"`
	BufCap              uint32                     `json:"buf-cap" yaml:"buf-cap"`
	CustomBindFlagsFunc func(fs *bootflag.FlagSet) `json:"-" yaml:"-"`
	CustomParseFunc     func() (err error)         `json:"-" yaml:"-"`
}

SummaryOptions is a bridge between prometheus.SummaryOpts and boot configuration

See the official prometheus Golang client docs https://godoc.org/github.com/prometheus/client_golang/prometheus#SummaryOpts for more details

func (*SummaryOptions) BindFlags

func (o *SummaryOptions) BindFlags(fs *bootflag.FlagSet)

BindFlags binds the fields of SummaryOptions with command line flags

func (*SummaryOptions) Parse

func (o *SummaryOptions) Parse() (err error)

Parse will check if SummaryOptions is a valid configuration for prometheus.SummaryOpts

func (*SummaryOptions) Standardize

func (o *SummaryOptions) Standardize() prometheus.SummaryOpts

Standardize returns a standard prometheus.SummaryOpts

Jump to

Keyboard shortcuts

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