v1

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFactory

func NewFactory() common.DiscovererFactory

Types

type Converter

type Converter struct{}

func (Converter) Convert

Convert translates MADS resources into Prometheus TargetGroups

Beware of the following constraints when it comes to integration with Prometheus:

  1. Prometheus model for all `sd`s except for `file_sd` looks like this:

    // Group is a set of targets with a common label set (production, test, staging etc.). type Group struct { // Targets is a list of targets identified by a label set. Each target is // uniquely identifiable in the group by its address label. Targets []model.LabelSet // Labels is a set of labels that is common across all targets in the group. Labels model.LabelSet

    // Source is an identifier that describes a group of targets. Source string }

    That is why Kuma's MonitoringAssignment was designed to be close to that model.

  2. However, `file_sd` uses different model for reading data from a file:

    struct { Targets []string `yaml:"targets"` Labels model.LabelSet `yaml:"labels"` }

    Notice that Targets is just a list of addresses rather than a list of model.LabelSet.

  3. Because of that mismatch, some form of conversion is unavoidable on client side, e.g. inside `kuma-prometheus-sd`

  4. The next component that imposes its constraints is `custom-sd`- adapter (https://github.com/prometheus/prometheus/tree/master/documentation/examples/custom-sd) that is recommended for use by all `file_sd`-based `sd`s.

    This adapter is doing conversion from Prometheus model into `file_sd` model and it expects that `Targets` field has only 1 label - `__address__` - and the rest of the labels must be a part of `Labels` field.

  5. Therefore, we need to convert MonitoringAssignment into a model that `custom-sd` expects.

    In practice, it means that generated MonitoringAssignment will be mapped to a set of groups, one per target. In the Prometheus native SD, this will not be the case and there will be a 1-1 mapping between assignments and groups.

func (Converter) ConvertAll

func (c Converter) ConvertAll(assignments []*observability_v1.MonitoringAssignment) []*targetgroup.Group

type Handler

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

func (*Handler) Handle

func (h *Handler) Handle(assignments []*observability_v1.MonitoringAssignment, ch chan<- []*targetgroup.Group)

Jump to

Keyboard shortcuts

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