Fix small issues and clarify documentation

Signed-off-by: chardch <otwordsne@gmail.com>
This commit is contained in:
chardch 2025-03-27 09:55:32 -07:00
parent 2f59d38054
commit 357b5ed640
3 changed files with 8 additions and 8 deletions

View File

@ -900,8 +900,8 @@ func (c *ScrapeConfig) Validate(globalConfig GlobalConfig) error {
}
if c.ConvertClassicHistogramsToNHCB == nil {
globalVal := &globalConfig.ConvertClassicHistogramsToNHCB
c.ConvertClassicHistogramsToNHCB = globalVal
global := globalConfig.ConvertClassicHistogramsToNHCB
c.ConvertClassicHistogramsToNHCB = &global
}
return nil
@ -926,7 +926,7 @@ func ToValidationScheme(s string) (validationScheme model.ValidationScheme, err
return validationScheme, nil
}
// ConvertClassicHistogramsToNHCBEnabled returns whether to convert classic histograms to NHCB
// ConvertClassicHistogramsToNHCBEnabled returns whether to convert classic histograms to NHCB.
func (c *ScrapeConfig) ConvertClassicHistogramsToNHCBEnabled() bool {
return c.ConvertClassicHistogramsToNHCB != nil && *c.ConvertClassicHistogramsToNHCB
}

View File

@ -536,10 +536,10 @@ metric_relabel_configs:
# schema 8, but might change in the future).
[ native_histogram_min_bucket_factor: <float> | default = 0 ]
# Specifies whether to convert scraped classic histograms from this into
# native histogram with custom buckets.
[ convert_classic_histograms_to_nhcb <bool> | default = false
or global.convert_classic_histograms_to_nhcb if unset]
# Specifies whether to convert classic histograms into native histograms with
# custom buckets (has no effect without --enable-feature=native-histograms).
[ convert_classic_histograms_to_nhcb <bool> | default =
<global.convert_classic_histograms_to_nhcb>]
```
Where `<job_name>` must be unique across all scrape configurations.

View File

@ -523,7 +523,7 @@ func (sp *scrapePool) sync(targets []*Target) {
mrc = sp.config.MetricRelabelConfigs
fallbackScrapeProtocol = sp.config.ScrapeFallbackProtocol.HeaderMediaType()
alwaysScrapeClassicHist = sp.config.AlwaysScrapeClassicHistograms
convertClassicHistToNHCB = sp.config.ConvertClassicHistogramsToNHCB != nil && *sp.config.ConvertClassicHistogramsToNHCB
convertClassicHistToNHCB = sp.config.ConvertClassicHistogramsToNHCBEnabled()
)
sp.targetMtx.Lock()