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 { if c.ConvertClassicHistogramsToNHCB == nil {
globalVal := &globalConfig.ConvertClassicHistogramsToNHCB global := globalConfig.ConvertClassicHistogramsToNHCB
c.ConvertClassicHistogramsToNHCB = globalVal c.ConvertClassicHistogramsToNHCB = &global
} }
return nil return nil
@ -926,7 +926,7 @@ func ToValidationScheme(s string) (validationScheme model.ValidationScheme, err
return validationScheme, nil 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 { func (c *ScrapeConfig) ConvertClassicHistogramsToNHCBEnabled() bool {
return c.ConvertClassicHistogramsToNHCB != nil && *c.ConvertClassicHistogramsToNHCB return c.ConvertClassicHistogramsToNHCB != nil && *c.ConvertClassicHistogramsToNHCB
} }

View File

@ -536,10 +536,10 @@ metric_relabel_configs:
# schema 8, but might change in the future). # schema 8, but might change in the future).
[ native_histogram_min_bucket_factor: <float> | default = 0 ] [ native_histogram_min_bucket_factor: <float> | default = 0 ]
# Specifies whether to convert scraped classic histograms from this into # Specifies whether to convert classic histograms into native histograms with
# native histogram with custom buckets. # custom buckets (has no effect without --enable-feature=native-histograms).
[ convert_classic_histograms_to_nhcb <bool> | default = false [ convert_classic_histograms_to_nhcb <bool> | default =
or global.convert_classic_histograms_to_nhcb if unset] <global.convert_classic_histograms_to_nhcb>]
``` ```
Where `<job_name>` must be unique across all scrape configurations. 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 mrc = sp.config.MetricRelabelConfigs
fallbackScrapeProtocol = sp.config.ScrapeFallbackProtocol.HeaderMediaType() fallbackScrapeProtocol = sp.config.ScrapeFallbackProtocol.HeaderMediaType()
alwaysScrapeClassicHist = sp.config.AlwaysScrapeClassicHistograms alwaysScrapeClassicHist = sp.config.AlwaysScrapeClassicHistograms
convertClassicHistToNHCB = sp.config.ConvertClassicHistogramsToNHCB != nil && *sp.config.ConvertClassicHistogramsToNHCB convertClassicHistToNHCB = sp.config.ConvertClassicHistogramsToNHCBEnabled()
) )
sp.targetMtx.Lock() sp.targetMtx.Lock()