Skip to content

Commit

Permalink
fix default yaml values for otelcol prometheus exporter converter
Browse files Browse the repository at this point in the history
  • Loading branch information
wildum committed Dec 13, 2024
1 parent 1e769d5 commit fb283ef
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,13 @@ func toremotewriteexporterConfig(cfg *remotewriteexporter.Config, forwardTo []st
defaultArgs := &prometheus.Arguments{}
defaultArgs.SetToDefault()

args := &prometheus.Arguments{
return &prometheus.Arguments{
IncludeTargetInfo: defaultArgs.IncludeTargetInfo,
IncludeScopeInfo: defaultArgs.IncludeScopeInfo,
IncludeScopeLabels: defaultArgs.IncludeScopeLabels,
GCFrequency: defaultArgs.GCFrequency,
GCFrequency: cfg.StaleTime,
ForwardTo: forwardTo,
AddMetricSuffixes: defaultArgs.AddMetricSuffixes,
ResourceToTelemetryConversion: defaultArgs.ResourceToTelemetryConversion,
}

// Override default only if > 0 because GCFrequency of 0 is not allowed
if cfg.StaleTime > 0 {
args.GCFrequency = cfg.StaleTime
}

return args
}
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ prometheus.relabel "_0_default" {
}

otelcol.exporter.prometheus "_0_default" {
forward_to = [prometheus.relabel._0_default.receiver]
gc_frequency = "15m0s"
forward_to = [prometheus.relabel._0_default.receiver]
}

otelcol.exporter.loadbalancing "_0_default" {
Expand Down Expand Up @@ -199,7 +200,8 @@ prometheus.relabel "_1_default" {
}

otelcol.exporter.prometheus "_1_default" {
forward_to = [prometheus.relabel._1_default.receiver]
gc_frequency = "15m0s"
forward_to = [prometheus.relabel._1_default.receiver]
}

otelcol.exporter.otlp "_1_0" {
Expand Down
5 changes: 4 additions & 1 deletion internal/static/traces/remotewriteexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ func NewFactory() exporter.Factory {
}

func createDefaultConfig() component.Config {
return &Config{}
return &Config{
StaleTime: 15 * time.Minute,
LoopInterval: time.Second,
}
}

func createMetricsExporter(
Expand Down

0 comments on commit fb283ef

Please sign in to comment.