Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ Main (unreleased)

- Fix issue in `loki.source.file` where scheduling files could take too long. (@kalleep)

- Fix the `prometheus.operator.*` components internal scrape manager now having a way to enable ingesting native histograms. (@dehaansa)

v1.11.3
-----------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ description: Shared content, prom operator scrape
headless: true
---

| Name | Type | Description | Default | Required |
| ------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------- | ------- | -------- |
| `default_scrape_interval` | `duration` | The default interval between scraping targets. Used as the default if the target resource doesn't provide a scrape interval. | `1m` | no |
| `default_scrape_timeout` | `duration` | The default timeout for scrape requests. Used as the default if the target resource doesn't provide a scrape timeout. | `10s` | no |
| Name | Type | Description | Default | Required |
|----------------------------|------------|------------------------------------------------------------------------------------------------------------------------------|---------|----------|
| `default_scrape_interval` | `duration` | The default interval between scraping targets. Used as the default if the target resource doesn't provide a scrape interval. | `1m` | no |
| `default_scrape_timeout` | `duration` | The default timeout for scrape requests. Used as the default if the target resource doesn't provide a scrape timeout. | `10s` | no |
| `enable_native_histograms` | `bool` | Allow the scrape manager to ingest native histograms. | `false` | no |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `enable_native_histograms` | `bool` | Allow the scrape manager to ingest native histograms. | `false` | no |
| `scrape_native_histograms` | `bool` | Allow the scrape manager to ingest native histograms. | `false` | no |

What do you think? This is what we have named this setting in prometheus.scrape

Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ func (c *crdManager) Run(ctx context.Context) error {

// Start prometheus scrape manager.
alloyAppendable := prometheus.NewFanout(c.args.ForwardTo, c.opts.ID, c.opts.Registerer, c.ls, prometheus.NoopMetadataStore{})
opts := &scrape.Options{}
opts := &scrape.Options{
EnableNativeHistogramsIngestion: c.args.Scrape.EnableNativeHistograms,
}
c.scrapeManager, err = scrape.NewManager(opts, slog.New(logging.NewSlogGoKitHandler(c.logger)), nil, alloyAppendable, unregisterer)
if err != nil {
return fmt.Errorf("creating scrape manager: %w", err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ func (cg *ConfigGenerator) generateDefaultScrapeConfig() *config.ScrapeConfig {
c.ScrapeTimeout = model.Duration(opt.DefaultScrapeTimeout)
}

if opt.EnableNativeHistograms {
c.ScrapeProtocols = config.DefaultProtoFirstScrapeProtocols
}

return &c
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -525,8 +525,9 @@ func TestGeneratePodMonitorConfig(t *testing.T) {
{TargetLabel: "__meta_foo", Replacement: "bar"},
},
ScrapeOptions: operator.ScrapeOptions{
DefaultScrapeInterval: time.Hour,
DefaultScrapeTimeout: 42 * time.Second,
DefaultScrapeInterval: time.Hour,
DefaultScrapeTimeout: 42 * time.Second,
EnableNativeHistograms: false,
},
}
cfg, err := cg.GeneratePodMonitorConfig(tc.m, tc.ep, 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,9 @@ func TestGenerateStaticScrapeConfigConfig(t *testing.T) {
{TargetLabel: "__meta_foo", Replacement: "bar"},
},
ScrapeOptions: operator.ScrapeOptions{
DefaultScrapeInterval: time.Hour,
DefaultScrapeTimeout: 42 * time.Second,
DefaultScrapeInterval: time.Hour,
DefaultScrapeTimeout: 42 * time.Second,
EnableNativeHistograms: false,
},
}
cfg, err := cg.generateStaticScrapeConfigConfig(tc.m, tc.ep, 1)
Expand Down
3 changes: 3 additions & 0 deletions internal/component/prometheus/operator/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ type ScrapeOptions struct {

// DefaultScrapeTimeout is the default timeout to scrape targets.
DefaultScrapeTimeout time.Duration `alloy:"default_scrape_timeout,attr,optional"`

// EnableNativeHistograms enables scraping of Prometheus native histograms.
EnableNativeHistograms bool `alloy:"enable_native_histograms,attr,optional"`
}

func (s *ScrapeOptions) GlobalConfig() promconfig.GlobalConfig {
Expand Down
Loading