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
  • Loading branch information
mattdurham authored Nov 28, 2023
1 parent 7f8bb76 commit 356c50c
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
@@ -209,6 +209,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)
Original file line number Diff line number Diff line change
@@ -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))
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@ loki.relabel "fun" {
source_labels = ["__trail__"]
target_label = "__path__"
}
max_cache_size = 0
}

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

loki.source.windowsevent "fun" {
Original file line number Diff line number Diff line change
@@ -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" {
2 changes: 0 additions & 2 deletions converter/internal/staticconvert/testdata/sanitize.river
Original file line number Diff line number Diff line change
@@ -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" {
@@ -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" {

0 comments on commit 356c50c

Please sign in to comment.