Skip to content

Commit

Permalink
max_cache_size was being set to 0 (grafana#5869)
Browse files Browse the repository at this point in the history
* max_cache_size was being set to 0, due to issue where it doesnt exist in static but the default wasnt carrying over to river syntax. In truth we should never write it.

* Clean up from PR

(cherry picked from commit 356c50c)
  • Loading branch information
mattdurham authored and rfratto committed Nov 30, 2023
1 parent c241445 commit b9232e7
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ v0.38.0 (2023-11-21)
- Fix converter output for prometheus.exporter.windows to not unnecessarily add
empty blocks. (@erikbaranowski)

- Fix converter issue with `loki.relabel` and `max_cache_size` being set to 0 instead of default (10_000). (@mattdurham)

### Other changes

- Bump `mysqld_exporter` version to v0.15.0. (@marctc)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ func (s *ScrapeConfigBuilder) getOrNewLokiRelabel() string {
args := lokirelabel.Arguments{
ForwardTo: s.getOrNewProcessStageReceivers(),
RelabelConfigs: component.ToFlowRelabelConfigs(s.cfg.RelabelConfigs),
// max_cache_size doesnt exist in static, and we need to manually set it to default.
// Since the default is 10_000 if we didnt set the value, it would compare the default 10k to 0 and emit 0.
// We actually dont want to emit anything since this setting doesnt exist in static, setting to 10k matches the default
// and ensures it doesnt get emitted.
MaxCacheSize: lokirelabel.DefaultArguments.MaxCacheSize,
}
compLabel := common.LabelForParts(s.globalCtx.LabelPrefix, s.cfg.JobName)
s.f.Body().AppendBlock(common.NewBlockWithOverride([]string{"loki", "relabel"}, compLabel, args))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ loki.relabel "fun" {
source_labels = ["__trail__"]
target_label = "__path__"
}
max_cache_size = 0
}

loki.source.cloudflare "fun" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ loki.relabel "fun" {
source_labels = ["__trail__"]
target_label = "__path__"
}
max_cache_size = 0
}

loki.source.windowsevent "fun" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ loki.relabel "logs_log_config_fun" {
source_labels = ["__trail__"]
target_label = "__path__"
}
max_cache_size = 0
}

loki.source.cloudflare "logs_log_config_fun" {
Expand Down
2 changes: 0 additions & 2 deletions converter/internal/staticconvert/testdata/sanitize.river
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ loki.relabel "logs_integrations_integrations_windows_exporter_application" {
source_labels = ["computer"]
target_label = "agent_hostname"
}
max_cache_size = 0
}

loki.source.windowsevent "logs_integrations_integrations_windows_exporter_application" {
Expand Down Expand Up @@ -75,7 +74,6 @@ loki.relabel "logs_integrations_integrations_windows_exporter_system" {
source_labels = ["computer"]
target_label = "agent_hostname"
}
max_cache_size = 0
}

loki.source.windowsevent "logs_integrations_integrations_windows_exporter_system" {
Expand Down

0 comments on commit b9232e7

Please sign in to comment.