mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-12 16:44:05 -08:00
config: remove deprecated target_groups
configuration
This commit is contained in:
parent
9c3129746c
commit
919558f601
|
@ -23,7 +23,6 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/prometheus/common/log"
|
|
||||||
"github.com/prometheus/common/model"
|
"github.com/prometheus/common/model"
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
)
|
)
|
||||||
|
@ -409,8 +408,6 @@ type ScrapeConfig struct {
|
||||||
TLSConfig TLSConfig `yaml:"tls_config,omitempty"`
|
TLSConfig TLSConfig `yaml:"tls_config,omitempty"`
|
||||||
|
|
||||||
// List of labeled target groups for this job.
|
// List of labeled target groups for this job.
|
||||||
// XXX(fabxc): `target_groups` is deprecated.
|
|
||||||
TargetGroups []*TargetGroup `yaml:"target_groups,omitempty"`
|
|
||||||
StaticConfigs []*TargetGroup `yaml:"static_configs,omitempty"`
|
StaticConfigs []*TargetGroup `yaml:"static_configs,omitempty"`
|
||||||
// List of DNS service discovery configurations.
|
// List of DNS service discovery configurations.
|
||||||
DNSSDConfigs []*DNSSDConfig `yaml:"dns_sd_configs,omitempty"`
|
DNSSDConfigs []*DNSSDConfig `yaml:"dns_sd_configs,omitempty"`
|
||||||
|
@ -460,14 +457,6 @@ func (c *ScrapeConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||||
if c.BasicAuth != nil && (len(c.BearerToken) > 0 || len(c.BearerTokenFile) > 0) {
|
if c.BasicAuth != nil && (len(c.BearerToken) > 0 || len(c.BearerTokenFile) > 0) {
|
||||||
return fmt.Errorf("at most one of basic_auth, bearer_token & bearer_token_file must be configured")
|
return fmt.Errorf("at most one of basic_auth, bearer_token & bearer_token_file must be configured")
|
||||||
}
|
}
|
||||||
// Check `target_groups` deprecation.
|
|
||||||
if c.TargetGroups != nil && c.StaticConfigs != nil {
|
|
||||||
return fmt.Errorf("'target_groups' is deprecated, configure static targets via 'static_configs' only")
|
|
||||||
}
|
|
||||||
if c.TargetGroups != nil {
|
|
||||||
log.Warnf("The 'target_groups' option for scrape configurations is deprecated, use 'static_configs' instead")
|
|
||||||
c.StaticConfigs = c.TargetGroups
|
|
||||||
}
|
|
||||||
// Check for users putting URLs in target groups.
|
// Check for users putting URLs in target groups.
|
||||||
if len(c.RelabelConfigs) == 0 {
|
if len(c.RelabelConfigs) == 0 {
|
||||||
for _, tg := range c.StaticConfigs {
|
for _, tg := range c.StaticConfigs {
|
||||||
|
|
Loading…
Reference in a new issue