mirror of
https://github.com/prometheus/prometheus.git
synced 2025-07-03 11:03:25 +00:00
scrape: set validation and escaping defaults in default config vars (#16751)
Some checks are pending
buf.build / lint and publish (push) Waiting to run
CI / Go tests (push) Waiting to run
CI / More Go tests (push) Waiting to run
CI / Go tests with previous Go version (push) Waiting to run
CI / UI tests (push) Waiting to run
CI / Go tests on Windows (push) Waiting to run
CI / Mixins tests (push) Waiting to run
CI / Build Prometheus for common architectures (push) Waiting to run
CI / Build Prometheus for all architectures (push) Waiting to run
CI / Report status of build Prometheus for all architectures (push) Blocked by required conditions
CI / Check generated parser (push) Waiting to run
CI / golangci-lint (push) Waiting to run
CI / fuzzing (push) Waiting to run
CI / codeql (push) Waiting to run
CI / Publish main branch artifacts (push) Blocked by required conditions
CI / Publish release artefacts (push) Blocked by required conditions
CI / Publish UI on npm Registry (push) Blocked by required conditions
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
Some checks are pending
buf.build / lint and publish (push) Waiting to run
CI / Go tests (push) Waiting to run
CI / More Go tests (push) Waiting to run
CI / Go tests with previous Go version (push) Waiting to run
CI / UI tests (push) Waiting to run
CI / Go tests on Windows (push) Waiting to run
CI / Mixins tests (push) Waiting to run
CI / Build Prometheus for common architectures (push) Waiting to run
CI / Build Prometheus for all architectures (push) Waiting to run
CI / Report status of build Prometheus for all architectures (push) Blocked by required conditions
CI / Check generated parser (push) Waiting to run
CI / golangci-lint (push) Waiting to run
CI / fuzzing (push) Waiting to run
CI / codeql (push) Waiting to run
CI / Publish main branch artifacts (push) Blocked by required conditions
CI / Publish release artefacts (push) Blocked by required conditions
CI / Publish UI on npm Registry (push) Blocked by required conditions
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
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
3 changed files with 92 additions and 66 deletions
|
@ -172,6 +172,8 @@ var (
|
|||
ScrapeProtocols: DefaultScrapeProtocols,
|
||||
ConvertClassicHistogramsToNHCB: false,
|
||||
AlwaysScrapeClassicHistograms: false,
|
||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
||||
MetricNameEscapingScheme: model.AllowUTF8,
|
||||
}
|
||||
|
||||
DefaultRuntimeConfig = RuntimeConfig{
|
||||
|
@ -179,7 +181,10 @@ var (
|
|||
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{
|
||||
// ScrapeTimeout, ScrapeInterval, ScrapeProtocols, AlwaysScrapeClassicHistograms, and ConvertClassicHistogramsToNHCB default to the configured globals.
|
||||
MetricsPath: "/metrics",
|
||||
|
@ -940,6 +945,12 @@ func (c *ScrapeConfig) MarshalYAML() (interface{}, error) {
|
|||
// ToValidationScheme returns the validation scheme for the given string config value.
|
||||
func ToValidationScheme(s string) (validationScheme model.ValidationScheme, err error) {
|
||||
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:
|
||||
validationScheme = model.UTF8Validation
|
||||
case LegacyValidationConfig:
|
||||
|
@ -951,6 +962,21 @@ func ToValidationScheme(s string) (validationScheme model.ValidationScheme, err
|
|||
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.
|
||||
func (c *ScrapeConfig) ConvertClassicHistogramsToNHCBEnabled() bool {
|
||||
return c.ConvertClassicHistogramsToNHCB != nil && *c.ConvertClassicHistogramsToNHCB
|
||||
|
|
|
@ -223,8 +223,8 @@ var expectedConf = &Config{
|
|||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||
ScrapeFallbackProtocol: PrometheusText0_0_4,
|
||||
ScrapeFailureLogFile: "testdata/fail_prom.log",
|
||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
||||
MetricNameEscapingScheme: model.AllowUTF8,
|
||||
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||
|
||||
|
@ -340,8 +340,8 @@ var expectedConf = &Config{
|
|||
LabelValueLengthLimit: 210,
|
||||
ScrapeProtocols: []ScrapeProtocol{PrometheusText0_0_4},
|
||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
||||
MetricNameEscapingScheme: model.AllowUTF8,
|
||||
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||
|
||||
|
@ -442,8 +442,8 @@ var expectedConf = &Config{
|
|||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
||||
MetricNameEscapingScheme: model.AllowUTF8,
|
||||
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||
|
||||
|
@ -502,8 +502,8 @@ var expectedConf = &Config{
|
|||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
||||
MetricNameEscapingScheme: model.AllowUTF8,
|
||||
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||
|
||||
|
@ -540,8 +540,8 @@ var expectedConf = &Config{
|
|||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
||||
MetricNameEscapingScheme: model.AllowUTF8,
|
||||
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||
|
||||
|
@ -584,8 +584,8 @@ var expectedConf = &Config{
|
|||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
||||
MetricNameEscapingScheme: model.AllowUTF8,
|
||||
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||
|
||||
|
@ -628,8 +628,8 @@ var expectedConf = &Config{
|
|||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
||||
MetricNameEscapingScheme: model.AllowUTF8,
|
||||
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||
|
||||
|
@ -662,8 +662,8 @@ var expectedConf = &Config{
|
|||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
||||
MetricNameEscapingScheme: model.AllowUTF8,
|
||||
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||
|
||||
|
@ -704,8 +704,8 @@ var expectedConf = &Config{
|
|||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
||||
MetricNameEscapingScheme: model.AllowUTF8,
|
||||
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||
|
||||
|
@ -743,8 +743,8 @@ var expectedConf = &Config{
|
|||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
||||
MetricNameEscapingScheme: model.AllowUTF8,
|
||||
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||
|
||||
|
@ -789,8 +789,8 @@ var expectedConf = &Config{
|
|||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
||||
MetricNameEscapingScheme: model.AllowUTF8,
|
||||
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||
|
||||
|
@ -825,8 +825,8 @@ var expectedConf = &Config{
|
|||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
||||
MetricNameEscapingScheme: model.AllowUTF8,
|
||||
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||
|
||||
|
@ -864,8 +864,8 @@ var expectedConf = &Config{
|
|||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
||||
MetricNameEscapingScheme: model.AllowUTF8,
|
||||
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||
|
||||
|
@ -896,8 +896,8 @@ var expectedConf = &Config{
|
|||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
||||
MetricNameEscapingScheme: model.AllowUTF8,
|
||||
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||
|
||||
|
@ -931,8 +931,8 @@ var expectedConf = &Config{
|
|||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
||||
MetricNameEscapingScheme: model.AllowUTF8,
|
||||
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||
|
||||
|
@ -966,8 +966,8 @@ var expectedConf = &Config{
|
|||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
||||
MetricNameEscapingScheme: model.AllowUTF8,
|
||||
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||
|
||||
|
@ -1001,8 +1001,8 @@ var expectedConf = &Config{
|
|||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
||||
MetricNameEscapingScheme: model.AllowUTF8,
|
||||
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||
|
||||
|
@ -1033,8 +1033,8 @@ var expectedConf = &Config{
|
|||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
||||
MetricNameEscapingScheme: model.AllowUTF8,
|
||||
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||
|
||||
|
@ -1073,8 +1073,8 @@ var expectedConf = &Config{
|
|||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
||||
MetricNameEscapingScheme: model.AllowUTF8,
|
||||
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||
|
||||
|
@ -1112,8 +1112,8 @@ var expectedConf = &Config{
|
|||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
||||
MetricNameEscapingScheme: model.AllowUTF8,
|
||||
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||
|
||||
|
@ -1148,8 +1148,8 @@ var expectedConf = &Config{
|
|||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
||||
MetricNameEscapingScheme: model.AllowUTF8,
|
||||
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||
|
||||
|
@ -1183,8 +1183,8 @@ var expectedConf = &Config{
|
|||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
||||
MetricNameEscapingScheme: model.AllowUTF8,
|
||||
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||
|
||||
|
@ -1222,8 +1222,8 @@ var expectedConf = &Config{
|
|||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
||||
MetricNameEscapingScheme: model.AllowUTF8,
|
||||
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||
|
||||
|
@ -1264,8 +1264,8 @@ var expectedConf = &Config{
|
|||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
||||
MetricNameEscapingScheme: model.AllowUTF8,
|
||||
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||
|
||||
|
@ -1325,8 +1325,8 @@ var expectedConf = &Config{
|
|||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
||||
MetricNameEscapingScheme: model.AllowUTF8,
|
||||
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||
|
||||
|
@ -1357,8 +1357,8 @@ var expectedConf = &Config{
|
|||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
||||
MetricNameEscapingScheme: model.AllowUTF8,
|
||||
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||
|
||||
|
@ -1400,8 +1400,8 @@ var expectedConf = &Config{
|
|||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
||||
MetricNameEscapingScheme: model.AllowUTF8,
|
||||
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||
|
||||
|
@ -1449,8 +1449,8 @@ var expectedConf = &Config{
|
|||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
||||
MetricNameEscapingScheme: model.AllowUTF8,
|
||||
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||
|
||||
|
@ -1488,8 +1488,8 @@ var expectedConf = &Config{
|
|||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
||||
MetricNameEscapingScheme: model.AllowUTF8,
|
||||
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||
|
||||
|
@ -1528,8 +1528,8 @@ var expectedConf = &Config{
|
|||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
||||
MetricNameEscapingScheme: model.AllowUTF8,
|
||||
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||
|
||||
|
@ -1563,8 +1563,8 @@ var expectedConf = &Config{
|
|||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
||||
MetricNameEscapingScheme: model.AllowUTF8,
|
||||
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||
AlwaysScrapeClassicHistograms: boolPtr(false),
|
||||
ConvertClassicHistogramsToNHCB: boolPtr(false),
|
||||
|
||||
|
@ -1600,8 +1600,8 @@ var expectedConf = &Config{
|
|||
LabelValueLengthLimit: globLabelValueLengthLimit,
|
||||
ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
|
||||
ScrapeFailureLogFile: globScrapeFailureLogFile,
|
||||
MetricNameValidationScheme: UTF8ValidationConfig,
|
||||
MetricNameEscapingScheme: model.AllowUTF8,
|
||||
MetricNameValidationScheme: DefaultGlobalConfig.MetricNameValidationScheme,
|
||||
MetricNameEscapingScheme: DefaultGlobalConfig.MetricNameEscapingScheme,
|
||||
AlwaysScrapeClassicHistograms: 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)
|
||||
}
|
||||
var escapingScheme model.EscapingScheme
|
||||
escapingScheme, err = model.ToEscapingScheme(cfg.MetricNameEscapingScheme)
|
||||
escapingScheme, err = config.ToEscapingScheme(cfg.MetricNameEscapingScheme, validationScheme)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("invalid metric name escaping scheme, %w", err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue