Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -38,6 +38,8 @@ Main (unreleased)
- (_Public Preview_) Additions to `database_observability.mysql` component:
- replace the internal `server_id` label attribution in favor of a hash composed from `@@server_uuid` and `@@hostname`

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

v1.12.0
-----------------

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 |
| `scrape_native_histograms` | `bool` | Allow the scrape manager to ingest native histograms. | `false` | no |
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,10 @@ 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)
opts := &scrape.Options{}

opts := &scrape.Options{
EnableNativeHistogramsIngestion: c.args.Scrape.ScrapeNativeHistograms,
}
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.ScrapeNativeHistograms {
c.ScrapeProtocols = config.DefaultProtoFirstScrapeProtocols
}

return &c
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -529,8 +529,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,
ScrapeNativeHistograms: 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,
ScrapeNativeHistograms: 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"`

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

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