adapters

package
v0.147.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddHTTPSDConfigToPromConfig

func AddHTTPSDConfigToPromConfig(prometheus map[any]any, taServiceName string) (map[any]any, error)

AddHTTPSDConfigToPromConfig adds HTTP SD (Service Discovery) configuration to the Prometheus configuration. This function removes any existing service discovery configurations (e.g., `sd_configs`, `dns_sd_configs`, `file_sd_configs`, etc.) from the `scrape_configs` section and adds a single `http_sd_configs` configuration. The `http_sd_configs` points to the TA (Target Allocator) endpoint that provides the list of targets for the given job.

func AddTAConfigToPromConfig

func AddTAConfigToPromConfig(prometheus map[any]any, taServiceName string, taOpts ...TAOption) (map[any]any, error)

AddTAConfigToPromConfig adds or updates the target_allocator configuration in the Prometheus configuration. If the `EnableTargetAllocatorRewrite` feature flag for the target allocator is enabled, this function removes the existing scrape_configs from the collector's Prometheus configuration as it's not required.

func ConfigToPromConfig

func ConfigToPromConfig(cfg string) (map[any]any, error)

ConfigToPromConfig converts the incoming configuration object into the Prometheus receiver config.

func GetScrapeConfigsFromPromConfig added in v0.96.0

func GetScrapeConfigsFromPromConfig(promReceiverConfig map[any]any) ([]map[string]any, error)

GetScrapeConfigsFromPromConfig extracts the scrapeConfig array from prometheus receiver config.

func UnescapeDollarSignsInPromConfig

func UnescapeDollarSignsInPromConfig(cfg string) (map[any]any, error)

UnescapeDollarSignsInPromConfig replaces "$$" with "$" in the "replacement" fields of both "relabel_configs" and "metric_relabel_configs" in a Prometheus configuration file.

func ValidatePromConfig

func ValidatePromConfig(config map[any]any, targetAllocatorEnabled bool) error

ValidatePromConfig checks if the prometheus receiver config is valid given other collector-level settings.

func ValidateTargetAllocatorConfig

func ValidateTargetAllocatorConfig(targetAllocatorPrometheusCR bool, promReceiverConfig map[any]any) error

ValidateTargetAllocatorConfig checks if the Target Allocator config is valid In order for Target Allocator to do anything useful, at least one of the following has to be true:

  • at least one scrape config has to be defined in Prometheus receiver configuration
  • PrometheusCR has to be enabled in target allocator settings

Types

type TAOption added in v0.111.0

type TAOption func(targetAllocatorCfg map[any]any) error

func WithCollectorTargetReloadInterval added in v0.134.0

func WithCollectorTargetReloadInterval(interval string) TAOption

WithCollectorTargetReloadInterval adds the collector target reload interval to the target allocator configuration.

func WithTLSConfig added in v0.111.0

func WithTLSConfig(caFile, certFile, keyFile, taServiceName string) TAOption

Jump to

Keyboard shortcuts

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