Documentation ¶
Index ¶
- func AddHTTPSDConfigToPromConfig(prometheus map[interface{}]interface{}, taServiceName string) (map[interface{}]interface{}, error)
- func AddTAConfigToPromConfig(prometheus map[interface{}]interface{}, taServiceName string, ...) (map[interface{}]interface{}, error)
- func ConfigToPromConfig(cfg string) (map[interface{}]interface{}, error)
- func GetScrapeConfigsFromPromConfig(promReceiverConfig map[interface{}]interface{}) ([]map[string]interface{}, error)
- func UnescapeDollarSignsInPromConfig(cfg string) (map[interface{}]interface{}, error)
- func ValidatePromConfig(config map[interface{}]interface{}, targetAllocatorEnabled bool) error
- func ValidateTargetAllocatorConfig(targetAllocatorPrometheusCR bool, ...) error
- type TAOption
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, taOpts ...TAOption) (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 ¶
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 ¶
UnescapeDollarSignsInPromConfig replaces "$$" with "$" in the "replacement" fields of both "relabel_configs" and "metric_relabel_configs" in a Prometheus configuration file.
func ValidatePromConfig ¶
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