adapters

package
v0.110.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddHTTPSDConfigToPromConfig

func AddHTTPSDConfigToPromConfig(prometheus map[interface{}]interface{}, taServiceName string) (map[interface{}]interface{}, 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[interface{}]interface{}, taServiceName string) (map[interface{}]interface{}, 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[interface{}]interface{}, error)

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

func GetScrapeConfigsFromPromConfig added in v0.96.0

func GetScrapeConfigsFromPromConfig(promReceiverConfig map[interface{}]interface{}) ([]map[string]interface{}, error)

GetScrapeConfigsFromPromConfig extracts the scrapeConfig array from prometheus receiver config.

func UnescapeDollarSignsInPromConfig

func UnescapeDollarSignsInPromConfig(cfg string) (map[interface{}]interface{}, 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[interface{}]interface{}, 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[interface{}]interface{}) 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

This section is empty.

Jump to

Keyboard shortcuts

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