prometheus

package
v0.56.1 Latest Latest
Warning

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

Go to latest
Published: May 4, 2022 License: Apache-2.0 Imports: 50 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateContent added in v0.50.0

func GenerateContent(promRule monitoringv1.PrometheusRuleSpec, logger log.Logger) (string, error)

GenerateContent takes a PrometheusRuleSpec and generates the rule content

func ListOptions

func ListOptions(name string) metav1.ListOptions

func Status added in v0.47.0

Status evaluates the current status of a Prometheus deployment with respect to its specified resource object. It returns the status and a list of pods that are not updated. TODO(simonpasquier): remove once the status subresource is considered stable.

func ValidateRule added in v0.50.0

func ValidateRule(promRule monitoringv1.PrometheusRuleSpec) []error

ValidateRule takes PrometheusRuleSpec and validates it using the upstream prometheus rule validator

func WebConfigSecretName added in v0.49.0

func WebConfigSecretName(name string) string

Types

type ConfigGenerator added in v0.48.0

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

ConfigGenerator knows how to generate a Prometheus configuration which is compatible with a given Prometheus version.

func NewConfigGenerator added in v0.23.0

func NewConfigGenerator(logger log.Logger, p *v1.Prometheus, endpointSliceSupported bool) (*ConfigGenerator, error)

NewConfigGenerator creates a ConfigGenerator for the provided Prometheus resource.

func (*ConfigGenerator) AddHonorLabels added in v0.55.0

func (cg *ConfigGenerator) AddHonorLabels(cfg yaml.MapSlice, honorLabels bool) yaml.MapSlice

AddHonorLabels adds the honor_labels field into scrape configurations. if OverrideHonorLabels is true then honor_labels is always false.

func (*ConfigGenerator) AddHonorTimestamps added in v0.55.0

func (cg *ConfigGenerator) AddHonorTimestamps(cfg yaml.MapSlice, userHonorTimestamps *bool) yaml.MapSlice

AddHonorTimestamps adds the honor_timestamps field into scrape configurations. honor_timestamps is false only when the user specified it or when the global override applies. For backwards compatibility with Prometheus <2.9.0 we don't set honor_timestamps.

func (*ConfigGenerator) AddLimitsToYAML added in v0.55.0

func (cg *ConfigGenerator) AddLimitsToYAML(cfg yaml.MapSlice, k limitKey, limit uint64, enforcedLimit *uint64) yaml.MapSlice

AddLimitsToYAML appends the given limit key to the configuration if supported by the Prometheus version.

func (*ConfigGenerator) AppendMapItem added in v0.55.0

func (cg *ConfigGenerator) AppendMapItem(m yaml.MapSlice, k string, v interface{}) yaml.MapSlice

AppendMapItem appends the k/v item to the given yaml.MapSlice and returns the updated slice.

func (*ConfigGenerator) EndpointSliceSupported added in v0.55.0

func (cg *ConfigGenerator) EndpointSliceSupported() bool

func (*ConfigGenerator) Generate added in v0.53.0

func (cg *ConfigGenerator) Generate(
	p *v1.Prometheus,
	sMons map[string]*v1.ServiceMonitor,
	pMons map[string]*v1.PodMonitor,
	probes map[string]*v1.Probe,
	store *assets.Store,
	additionalScrapeConfigs []byte,
	additionalAlertRelabelConfigs []byte,
	additionalAlertManagerConfigs []byte,
	ruleConfigMapNames []string,
) ([]byte, error)

Generate creates a serialized YAML representation of a Prometheus configuration using the provided resources.

func (*ConfigGenerator) WithKeyVals added in v0.55.0

func (cg *ConfigGenerator) WithKeyVals(keyvals ...interface{}) *ConfigGenerator

WithKeyVals returns a new ConfigGenerator with the same characteristics as the current object, expect that the keyvals are appended to the existing logger.

func (*ConfigGenerator) WithMaximumVersion added in v0.55.0

func (cg *ConfigGenerator) WithMaximumVersion(version string) *ConfigGenerator

WithMaximumVersion returns a new ConfigGenerator that does nothing (except logging a warning message) if the Prometheus version is greater than or equal to the given version. The method panics if version isn't a valid SemVer value.

func (*ConfigGenerator) WithMinimumVersion added in v0.55.0

func (cg *ConfigGenerator) WithMinimumVersion(version string) *ConfigGenerator

WithMinimumVersion returns a new ConfigGenerator that does nothing (except logging a warning message) if the Prometheus version is lesser than the given version. The method panics if version isn't a valid SemVer value.

type Operator

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

Operator manages life cycle of Prometheus deployments and monitoring configurations.

func New

New creates a new controller.

func (*Operator) Run

func (c *Operator) Run(ctx context.Context) error

Run the controller.

Jump to

Keyboard shortcuts

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