mirror of
https://github.com/prometheus/prometheus.git
synced 2025-08-06 14:17:12 +02:00
scrape: set validation and escaping defaults in default config vars (#16751)
Fixes https://github.com/prometheus/prometheus/issues/16750 Signed-off-by: Owen Williams <owen.williams@grafana.com>
This commit is contained in:
parent
5b7ff92d95
commit
aa1d46a9da
@ -172,6 +172,8 @@ var (
|
|||||||
ScrapeProtocols: DefaultScrapeProtocols,
|
ScrapeProtocols: DefaultScrapeProtocols,
|
||||||
ConvertClassicHistogramsToNHCB: false,
|
ConvertClassicHistogramsToNHCB: false,
|
||||||
AlwaysScrapeClassicHistograms: false,
|
AlwaysScrapeClassicHistograms: false,
|
||||||
|
MetricNameValidationScheme: UTF8ValidationConfig,
|
||||||
|
MetricNameEscapingScheme: model.AllowUTF8,
|
||||||
}
|
}
|
||||||
|
|
||||||
DefaultRuntimeConfig = RuntimeConfig{
|
DefaultRuntimeConfig = RuntimeConfig{
|
||||||
@ -179,7 +181,10 @@ var (
|
|||||||
GoGC: getGoGC(),
|
GoGC: getGoGC(),
|
||||||
}
|
}
|
||||||
|
|
||||||
// DefaultScrapeConfig is the default scrape configuration.
|
// DefaultScrapeConfig is the default scrape configuration. Users of this
|
||||||
|
// default MUST call Validate() on the config after creation, even if it's
|
||||||
|
// used unaltered, to check for parameter correctness and fill out default
|
||||||
|
// values that can't be set inline in this declaration.
|
||||||
DefaultScrapeConfig = ScrapeConfig{
|
DefaultScrapeConfig = ScrapeConfig{
|
||||||
// ScrapeTimeout, ScrapeInterval, ScrapeProtocols, AlwaysScrapeClassicHistograms, and ConvertClassicHistogramsToNHCB default to the configured globals.
|
// ScrapeTimeout, ScrapeInterval, ScrapeProtocols, AlwaysScrapeClassicHistograms, and ConvertClassicHistogramsToNHCB default to the configured globals.
|
||||||
MetricsPath: "/metrics",
|
MetricsPath: "/metrics",
|
||||||
@ -940,6 +945,12 @@ func (c *ScrapeConfig) MarshalYAML() (interface{}, error) {
|
|||||||
// ToValidationScheme returns the validation scheme for the given string config value.
|
// ToValidationScheme returns the validation scheme for the given string config value.
|
||||||
func ToValidationScheme(s string) (validationScheme model.ValidationScheme, err error) {
|
func ToValidationScheme(s string) (validationScheme model.ValidationScheme, err error) {
|
||||||
switch s {
|
switch s {
|
||||||
|
case "":
|
||||||
|
// This is a workaround for third party exporters that don't set the validation scheme.
|
||||||
|
if DefaultGlobalConfig.MetricNameValidationScheme == "" {
|
||||||
|
return model.UTF8Validation, errors.New("global metric name validation scheme is not set")
|
||||||
|
}
|
||||||
|
return ToValidationScheme(DefaultGlobalConfig.MetricNameValidationScheme)
|
||||||
case UTF8ValidationConfig:
|
case UTF8ValidationConfig:
|
||||||
validationScheme = model.UTF8Validation
|
validationScheme = model.UTF8Validation
|
||||||
case LegacyValidationConfig:
|
case LegacyValidationConfig:
|
||||||
@ -951,6 +962,21 @@ func ToValidationScheme(s string) (validationScheme model.ValidationScheme, err
|
|||||||
return validationScheme, nil
|
return validationScheme, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ToEscapingScheme wraps the equivalent common library function with the
|
||||||
|
// desired default behavior based on the given validation scheme. This is a
|
||||||
|
// workaround for third party exporters that don't set the escaping scheme.
|
||||||
|
func ToEscapingScheme(s string, v model.ValidationScheme) (model.EscapingScheme, error) {
|
||||||
|
if s == "" {
|
||||||
|
switch v {
|
||||||
|
case model.UTF8Validation:
|
||||||
|
return model.NoEscaping, nil
|
||||||
|
case model.LegacyValidation:
|
||||||
|
return model.UnderscoreEscaping, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return model.ToEscapingScheme(s)
|
||||||
|
}
|
||||||
|
|
||||||
// ConvertClassicHistogramsToNHCBEnabled returns whether to convert classic histograms to NHCB.
|
// ConvertClassicHistogramsToNHCBEnabled returns whether to convert classic histograms to NHCB.
|
||||||
func (c *ScrapeConfig) ConvertClassicHistogramsToNHCBEnabled() bool {
|
func (c *ScrapeConfig) ConvertClassicHistogramsToNHCBEnabled() bool {
|
||||||
return c.ConvertClassicHistogramsToNHCB != nil && *c.ConvertClassicHistogramsToNHCB
|
return c.ConvertClassicHistogramsToNHCB != nil && *c.ConvertClassicHistogramsToNHCB
|
||||||
|
@ -223,8 +223,8 @@ var expectedConf = &Config{
|
|||||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||||
ScrapeFallbackProtocol: PrometheusText0_0_4,
|
ScrapeFallbackProtocol: PrometheusText0_0_4,
|
||||||
ScrapeFailureLogFile: "testdata/fail_prom.log",
|
ScrapeFailureLogFile: "testdata/fail_prom.log",
|
||||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||||
MetricNameEscapingScheme: model.AllowUTF8,
|
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||||
|
|
||||||
@ -340,8 +340,8 @@ var expectedConf = &Config{
|
|||||||
LabelValueLengthLimit: 210,
|
LabelValueLengthLimit: 210,
|
||||||
ScrapeProtocols: []ScrapeProtocol{PrometheusText0_0_4},
|
ScrapeProtocols: []ScrapeProtocol{PrometheusText0_0_4},
|
||||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||||
MetricNameEscapingScheme: model.AllowUTF8,
|
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||||
|
|
||||||
@ -442,8 +442,8 @@ var expectedConf = &Config{
|
|||||||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||||
MetricNameEscapingScheme: model.AllowUTF8,
|
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||||
|
|
||||||
@ -502,8 +502,8 @@ var expectedConf = &Config{
|
|||||||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||||
MetricNameEscapingScheme: model.AllowUTF8,
|
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||||
|
|
||||||
@ -540,8 +540,8 @@ var expectedConf = &Config{
|
|||||||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||||
MetricNameEscapingScheme: model.AllowUTF8,
|
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||||
|
|
||||||
@ -584,8 +584,8 @@ var expectedConf = &Config{
|
|||||||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||||
MetricNameEscapingScheme: model.AllowUTF8,
|
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||||
|
|
||||||
@ -628,8 +628,8 @@ var expectedConf = &Config{
|
|||||||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||||
MetricNameEscapingScheme: model.AllowUTF8,
|
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||||
|
|
||||||
@ -662,8 +662,8 @@ var expectedConf = &Config{
|
|||||||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||||
MetricNameEscapingScheme: model.AllowUTF8,
|
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||||
|
|
||||||
@ -704,8 +704,8 @@ var expectedConf = &Config{
|
|||||||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||||
MetricNameEscapingScheme: model.AllowUTF8,
|
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||||
|
|
||||||
@ -743,8 +743,8 @@ var expectedConf = &Config{
|
|||||||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||||
MetricNameEscapingScheme: model.AllowUTF8,
|
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||||
|
|
||||||
@ -789,8 +789,8 @@ var expectedConf = &Config{
|
|||||||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||||
MetricNameEscapingScheme: model.AllowUTF8,
|
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||||
|
|
||||||
@ -825,8 +825,8 @@ var expectedConf = &Config{
|
|||||||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||||
MetricNameEscapingScheme: model.AllowUTF8,
|
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||||
|
|
||||||
@ -864,8 +864,8 @@ var expectedConf = &Config{
|
|||||||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||||
MetricNameEscapingScheme: model.AllowUTF8,
|
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||||
|
|
||||||
@ -896,8 +896,8 @@ var expectedConf = &Config{
|
|||||||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||||
MetricNameEscapingScheme: model.AllowUTF8,
|
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||||
|
|
||||||
@ -931,8 +931,8 @@ var expectedConf = &Config{
|
|||||||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||||
MetricNameEscapingScheme: model.AllowUTF8,
|
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||||
|
|
||||||
@ -966,8 +966,8 @@ var expectedConf = &Config{
|
|||||||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||||
MetricNameEscapingScheme: model.AllowUTF8,
|
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||||
|
|
||||||
@ -1001,8 +1001,8 @@ var expectedConf = &Config{
|
|||||||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||||
MetricNameEscapingScheme: model.AllowUTF8,
|
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||||
|
|
||||||
@ -1033,8 +1033,8 @@ var expectedConf = &Config{
|
|||||||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||||
MetricNameEscapingScheme: model.AllowUTF8,
|
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||||
|
|
||||||
@ -1073,8 +1073,8 @@ var expectedConf = &Config{
|
|||||||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||||
MetricNameEscapingScheme: model.AllowUTF8,
|
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||||
|
|
||||||
@ -1112,8 +1112,8 @@ var expectedConf = &Config{
|
|||||||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||||
MetricNameEscapingScheme: model.AllowUTF8,
|
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||||
|
|
||||||
@ -1148,8 +1148,8 @@ var expectedConf = &Config{
|
|||||||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||||
MetricNameEscapingScheme: model.AllowUTF8,
|
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||||
|
|
||||||
@ -1183,8 +1183,8 @@ var expectedConf = &Config{
|
|||||||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||||
MetricNameEscapingScheme: model.AllowUTF8,
|
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||||
|
|
||||||
@ -1222,8 +1222,8 @@ var expectedConf = &Config{
|
|||||||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||||
MetricNameEscapingScheme: model.AllowUTF8,
|
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||||
|
|
||||||
@ -1264,8 +1264,8 @@ var expectedConf = &Config{
|
|||||||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||||
MetricNameEscapingScheme: model.AllowUTF8,
|
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||||
|
|
||||||
@ -1325,8 +1325,8 @@ var expectedConf = &Config{
|
|||||||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||||
MetricNameEscapingScheme: model.AllowUTF8,
|
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||||
|
|
||||||
@ -1357,8 +1357,8 @@ var expectedConf = &Config{
|
|||||||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||||
MetricNameEscapingScheme: model.AllowUTF8,
|
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||||
|
|
||||||
@ -1400,8 +1400,8 @@ var expectedConf = &Config{
|
|||||||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||||
MetricNameEscapingScheme: model.AllowUTF8,
|
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||||
|
|
||||||
@ -1449,8 +1449,8 @@ var expectedConf = &Config{
|
|||||||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||||
MetricNameEscapingScheme: model.AllowUTF8,
|
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||||
|
|
||||||
@ -1488,8 +1488,8 @@ var expectedConf = &Config{
|
|||||||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||||
MetricNameEscapingScheme: model.AllowUTF8,
|
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||||
|
|
||||||
@ -1528,8 +1528,8 @@ var expectedConf = &Config{
|
|||||||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||||
MetricNameEscapingScheme: model.AllowUTF8,
|
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||||
|
|
||||||
@ -1563,8 +1563,8 @@ var expectedConf = &Config{
|
|||||||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||||
MetricNameEscapingScheme: model.AllowUTF8,
|
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||||
|
|
||||||
@ -1600,8 +1600,8 @@ var expectedConf = &Config{
|
|||||||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||||
MetricNameEscapingScheme: model.AllowUTF8,
|
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ func newScrapePool(cfg *config.ScrapeConfig, app storage.Appendable, offsetSeed
|
|||||||
return nil, fmt.Errorf("invalid metric name validation scheme: %w", err)
|
return nil, fmt.Errorf("invalid metric name validation scheme: %w", err)
|
||||||
}
|
}
|
||||||
var escapingScheme model.EscapingScheme
|
var escapingScheme model.EscapingScheme
|
||||||
escapingScheme, err = model.ToEscapingScheme(cfg.MetricNameEscapingScheme)
|
escapingScheme, err = config.ToEscapingScheme(cfg.MetricNameEscapingScheme, validationScheme)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("invalid metric name escaping scheme, %w", err)
|
return nil, fmt.Errorf("invalid metric name escaping scheme, %w", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user