Skip to content

Commit

Permalink
Clean up from PR
Browse files Browse the repository at this point in the history
  • Loading branch information
mattdurham committed Nov 28, 2023
1 parent 7b73088 commit a042d21
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,13 @@ 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)
// max_cache_size doesnt exist in static, and we need to manually set it to default.
// Else since the go default value will be 0, the IsZero is also 0, so it will assume it should be 0 when comparing
// in appendblock. The check against the default value of 10_000 ensures it will always be written as 0.
args.MaxCacheSize = 10_000
s.f.Body().AppendBlock(common.NewBlockWithOverride([]string{"loki", "relabel"}, compLabel, args))
s.lokiRelabelReceiverExpr = "[loki.relabel." + compLabel + ".receiver]"
}
Expand Down

0 comments on commit a042d21

Please sign in to comment.