mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-05 01:01:09 +01:00
lib/promscrape/discovery: support generic auth configs in Consul service discovery in the same way as Prometheus 2.28 does
This commit is contained in:
parent
59e7755df9
commit
755040a171
@ -11,6 +11,7 @@ sort: 15
|
|||||||
* FEATURE: vmagent: show the number of samples the target returned during the last scrape on `/targets` and `/api/v1/targets` pages. This should simplify debugging targets, which may return too big or too low number of samples. See [this feature request](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1377).
|
* FEATURE: vmagent: show the number of samples the target returned during the last scrape on `/targets` and `/api/v1/targets` pages. This should simplify debugging targets, which may return too big or too low number of samples. See [this feature request](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1377).
|
||||||
* FEATURE: vmagent: show jobs with zero discovered targets on `/targets` page. This should help debugging improperly configured scrape configs.
|
* FEATURE: vmagent: show jobs with zero discovered targets on `/targets` page. This should help debugging improperly configured scrape configs.
|
||||||
* FEATURE: vmagent: support namespace in Consul serive discovery in the same way as Prometheus 2.28 does. See [this issue](https://github.com/prometheus/prometheus/issues/8894) for details.
|
* FEATURE: vmagent: support namespace in Consul serive discovery in the same way as Prometheus 2.28 does. See [this issue](https://github.com/prometheus/prometheus/issues/8894) for details.
|
||||||
|
* FEATURE: vmagent: support generic auth configs in `consul_sd_configs` in the same way as Prometheus 2.28 does. See [this issue](https://github.com/prometheus/prometheus/issues/8924) for details.
|
||||||
* FEATURE: [vmctl](https://docs.victoriametrics.com/vmctl.html): limit the number of samples per each imported JSON line. This should limit the memory usage at VictoriaMetrics side when importing time series with big number of samples.
|
* FEATURE: [vmctl](https://docs.victoriametrics.com/vmctl.html): limit the number of samples per each imported JSON line. This should limit the memory usage at VictoriaMetrics side when importing time series with big number of samples.
|
||||||
* FEATURE: vmselect: log slow queries across all the `/api/v1/*` handlers (aka [Prometheus query API](https://prometheus.io/docs/prometheus/latest/querying/api)) if their execution duration exceeds `-search.logSlowQueryDuration`. This should simplify debugging slow requests to such handlers as `/api/v1/labels` or `/api/v1/series` additionally to `/api/v1/query` and `/api/v1/query_range`, which were logged in the previous releases.
|
* FEATURE: vmselect: log slow queries across all the `/api/v1/*` handlers (aka [Prometheus query API](https://prometheus.io/docs/prometheus/latest/querying/api)) if their execution duration exceeds `-search.logSlowQueryDuration`. This should simplify debugging slow requests to such handlers as `/api/v1/labels` or `/api/v1/series` additionally to `/api/v1/query` and `/api/v1/query_range`, which were logged in the previous releases.
|
||||||
|
|
||||||
|
@ -38,19 +38,27 @@ func getAPIConfig(sdc *SDConfig, baseDir string) (*apiConfig, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func newAPIConfig(sdc *SDConfig, baseDir string) (*apiConfig, error) {
|
func newAPIConfig(sdc *SDConfig, baseDir string) (*apiConfig, error) {
|
||||||
|
hcc := sdc.HTTPClientConfig
|
||||||
token, err := getToken(sdc.Token)
|
token, err := getToken(sdc.Token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
var ba *promauth.BasicAuthConfig
|
if token != "" {
|
||||||
|
if hcc.BearerToken != "" {
|
||||||
|
return nil, fmt.Errorf("cannot set both token and bearer_token configs")
|
||||||
|
}
|
||||||
|
hcc.BearerToken = token
|
||||||
|
}
|
||||||
if len(sdc.Username) > 0 {
|
if len(sdc.Username) > 0 {
|
||||||
ba = &promauth.BasicAuthConfig{
|
if hcc.BasicAuth != nil {
|
||||||
|
return nil, fmt.Errorf("cannot set both username and basic_auth configs")
|
||||||
|
}
|
||||||
|
hcc.BasicAuth = &promauth.BasicAuthConfig{
|
||||||
Username: sdc.Username,
|
Username: sdc.Username,
|
||||||
Password: sdc.Password,
|
Password: sdc.Password,
|
||||||
}
|
}
|
||||||
token = ""
|
|
||||||
}
|
}
|
||||||
ac, err := promauth.NewConfig(baseDir, nil, ba, token, "", nil, sdc.TLSConfig)
|
ac, err := hcc.NewConfig(baseDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("cannot parse auth config: %w", err)
|
return nil, fmt.Errorf("cannot parse auth config: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -20,9 +20,9 @@ type SDConfig struct {
|
|||||||
Scheme string `yaml:"scheme,omitempty"`
|
Scheme string `yaml:"scheme,omitempty"`
|
||||||
Username string `yaml:"username"`
|
Username string `yaml:"username"`
|
||||||
Password string `yaml:"password"`
|
Password string `yaml:"password"`
|
||||||
|
HTTPClientConfig promauth.HTTPClientConfig `yaml:",inline"`
|
||||||
ProxyURL proxy.URL `yaml:"proxy_url,omitempty"`
|
ProxyURL proxy.URL `yaml:"proxy_url,omitempty"`
|
||||||
ProxyClientConfig promauth.ProxyClientConfig `yaml:",inline"`
|
ProxyClientConfig promauth.ProxyClientConfig `yaml:",inline"`
|
||||||
TLSConfig *promauth.TLSConfig `yaml:"tls_config,omitempty"`
|
|
||||||
Services []string `yaml:"services,omitempty"`
|
Services []string `yaml:"services,omitempty"`
|
||||||
Tags []string `yaml:"tags,omitempty"`
|
Tags []string `yaml:"tags,omitempty"`
|
||||||
NodeMeta map[string]string `yaml:"node_meta,omitempty"`
|
NodeMeta map[string]string `yaml:"node_meta,omitempty"`
|
||||||
|
Loading…
Reference in New Issue
Block a user