@ -105,7 +105,7 @@ var expectedConf = &Config{
LabelLimit : globLabelLimit ,
LabelNameLengthLimit : globLabelNameLengthLimit ,
LabelValueLengthLimit : globLabelValueLengthLimit ,
ScrapeProtocols : DefaultGlobalConfig . ScrapeProtocols ,
ScrapeNativeHistograms : boolPtr ( false ) ,
AlwaysScrapeClassicHistograms : false ,
ConvertClassicHistogramsToNHCB : false ,
MetricNameValidationScheme : model . UTF8Validation ,
@ -225,11 +225,12 @@ var expectedConf = &Config{
LabelLimit : globLabelLimit ,
LabelNameLengthLimit : globLabelNameLengthLimit ,
LabelValueLengthLimit : globLabelValueLengthLimit ,
ScrapeProtocols : DefaultGlobalConfig . ScrapeProtocols ,
ScrapeProtocols : DefaultScrapeProtocols ,
ScrapeFallbackProtocol : PrometheusText0_0_4 ,
ScrapeFailureLogFile : "testdata/fail_prom.log" ,
MetricNameValidationScheme : DefaultGlobalConfig . MetricNameValidationScheme ,
MetricNameEscapingScheme : DefaultGlobalConfig . MetricNameEscapingScheme ,
ScrapeNativeHistograms : boolPtr ( false ) ,
AlwaysScrapeClassicHistograms : boolPtr ( false ) ,
ConvertClassicHistogramsToNHCB : boolPtr ( false ) ,
@ -353,6 +354,7 @@ var expectedConf = &Config{
ScrapeFailureLogFile : globScrapeFailureLogFile ,
MetricNameValidationScheme : DefaultGlobalConfig . MetricNameValidationScheme ,
MetricNameEscapingScheme : DefaultGlobalConfig . MetricNameEscapingScheme ,
ScrapeNativeHistograms : boolPtr ( false ) ,
AlwaysScrapeClassicHistograms : boolPtr ( false ) ,
ConvertClassicHistogramsToNHCB : boolPtr ( false ) ,
@ -458,10 +460,11 @@ var expectedConf = &Config{
LabelLimit : globLabelLimit ,
LabelNameLengthLimit : globLabelNameLengthLimit ,
LabelValueLengthLimit : globLabelValueLengthLimit ,
ScrapeProtocols : DefaultGlobalConfig . ScrapeProtocols ,
ScrapeProtocols : DefaultScrapeProtocols ,
ScrapeFailureLogFile : globScrapeFailureLogFile ,
MetricNameValidationScheme : DefaultGlobalConfig . MetricNameValidationScheme ,
MetricNameEscapingScheme : DefaultGlobalConfig . MetricNameEscapingScheme ,
ScrapeNativeHistograms : boolPtr ( false ) ,
AlwaysScrapeClassicHistograms : boolPtr ( false ) ,
ConvertClassicHistogramsToNHCB : boolPtr ( false ) ,
@ -519,10 +522,11 @@ var expectedConf = &Config{
LabelLimit : globLabelLimit ,
LabelNameLengthLimit : globLabelNameLengthLimit ,
LabelValueLengthLimit : globLabelValueLengthLimit ,
ScrapeProtocols : DefaultGlobalConfig . ScrapeProtocols ,
ScrapeProtocols : DefaultScrapeProtocols ,
ScrapeFailureLogFile : globScrapeFailureLogFile ,
MetricNameValidationScheme : DefaultGlobalConfig . MetricNameValidationScheme ,
MetricNameEscapingScheme : DefaultGlobalConfig . MetricNameEscapingScheme ,
ScrapeNativeHistograms : boolPtr ( false ) ,
AlwaysScrapeClassicHistograms : boolPtr ( false ) ,
ConvertClassicHistogramsToNHCB : boolPtr ( false ) ,
@ -557,10 +561,11 @@ var expectedConf = &Config{
LabelLimit : globLabelLimit ,
LabelNameLengthLimit : globLabelNameLengthLimit ,
LabelValueLengthLimit : globLabelValueLengthLimit ,
ScrapeProtocols : DefaultGlobalConfig . ScrapeProtocols ,
ScrapeProtocols : DefaultScrapeProtocols ,
ScrapeFailureLogFile : globScrapeFailureLogFile ,
MetricNameValidationScheme : DefaultGlobalConfig . MetricNameValidationScheme ,
MetricNameEscapingScheme : DefaultGlobalConfig . MetricNameEscapingScheme ,
ScrapeNativeHistograms : boolPtr ( false ) ,
AlwaysScrapeClassicHistograms : boolPtr ( false ) ,
ConvertClassicHistogramsToNHCB : boolPtr ( false ) ,
@ -601,10 +606,11 @@ var expectedConf = &Config{
LabelLimit : globLabelLimit ,
LabelNameLengthLimit : globLabelNameLengthLimit ,
LabelValueLengthLimit : globLabelValueLengthLimit ,
ScrapeProtocols : DefaultGlobalConfig . ScrapeProtocols ,
ScrapeProtocols : DefaultScrapeProtocols ,
ScrapeFailureLogFile : globScrapeFailureLogFile ,
MetricNameValidationScheme : DefaultGlobalConfig . MetricNameValidationScheme ,
MetricNameEscapingScheme : DefaultGlobalConfig . MetricNameEscapingScheme ,
ScrapeNativeHistograms : boolPtr ( false ) ,
AlwaysScrapeClassicHistograms : boolPtr ( false ) ,
ConvertClassicHistogramsToNHCB : boolPtr ( false ) ,
@ -645,10 +651,11 @@ var expectedConf = &Config{
LabelLimit : globLabelLimit ,
LabelNameLengthLimit : globLabelNameLengthLimit ,
LabelValueLengthLimit : globLabelValueLengthLimit ,
ScrapeProtocols : DefaultGlobalConfig . ScrapeProtocols ,
ScrapeProtocols : DefaultScrapeProtocols ,
ScrapeFailureLogFile : globScrapeFailureLogFile ,
MetricNameValidationScheme : DefaultGlobalConfig . MetricNameValidationScheme ,
MetricNameEscapingScheme : DefaultGlobalConfig . MetricNameEscapingScheme ,
ScrapeNativeHistograms : boolPtr ( false ) ,
AlwaysScrapeClassicHistograms : boolPtr ( false ) ,
ConvertClassicHistogramsToNHCB : boolPtr ( false ) ,
@ -679,10 +686,11 @@ var expectedConf = &Config{
LabelLimit : globLabelLimit ,
LabelNameLengthLimit : globLabelNameLengthLimit ,
LabelValueLengthLimit : globLabelValueLengthLimit ,
ScrapeProtocols : DefaultGlobalConfig . ScrapeProtocols ,
ScrapeProtocols : DefaultScrapeProtocols ,
ScrapeFailureLogFile : globScrapeFailureLogFile ,
MetricNameValidationScheme : DefaultGlobalConfig . MetricNameValidationScheme ,
MetricNameEscapingScheme : DefaultGlobalConfig . MetricNameEscapingScheme ,
ScrapeNativeHistograms : boolPtr ( false ) ,
AlwaysScrapeClassicHistograms : boolPtr ( false ) ,
ConvertClassicHistogramsToNHCB : boolPtr ( false ) ,
@ -721,10 +729,11 @@ var expectedConf = &Config{
LabelLimit : globLabelLimit ,
LabelNameLengthLimit : globLabelNameLengthLimit ,
LabelValueLengthLimit : globLabelValueLengthLimit ,
ScrapeProtocols : DefaultGlobalConfig . ScrapeProtocols ,
ScrapeProtocols : DefaultScrapeProtocols ,
ScrapeFailureLogFile : globScrapeFailureLogFile ,
MetricNameValidationScheme : DefaultGlobalConfig . MetricNameValidationScheme ,
MetricNameEscapingScheme : DefaultGlobalConfig . MetricNameEscapingScheme ,
ScrapeNativeHistograms : boolPtr ( false ) ,
AlwaysScrapeClassicHistograms : boolPtr ( false ) ,
ConvertClassicHistogramsToNHCB : boolPtr ( false ) ,
@ -760,10 +769,11 @@ var expectedConf = &Config{
LabelLimit : globLabelLimit ,
LabelNameLengthLimit : globLabelNameLengthLimit ,
LabelValueLengthLimit : globLabelValueLengthLimit ,
ScrapeProtocols : DefaultGlobalConfig . ScrapeProtocols ,
ScrapeProtocols : DefaultScrapeProtocols ,
ScrapeFailureLogFile : globScrapeFailureLogFile ,
MetricNameValidationScheme : DefaultGlobalConfig . MetricNameValidationScheme ,
MetricNameEscapingScheme : DefaultGlobalConfig . MetricNameEscapingScheme ,
ScrapeNativeHistograms : boolPtr ( false ) ,
AlwaysScrapeClassicHistograms : boolPtr ( false ) ,
ConvertClassicHistogramsToNHCB : boolPtr ( false ) ,
@ -806,10 +816,11 @@ var expectedConf = &Config{
LabelLimit : globLabelLimit ,
LabelNameLengthLimit : globLabelNameLengthLimit ,
LabelValueLengthLimit : globLabelValueLengthLimit ,
ScrapeProtocols : DefaultGlobalConfig . ScrapeProtocols ,
ScrapeProtocols : DefaultScrapeProtocols ,
ScrapeFailureLogFile : globScrapeFailureLogFile ,
MetricNameValidationScheme : DefaultGlobalConfig . MetricNameValidationScheme ,
MetricNameEscapingScheme : DefaultGlobalConfig . MetricNameEscapingScheme ,
ScrapeNativeHistograms : boolPtr ( false ) ,
AlwaysScrapeClassicHistograms : boolPtr ( false ) ,
ConvertClassicHistogramsToNHCB : boolPtr ( false ) ,
@ -842,10 +853,11 @@ var expectedConf = &Config{
LabelLimit : globLabelLimit ,
LabelNameLengthLimit : globLabelNameLengthLimit ,
LabelValueLengthLimit : globLabelValueLengthLimit ,
ScrapeProtocols : DefaultGlobalConfig . ScrapeProtocols ,
ScrapeProtocols : DefaultScrapeProtocols ,
ScrapeFailureLogFile : globScrapeFailureLogFile ,
MetricNameValidationScheme : DefaultGlobalConfig . MetricNameValidationScheme ,
MetricNameEscapingScheme : DefaultGlobalConfig . MetricNameEscapingScheme ,
ScrapeNativeHistograms : boolPtr ( false ) ,
AlwaysScrapeClassicHistograms : boolPtr ( false ) ,
ConvertClassicHistogramsToNHCB : boolPtr ( false ) ,
@ -881,10 +893,11 @@ var expectedConf = &Config{
LabelLimit : globLabelLimit ,
LabelNameLengthLimit : globLabelNameLengthLimit ,
LabelValueLengthLimit : globLabelValueLengthLimit ,
ScrapeProtocols : DefaultGlobalConfig . ScrapeProtocols ,
ScrapeProtocols : DefaultScrapeProtocols ,
ScrapeFailureLogFile : globScrapeFailureLogFile ,
MetricNameValidationScheme : DefaultGlobalConfig . MetricNameValidationScheme ,
MetricNameEscapingScheme : DefaultGlobalConfig . MetricNameEscapingScheme ,
ScrapeNativeHistograms : boolPtr ( false ) ,
AlwaysScrapeClassicHistograms : boolPtr ( false ) ,
ConvertClassicHistogramsToNHCB : boolPtr ( false ) ,
@ -913,10 +926,11 @@ var expectedConf = &Config{
LabelLimit : globLabelLimit ,
LabelNameLengthLimit : globLabelNameLengthLimit ,
LabelValueLengthLimit : globLabelValueLengthLimit ,
ScrapeProtocols : DefaultGlobalConfig . ScrapeProtocols ,
ScrapeProtocols : DefaultScrapeProtocols ,
ScrapeFailureLogFile : globScrapeFailureLogFile ,
MetricNameValidationScheme : DefaultGlobalConfig . MetricNameValidationScheme ,
MetricNameEscapingScheme : DefaultGlobalConfig . MetricNameEscapingScheme ,
ScrapeNativeHistograms : boolPtr ( false ) ,
AlwaysScrapeClassicHistograms : boolPtr ( false ) ,
ConvertClassicHistogramsToNHCB : boolPtr ( false ) ,
@ -948,10 +962,11 @@ var expectedConf = &Config{
LabelLimit : globLabelLimit ,
LabelNameLengthLimit : globLabelNameLengthLimit ,
LabelValueLengthLimit : globLabelValueLengthLimit ,
ScrapeProtocols : DefaultGlobalConfig . ScrapeProtocols ,
ScrapeProtocols : DefaultScrapeProtocols ,
ScrapeFailureLogFile : globScrapeFailureLogFile ,
MetricNameValidationScheme : DefaultGlobalConfig . MetricNameValidationScheme ,
MetricNameEscapingScheme : DefaultGlobalConfig . MetricNameEscapingScheme ,
ScrapeNativeHistograms : boolPtr ( false ) ,
AlwaysScrapeClassicHistograms : boolPtr ( false ) ,
ConvertClassicHistogramsToNHCB : boolPtr ( false ) ,
@ -983,10 +998,11 @@ var expectedConf = &Config{
LabelLimit : globLabelLimit ,
LabelNameLengthLimit : globLabelNameLengthLimit ,
LabelValueLengthLimit : globLabelValueLengthLimit ,
ScrapeProtocols : DefaultGlobalConfig . ScrapeProtocols ,
ScrapeProtocols : DefaultScrapeProtocols ,
ScrapeFailureLogFile : globScrapeFailureLogFile ,
MetricNameValidationScheme : DefaultGlobalConfig . MetricNameValidationScheme ,
MetricNameEscapingScheme : DefaultGlobalConfig . MetricNameEscapingScheme ,
ScrapeNativeHistograms : boolPtr ( false ) ,
AlwaysScrapeClassicHistograms : boolPtr ( false ) ,
ConvertClassicHistogramsToNHCB : boolPtr ( false ) ,
@ -1018,10 +1034,11 @@ var expectedConf = &Config{
LabelLimit : globLabelLimit ,
LabelNameLengthLimit : globLabelNameLengthLimit ,
LabelValueLengthLimit : globLabelValueLengthLimit ,
ScrapeProtocols : DefaultGlobalConfig . ScrapeProtocols ,
ScrapeProtocols : DefaultScrapeProtocols ,
ScrapeFailureLogFile : globScrapeFailureLogFile ,
MetricNameValidationScheme : DefaultGlobalConfig . MetricNameValidationScheme ,
MetricNameEscapingScheme : DefaultGlobalConfig . MetricNameEscapingScheme ,
ScrapeNativeHistograms : boolPtr ( false ) ,
AlwaysScrapeClassicHistograms : boolPtr ( false ) ,
ConvertClassicHistogramsToNHCB : boolPtr ( false ) ,
@ -1050,10 +1067,11 @@ var expectedConf = &Config{
LabelLimit : globLabelLimit ,
LabelNameLengthLimit : globLabelNameLengthLimit ,
LabelValueLengthLimit : globLabelValueLengthLimit ,
ScrapeProtocols : DefaultGlobalConfig . ScrapeProtocols ,
ScrapeProtocols : DefaultScrapeProtocols ,
ScrapeFailureLogFile : globScrapeFailureLogFile ,
MetricNameValidationScheme : DefaultGlobalConfig . MetricNameValidationScheme ,
MetricNameEscapingScheme : DefaultGlobalConfig . MetricNameEscapingScheme ,
ScrapeNativeHistograms : boolPtr ( false ) ,
AlwaysScrapeClassicHistograms : boolPtr ( false ) ,
ConvertClassicHistogramsToNHCB : boolPtr ( false ) ,
@ -1090,10 +1108,11 @@ var expectedConf = &Config{
LabelLimit : globLabelLimit ,
LabelNameLengthLimit : globLabelNameLengthLimit ,
LabelValueLengthLimit : globLabelValueLengthLimit ,
ScrapeProtocols : DefaultGlobalConfig . ScrapeProtocols ,
ScrapeProtocols : DefaultScrapeProtocols ,
ScrapeFailureLogFile : globScrapeFailureLogFile ,
MetricNameValidationScheme : DefaultGlobalConfig . MetricNameValidationScheme ,
MetricNameEscapingScheme : DefaultGlobalConfig . MetricNameEscapingScheme ,
ScrapeNativeHistograms : boolPtr ( false ) ,
AlwaysScrapeClassicHistograms : boolPtr ( false ) ,
ConvertClassicHistogramsToNHCB : boolPtr ( false ) ,
@ -1129,10 +1148,11 @@ var expectedConf = &Config{
LabelLimit : globLabelLimit ,
LabelNameLengthLimit : globLabelNameLengthLimit ,
LabelValueLengthLimit : globLabelValueLengthLimit ,
ScrapeProtocols : DefaultGlobalConfig . ScrapeProtocols ,
ScrapeProtocols : DefaultScrapeProtocols ,
ScrapeFailureLogFile : globScrapeFailureLogFile ,
MetricNameValidationScheme : DefaultGlobalConfig . MetricNameValidationScheme ,
MetricNameEscapingScheme : DefaultGlobalConfig . MetricNameEscapingScheme ,
ScrapeNativeHistograms : boolPtr ( false ) ,
AlwaysScrapeClassicHistograms : boolPtr ( false ) ,
ConvertClassicHistogramsToNHCB : boolPtr ( false ) ,
@ -1165,10 +1185,11 @@ var expectedConf = &Config{
LabelLimit : globLabelLimit ,
LabelNameLengthLimit : globLabelNameLengthLimit ,
LabelValueLengthLimit : globLabelValueLengthLimit ,
ScrapeProtocols : DefaultGlobalConfig . ScrapeProtocols ,
ScrapeProtocols : DefaultScrapeProtocols ,
ScrapeFailureLogFile : globScrapeFailureLogFile ,
MetricNameValidationScheme : DefaultGlobalConfig . MetricNameValidationScheme ,
MetricNameEscapingScheme : DefaultGlobalConfig . MetricNameEscapingScheme ,
ScrapeNativeHistograms : boolPtr ( false ) ,
AlwaysScrapeClassicHistograms : boolPtr ( false ) ,
ConvertClassicHistogramsToNHCB : boolPtr ( false ) ,
@ -1200,10 +1221,11 @@ var expectedConf = &Config{
LabelLimit : globLabelLimit ,
LabelNameLengthLimit : globLabelNameLengthLimit ,
LabelValueLengthLimit : globLabelValueLengthLimit ,
ScrapeProtocols : DefaultGlobalConfig . ScrapeProtocols ,
ScrapeProtocols : DefaultScrapeProtocols ,
ScrapeFailureLogFile : globScrapeFailureLogFile ,
MetricNameValidationScheme : DefaultGlobalConfig . MetricNameValidationScheme ,
MetricNameEscapingScheme : DefaultGlobalConfig . MetricNameEscapingScheme ,
ScrapeNativeHistograms : boolPtr ( false ) ,
AlwaysScrapeClassicHistograms : boolPtr ( false ) ,
ConvertClassicHistogramsToNHCB : boolPtr ( false ) ,
@ -1239,10 +1261,11 @@ var expectedConf = &Config{
LabelLimit : globLabelLimit ,
LabelNameLengthLimit : globLabelNameLengthLimit ,
LabelValueLengthLimit : globLabelValueLengthLimit ,
ScrapeProtocols : DefaultGlobalConfig . ScrapeProtocols ,
ScrapeProtocols : DefaultScrapeProtocols ,
ScrapeFailureLogFile : globScrapeFailureLogFile ,
MetricNameValidationScheme : DefaultGlobalConfig . MetricNameValidationScheme ,
MetricNameEscapingScheme : DefaultGlobalConfig . MetricNameEscapingScheme ,
ScrapeNativeHistograms : boolPtr ( false ) ,
AlwaysScrapeClassicHistograms : boolPtr ( false ) ,
ConvertClassicHistogramsToNHCB : boolPtr ( false ) ,
@ -1281,10 +1304,11 @@ var expectedConf = &Config{
LabelLimit : globLabelLimit ,
LabelNameLengthLimit : globLabelNameLengthLimit ,
LabelValueLengthLimit : globLabelValueLengthLimit ,
ScrapeProtocols : DefaultGlobalConfig . ScrapeProtocols ,
ScrapeProtocols : DefaultProtoFirst ScrapeProtocols ,
ScrapeFailureLogFile : globScrapeFailureLogFile ,
MetricNameValidationScheme : DefaultGlobalConfig . MetricNameValidationScheme ,
MetricNameEscapingScheme : DefaultGlobalConfig . MetricNameEscapingScheme ,
ScrapeNativeHistograms : boolPtr ( true ) ,
AlwaysScrapeClassicHistograms : boolPtr ( false ) ,
ConvertClassicHistogramsToNHCB : boolPtr ( false ) ,
@ -1343,10 +1367,11 @@ var expectedConf = &Config{
LabelLimit : globLabelLimit ,
LabelNameLengthLimit : globLabelNameLengthLimit ,
LabelValueLengthLimit : globLabelValueLengthLimit ,
ScrapeProtocols : DefaultGlobalConfig . ScrapeProtocols ,
ScrapeProtocols : DefaultScrapeProtocols ,
ScrapeFailureLogFile : globScrapeFailureLogFile ,
MetricNameValidationScheme : DefaultGlobalConfig . MetricNameValidationScheme ,
MetricNameEscapingScheme : DefaultGlobalConfig . MetricNameEscapingScheme ,
ScrapeNativeHistograms : boolPtr ( false ) ,
AlwaysScrapeClassicHistograms : boolPtr ( false ) ,
ConvertClassicHistogramsToNHCB : boolPtr ( false ) ,
@ -1375,10 +1400,11 @@ var expectedConf = &Config{
LabelLimit : globLabelLimit ,
LabelNameLengthLimit : globLabelNameLengthLimit ,
LabelValueLengthLimit : globLabelValueLengthLimit ,
ScrapeProtocols : DefaultGlobalConfig . ScrapeProtocols ,
ScrapeProtocols : DefaultScrapeProtocols ,
ScrapeFailureLogFile : globScrapeFailureLogFile ,
MetricNameValidationScheme : DefaultGlobalConfig . MetricNameValidationScheme ,
MetricNameEscapingScheme : DefaultGlobalConfig . MetricNameEscapingScheme ,
ScrapeNativeHistograms : boolPtr ( false ) ,
AlwaysScrapeClassicHistograms : boolPtr ( false ) ,
ConvertClassicHistogramsToNHCB : boolPtr ( false ) ,
@ -1418,10 +1444,11 @@ var expectedConf = &Config{
LabelLimit : globLabelLimit ,
LabelNameLengthLimit : globLabelNameLengthLimit ,
LabelValueLengthLimit : globLabelValueLengthLimit ,
ScrapeProtocols : DefaultGlobalConfig . ScrapeProtocols ,
ScrapeProtocols : DefaultScrapeProtocols ,
ScrapeFailureLogFile : globScrapeFailureLogFile ,
MetricNameValidationScheme : DefaultGlobalConfig . MetricNameValidationScheme ,
MetricNameEscapingScheme : DefaultGlobalConfig . MetricNameEscapingScheme ,
ScrapeNativeHistograms : boolPtr ( false ) ,
AlwaysScrapeClassicHistograms : boolPtr ( false ) ,
ConvertClassicHistogramsToNHCB : boolPtr ( false ) ,
@ -1467,10 +1494,11 @@ var expectedConf = &Config{
LabelLimit : globLabelLimit ,
LabelNameLengthLimit : globLabelNameLengthLimit ,
LabelValueLengthLimit : globLabelValueLengthLimit ,
ScrapeProtocols : DefaultGlobalConfig . ScrapeProtocols ,
ScrapeProtocols : DefaultScrapeProtocols ,
ScrapeFailureLogFile : globScrapeFailureLogFile ,
MetricNameValidationScheme : DefaultGlobalConfig . MetricNameValidationScheme ,
MetricNameEscapingScheme : DefaultGlobalConfig . MetricNameEscapingScheme ,
ScrapeNativeHistograms : boolPtr ( false ) ,
AlwaysScrapeClassicHistograms : boolPtr ( false ) ,
ConvertClassicHistogramsToNHCB : boolPtr ( false ) ,
@ -1506,10 +1534,11 @@ var expectedConf = &Config{
LabelLimit : globLabelLimit ,
LabelNameLengthLimit : globLabelNameLengthLimit ,
LabelValueLengthLimit : globLabelValueLengthLimit ,
ScrapeProtocols : DefaultGlobalConfig . ScrapeProtocols ,
ScrapeProtocols : DefaultScrapeProtocols ,
ScrapeFailureLogFile : globScrapeFailureLogFile ,
MetricNameValidationScheme : DefaultGlobalConfig . MetricNameValidationScheme ,
MetricNameEscapingScheme : DefaultGlobalConfig . MetricNameEscapingScheme ,
ScrapeNativeHistograms : boolPtr ( false ) ,
AlwaysScrapeClassicHistograms : boolPtr ( false ) ,
ConvertClassicHistogramsToNHCB : boolPtr ( false ) ,
@ -1546,10 +1575,11 @@ var expectedConf = &Config{
LabelLimit : globLabelLimit ,
LabelNameLengthLimit : globLabelNameLengthLimit ,
LabelValueLengthLimit : globLabelValueLengthLimit ,
ScrapeProtocols : DefaultGlobalConfig . ScrapeProtocols ,
ScrapeProtocols : DefaultScrapeProtocols ,
ScrapeFailureLogFile : globScrapeFailureLogFile ,
MetricNameValidationScheme : DefaultGlobalConfig . MetricNameValidationScheme ,
MetricNameEscapingScheme : DefaultGlobalConfig . MetricNameEscapingScheme ,
ScrapeNativeHistograms : boolPtr ( false ) ,
AlwaysScrapeClassicHistograms : boolPtr ( false ) ,
ConvertClassicHistogramsToNHCB : boolPtr ( false ) ,
@ -1581,10 +1611,11 @@ var expectedConf = &Config{
LabelLimit : globLabelLimit ,
LabelNameLengthLimit : globLabelNameLengthLimit ,
LabelValueLengthLimit : globLabelValueLengthLimit ,
ScrapeProtocols : DefaultGlobalConfig . ScrapeProtocols ,
ScrapeProtocols : DefaultScrapeProtocols ,
ScrapeFailureLogFile : globScrapeFailureLogFile ,
MetricNameValidationScheme : DefaultGlobalConfig . MetricNameValidationScheme ,
MetricNameEscapingScheme : DefaultGlobalConfig . MetricNameEscapingScheme ,
ScrapeNativeHistograms : boolPtr ( false ) ,
AlwaysScrapeClassicHistograms : boolPtr ( false ) ,
ConvertClassicHistogramsToNHCB : boolPtr ( false ) ,
@ -1618,10 +1649,11 @@ var expectedConf = &Config{
LabelLimit : globLabelLimit ,
LabelNameLengthLimit : globLabelNameLengthLimit ,
LabelValueLengthLimit : globLabelValueLengthLimit ,
ScrapeProtocols : DefaultGlobalConfig . ScrapeProtocols ,
ScrapeProtocols : DefaultScrapeProtocols ,
ScrapeFailureLogFile : globScrapeFailureLogFile ,
MetricNameValidationScheme : DefaultGlobalConfig . MetricNameValidationScheme ,
MetricNameEscapingScheme : DefaultGlobalConfig . MetricNameEscapingScheme ,
ScrapeNativeHistograms : boolPtr ( false ) ,
AlwaysScrapeClassicHistograms : boolPtr ( false ) ,
ConvertClassicHistogramsToNHCB : boolPtr ( false ) ,
@ -2595,6 +2627,8 @@ type ScrapeConfigOptions struct {
JobName string
ScrapeInterval model . Duration
ScrapeTimeout model . Duration
ScrapeProtocols [ ] ScrapeProtocol // Set to DefaultScrapeProtocols by default.
ScrapeNativeHistograms bool
AlwaysScrapeClassicHistograms bool
ConvertClassicHistToNHCB bool
}
@ -2602,12 +2636,12 @@ type ScrapeConfigOptions struct {
func TestGetScrapeConfigs ( t * testing . T ) {
// Helper function to create a scrape config with the given options.
sc := func ( opts ScrapeConfigOptions ) * ScrapeConfig {
return & ScrapeConfig {
sc := ScrapeConfig {
JobName : opts . JobName ,
HonorTimestamps : true ,
ScrapeInterval : opts . ScrapeInterval ,
ScrapeTimeout : opts . ScrapeTimeout ,
ScrapeProtocols : DefaultGlobalConfig . ScrapeProtocols ,
ScrapeProtocols : opts . ScrapeProtocols ,
MetricNameValidationScheme : model . UTF8Validation ,
MetricNameEscapingScheme : model . AllowUTF8 ,
@ -2627,9 +2661,14 @@ func TestGetScrapeConfigs(t *testing.T) {
} ,
} ,
} ,
ScrapeNativeHistograms : boolPtr ( opts . ScrapeNativeHistograms ) ,
AlwaysScrapeClassicHistograms : boolPtr ( opts . AlwaysScrapeClassicHistograms ) ,
ConvertClassicHistogramsToNHCB : boolPtr ( opts . ConvertClassicHistToNHCB ) ,
}
if opts . ScrapeProtocols == nil {
sc . ScrapeProtocols = DefaultScrapeProtocols
}
return & sc
}
testCases := [ ] struct {
@ -2639,22 +2678,57 @@ func TestGetScrapeConfigs(t *testing.T) {
expectedError string
} {
{
name : "An included config file should be a valid global config." ,
configFile : "testdata/scrape_config_files.good.yml" ,
expectedResult : [ ] * ScrapeConfig { sc ( ScrapeConfigOptions { JobName : "prometheus" , ScrapeInterval : model . Duration ( 60 * time . Second ) , ScrapeTimeout : model . Duration ( 10 * time . Second ) , AlwaysScrapeClassicHistograms : false , ConvertClassicHistToNHCB : false } ) } ,
} ,
{
name : "A global config that only include a scrape config file." ,
configFile : "testdata/scrape_config_files_only.good.yml" ,
expectedResult : [ ] * ScrapeConfig { sc ( ScrapeConfigOptions { JobName : "prometheus" , ScrapeInterval : model . Duration ( 60 * time . Second ) , ScrapeTimeout : model . Duration ( 10 * time . Second ) , AlwaysScrapeClassicHistograms : false , ConvertClassicHistToNHCB : false } ) } ,
name : "An included config file should be a valid global config." ,
configFile : "testdata/scrape_config_files.good.yml" ,
expectedResult : [ ] * ScrapeConfig { sc ( ScrapeConfigOptions {
JobName : "prometheus" ,
ScrapeInterval : model . Duration ( 60 * time . Second ) ,
ScrapeTimeout : model . Duration ( 10 * time . Second ) ,
ScrapeNativeHistograms : false ,
AlwaysScrapeClassicHistograms : false ,
ConvertClassicHistToNHCB : false ,
} ) } ,
} ,
{
name : "A global config that only include a scrape config file." ,
configFile : "testdata/scrape_config_files_only.good.yml" ,
expectedResult : [ ] * ScrapeConfig { sc ( ScrapeConfigOptions {
JobName : "prometheus" ,
ScrapeInterval : model . Duration ( 60 * time . Second ) ,
ScrapeTimeout : model . Duration ( 10 * time . Second ) ,
ScrapeNativeHistograms : false ,
AlwaysScrapeClassicHistograms : false ,
ConvertClassicHistToNHCB : false ,
} ) } ,
} ,
{
name : "A global config that combine scrape config files and scrape configs." ,
configFile : "testdata/scrape_config_files_combined.good.yml" ,
expectedResult : [ ] * ScrapeConfig {
sc ( ScrapeConfigOptions { JobName : "node" , ScrapeInterval : model . Duration ( 60 * time . Second ) , ScrapeTimeout : model . Duration ( 10 * time . Second ) , AlwaysScrapeClassicHistograms : false , ConvertClassicHistToNHCB : false } ) ,
sc ( ScrapeConfigOptions { JobName : "prometheus" , ScrapeInterval : model . Duration ( 60 * time . Second ) , ScrapeTimeout : model . Duration ( 10 * time . Second ) , AlwaysScrapeClassicHistograms : false , ConvertClassicHistToNHCB : false } ) ,
sc ( ScrapeConfigOptions { JobName : "alertmanager" , ScrapeInterval : model . Duration ( 60 * time . Second ) , ScrapeTimeout : model . Duration ( 10 * time . Second ) , AlwaysScrapeClassicHistograms : false , ConvertClassicHistToNHCB : false } ) ,
sc ( ScrapeConfigOptions {
JobName : "node" ,
ScrapeInterval : model . Duration ( 60 * time . Second ) ,
ScrapeTimeout : model . Duration ( 10 * time . Second ) ,
ScrapeNativeHistograms : false ,
AlwaysScrapeClassicHistograms : false ,
ConvertClassicHistToNHCB : false ,
} ) ,
sc ( ScrapeConfigOptions {
JobName : "prometheus" ,
ScrapeInterval : model . Duration ( 60 * time . Second ) ,
ScrapeTimeout : model . Duration ( 10 * time . Second ) ,
ScrapeNativeHistograms : false ,
AlwaysScrapeClassicHistograms : false ,
ConvertClassicHistToNHCB : false ,
} ) ,
sc ( ScrapeConfigOptions {
JobName : "alertmanager" ,
ScrapeInterval : model . Duration ( 60 * time . Second ) ,
ScrapeTimeout : model . Duration ( 10 * time . Second ) ,
ScrapeNativeHistograms : false ,
AlwaysScrapeClassicHistograms : false ,
ConvertClassicHistToNHCB : false ,
} ) ,
} ,
} ,
{
@ -2667,9 +2741,10 @@ func TestGetScrapeConfigs(t *testing.T) {
HonorTimestamps : true ,
ScrapeInterval : model . Duration ( 60 * time . Second ) ,
ScrapeTimeout : DefaultGlobalConfig . ScrapeTimeout ,
ScrapeProtocols : DefaultGlobalConfig . ScrapeProtocols ,
ScrapeProtocols : DefaultScrapeProtocols ,
MetricNameValidationScheme : model . UTF8Validation ,
MetricNameEscapingScheme : model . AllowUTF8 ,
ScrapeNativeHistograms : boolPtr ( false ) ,
AlwaysScrapeClassicHistograms : boolPtr ( false ) ,
ConvertClassicHistogramsToNHCB : boolPtr ( false ) ,
@ -2704,9 +2779,10 @@ func TestGetScrapeConfigs(t *testing.T) {
HonorTimestamps : true ,
ScrapeInterval : model . Duration ( 15 * time . Second ) ,
ScrapeTimeout : DefaultGlobalConfig . ScrapeTimeout ,
ScrapeProtocols : DefaultGlobalConfig . ScrapeProtocols ,
ScrapeProtocols : DefaultScrapeProtocols ,
MetricNameValidationScheme : model . UTF8Validation ,
MetricNameEscapingScheme : model . AllowUTF8 ,
ScrapeNativeHistograms : boolPtr ( false ) ,
AlwaysScrapeClassicHistograms : boolPtr ( false ) ,
ConvertClassicHistogramsToNHCB : boolPtr ( false ) ,
@ -2791,6 +2867,36 @@ func TestGetScrapeConfigs(t *testing.T) {
configFile : "testdata/local_disable_always_scrape_classic_hist.good.yml" ,
expectedResult : [ ] * ScrapeConfig { sc ( ScrapeConfigOptions { JobName : "prometheus" , ScrapeInterval : model . Duration ( 60 * time . Second ) , ScrapeTimeout : model . Duration ( 10 * time . Second ) , AlwaysScrapeClassicHistograms : false , ConvertClassicHistToNHCB : false } ) } ,
} ,
{
name : "A global config that enables scrape native histograms" ,
configFile : "testdata/global_enable_scrape_native_hist.good.yml" ,
expectedResult : [ ] * ScrapeConfig { sc ( ScrapeConfigOptions { JobName : "prometheus" , ScrapeInterval : model . Duration ( 60 * time . Second ) , ScrapeTimeout : model . Duration ( 10 * time . Second ) , ScrapeNativeHistograms : true , ScrapeProtocols : DefaultProtoFirstScrapeProtocols } ) } ,
} ,
{
name : "A global config that enables scrape native histograms and sets scrape protocols explicitly" ,
configFile : "testdata/global_enable_scrape_native_hist_and_scrape_protocols.good.yml" ,
expectedResult : [ ] * ScrapeConfig { sc ( ScrapeConfigOptions { JobName : "prometheus" , ScrapeInterval : model . Duration ( 60 * time . Second ) , ScrapeTimeout : model . Duration ( 10 * time . Second ) , ScrapeNativeHistograms : true , ScrapeProtocols : [ ] ScrapeProtocol { PrometheusText0_0_4 } } ) } ,
} ,
{
name : "A local config that enables scrape native histograms" ,
configFile : "testdata/local_enable_scrape_native_hist.good.yml" ,
expectedResult : [ ] * ScrapeConfig { sc ( ScrapeConfigOptions { JobName : "prometheus" , ScrapeInterval : model . Duration ( 60 * time . Second ) , ScrapeTimeout : model . Duration ( 10 * time . Second ) , ScrapeNativeHistograms : true , ScrapeProtocols : DefaultProtoFirstScrapeProtocols } ) } ,
} ,
{
name : "A local config that enables scrape native histograms and sets scrape protocols explicitly" ,
configFile : "testdata/local_enable_scrape_native_hist_and_scrape_protocols.good.yml" ,
expectedResult : [ ] * ScrapeConfig { sc ( ScrapeConfigOptions { JobName : "prometheus" , ScrapeInterval : model . Duration ( 60 * time . Second ) , ScrapeTimeout : model . Duration ( 10 * time . Second ) , ScrapeNativeHistograms : true , ScrapeProtocols : [ ] ScrapeProtocol { PrometheusText0_0_4 } } ) } ,
} ,
{
name : "A global config that enables scrape native histograms and scrape config that disables it" ,
configFile : "testdata/local_disable_scrape_native_hist.good.yml" ,
expectedResult : [ ] * ScrapeConfig { sc ( ScrapeConfigOptions { JobName : "prometheus" , ScrapeInterval : model . Duration ( 60 * time . Second ) , ScrapeTimeout : model . Duration ( 10 * time . Second ) , ScrapeNativeHistograms : false , ScrapeProtocols : DefaultScrapeProtocols } ) } ,
} ,
{
name : "A global config that enables scrape native histograms and scrape protocols and scrape config that disables scrape native histograms but does not change scrape protocols" ,
configFile : "testdata/global_scrape_protocols_and_local_disable_scrape_native_hist.good.yml" ,
expectedResult : [ ] * ScrapeConfig { sc ( ScrapeConfigOptions { JobName : "prometheus" , ScrapeInterval : model . Duration ( 60 * time . Second ) , ScrapeTimeout : model . Duration ( 10 * time . Second ) , ScrapeNativeHistograms : false , ScrapeProtocols : [ ] ScrapeProtocol { PrometheusText0_0_4 } } ) } ,
} ,
}
for _ , tc := range testCases {