Skip to content

Commit

Permalink
vmscrapeconfig: support max_scrape_size option
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewChubatiuk authored and f41gh7 committed Jul 18, 2024
1 parent d3a0fa8 commit dfbb6b1
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/operator/v1beta1/vmscrapeconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ type VMScrapeConfigSpec struct {
// ScrapeTimeout is the number of seconds to wait until a scrape request times out.
// +optional
ScrapeTimeout string `json:"scrapeTimeout,omitempty"`
// MaxScrapeSize defines a maximum size of scraped data for a job
// +optional
MaxScrapeSize string `json:"max_scrape_size,omitempty"`
// HonorTimestamps controls whether to respect the timestamps present in scraped data.
// +optional
HonorTimestamps *bool `json:"honorTimestamps,omitempty"`
Expand Down
4 changes: 4 additions & 0 deletions config/crd/overlay/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22548,6 +22548,10 @@ spec:
- role
type: object
type: array
max_scrape_size:
description: MaxScrapeSize defines a maximum size of scraped data
for a job
type: string
metricRelabelConfigs:
description: MetricRelabelConfigs to apply to samples after scrapping.
items:
Expand Down
2 changes: 2 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ aliases:
- [operator](./README.md): fix VM CRs' `xxNamespaceSelector` and `xxSelector` options, previously they are inverted. See this [issue](https://github.com/VictoriaMetrics/operator/issues/980) for details.
- [vmnodescrape](./api.md#vmnodescrape): remove duplicated `series_limit` and `sample_limit` fields in generated scrape_config. See [this issue](https://github.com/VictoriaMetrics/operator/issues/986).

- [vmscrapeconfig](./api.md#vmscrapeconfig) - added `max_scrape_size` parameter for scrape protocols configuration

<a name="v0.45.0"></a>

## [v0.45.0](https://github.com/VictoriaMetrics/operator/releases/tag/v0.45.0) - 10 Jun 2024
Expand Down
3 changes: 3 additions & 0 deletions internal/controller/operator/factory/vmagent/scrapeconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ func generateScrapeConfig(
if sc.Spec.SeriesLimit > 0 {
cfg = append(cfg, yaml.MapItem{Key: "series_limit", Value: sc.Spec.SeriesLimit})
}
if sc.Spec.MaxScrapeSize != "" {
cfg = append(cfg, yaml.MapItem{Key: "max_scrape_size", Value: sc.Spec.MaxScrapeSize})
}

var relabelings []yaml.MapSlice
for _, c := range sc.Spec.RelabelConfigs {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func TestGenerateScrapeConfig(t *testing.T) {
Namespace: "default",
},
Spec: vmv1beta1.VMScrapeConfigSpec{
MaxScrapeSize: "60KB",
ScrapeInterval: "10s",
StaticConfigs: []vmv1beta1.StaticConfig{
{
Expand Down Expand Up @@ -68,6 +69,7 @@ scrape_interval: 30s
basic_auth:
username: admin
password: dangerous
max_scrape_size: 60KB
relabel_configs: []
static_configs:
- targets:
Expand Down

0 comments on commit dfbb6b1

Please sign in to comment.