Skip to content

Commit

Permalink
Allow specifying wal truncate frequencies per integration (#403)
Browse files Browse the repository at this point in the history
* allow specifying wal truncate frequencies per integration

* rebase and fix default time in docs
  • Loading branch information
rfratto authored Feb 17, 2021
1 parent 23f037c commit 16ba76f
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ can be found at [#317](https://github.com/grafana/agent/issues/317).

- [ENHANCEMENT] Support other architectures in installation script. (@rfratto)

- [ENHANCEMENT] Allow specifying custom wal_truncate_frequency per integration.
(@rfratto)

- [BUGFIX] Not providing an `-addr` flag for `agentctl config-sync` will no
longer report an error and will instead use the pre-existing default value.
(@rfratto)
Expand Down
33 changes: 33 additions & 0 deletions docs/configuration-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2016,6 +2016,9 @@ agent:
# prometheus.global.scrape_timeout.
[scrape_timeout: <duration> | default = <global_config.scrape_timeout>]
# How frequent to truncate the WAL for this integration.
[wal_truncate_frequency: <duration> | default = "60m"]
# Allows for relabeling labels on the target.
relabel_configs:
[- <relabel_config> ... ]
Expand Down Expand Up @@ -2286,6 +2289,9 @@ the Agent is running on is a no-op.
metric_relabel_configs:
[ - <relabel_config> ... ]
# How frequent to truncate the WAL for this integration.
[wal_truncate_frequency: <duration> | default = "60m"]
# Monitor the exporter itself and include those metrics in the results.
[include_exporter_metrics: <boolean> | default = false]
Expand Down Expand Up @@ -2500,6 +2506,9 @@ Full reference of options:
metric_relabel_configs:
[ - <relabel_config> ... ]
# How frequent to truncate the WAL for this integration.
[wal_truncate_frequency: <duration> | default = "60m"]
# procfs mountpoint.
[procfs_path: <string> | default = "/proc"]
Expand Down Expand Up @@ -2623,6 +2632,9 @@ Full reference of options:
metric_relabel_configs:
[ - <relabel_config> ... ]
# How frequent to truncate the WAL for this integration.
[wal_truncate_frequency: <duration> | default = "60m"]
# Data Source Name specifies the MySQL server to connect to. This is REQUIRED
# but may also be specified by the MYSQLD_EXPORTER_DATA_SOURCE_NAME
# environment variable. If neither are set, the integration will fail to
Expand Down Expand Up @@ -2764,6 +2776,9 @@ Full reference of options:
metric_relabel_configs:
[ - <relabel_config> ... ]
# How frequent to truncate the WAL for this integration.
[wal_truncate_frequency: <duration> | default = "60m"]
# Monitor the exporter itself and include those metrics in the results.
[include_exporter_metrics: <bool> | default = false]
Expand Down Expand Up @@ -2909,6 +2924,9 @@ Full reference of options:
metric_relabel_configs:
[ - <relabel_config> ... ]
# How frequent to truncate the WAL for this integration.
[wal_truncate_frequency: <duration> | default = "60m"]
# Monitor the exporter itself and include those metrics in the results.
[include_exporter_metrics: <bool> | default = false]
Expand Down Expand Up @@ -2965,6 +2983,9 @@ Full reference of options:
metric_relabel_configs:
[ - <relabel_config> ... ]
# How frequent to truncate the WAL for this integration.
[wal_truncate_frequency: <duration> | default = "60m"]
# Monitor the exporter itself and include those metrics in the results.
[include_exporter_metrics: <bool> | default = false]
Expand Down Expand Up @@ -3068,6 +3089,9 @@ Full reference of options:
metric_relabel_configs:
[ - <relabel_config> ... ]
# How frequent to truncate the WAL for this integration.
[wal_truncate_frequency: <duration> | default = "60m"]
# Monitor the exporter itself and include those metrics in the results.
[include_exporter_metrics: <bool> | default = false]
Expand Down Expand Up @@ -3120,6 +3144,9 @@ Full reference of options:
metric_relabel_configs:
[ - <relabel_config> ... ]
# How frequent to truncate the WAL for this integration.
[wal_truncate_frequency: <duration> | default = "60m"]
# Monitor the exporter itself and include those metrics in the results.
[include_exporter_metrics: <bool> | default = false]
Expand Down Expand Up @@ -3193,6 +3220,9 @@ Full reference of options:
metric_relabel_configs:
[ - <relabel_config> ... ]
# How frequent to truncate the WAL for this integration.
[wal_truncate_frequency: <duration> | default = "60m"]
# Monitor the exporter itself and include those metrics in the results.
[include_exporter_metrics: <bool> | default = false]
Expand Down Expand Up @@ -3296,6 +3326,9 @@ Full reference of options:
metric_relabel_configs:
[ - <relabel_config> ... ]
# How frequent to truncate the WAL for this integration.
[wal_truncate_frequency: <duration> | default = "60m"]
# Monitor the exporter itself and include those metrics in the results.
[include_exporter_metrics: <bool> | default = false]
Expand Down
1 change: 1 addition & 0 deletions pkg/integrations/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type Common struct {
ScrapeTimeout time.Duration `yaml:"scrape_timeout"`
RelabelConfigs []*relabel.Config `yaml:"relabel_configs,omitempty"`
MetricRelabelConfigs []*relabel.Config `yaml:"metric_relabel_configs,omitempty"`
WALTruncateFrequency time.Duration `yaml:"wal_truncate_frequency"`
}

// ScrapeConfig is a subset of options used by integrations to inform how samples
Expand Down
5 changes: 4 additions & 1 deletion pkg/integrations/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func (m *Manager) runIntegration(ctx context.Context, cfg Config, i Integration)
// Apply the config so an instance is launched to scrape our integration.
instanceConfig := m.instanceConfigForIntegration(cfg, i)
if err := m.im.ApplyConfig(instanceConfig); err != nil {
level.Error(m.logger).Log("msg", "failed to apply integration. integration will not run. THIS IS A BUG!", "err", err, "integration", cfg.Name())
level.Error(m.logger).Log("msg", "failed to apply integration. integration will not run", "err", err, "integration", cfg.Name())
return
}
}
Expand Down Expand Up @@ -252,6 +252,9 @@ func (m *Manager) instanceConfigForIntegration(cfg Config, i Integration) instan
instanceCfg.Name = prometheusName
instanceCfg.ScrapeConfigs = scrapeConfigs
instanceCfg.RemoteWrite = m.c.PrometheusRemoteWrite
if common.WALTruncateFrequency > 0 {
instanceCfg.WALTruncateFrequency = common.WALTruncateFrequency
}
return instanceCfg
}

Expand Down

0 comments on commit 16ba76f

Please sign in to comment.