Skip to content

Commit 67c08be

Browse files
kamalchaturvediKamal Chaturvedi
authored and
Kamal Chaturvedi
committed
Plugged logsgzip processor to otel pipeline
1 parent 500bc87 commit 67c08be

File tree

7 files changed

+18
-1
lines changed

7 files changed

+18
-1
lines changed

internal/collector/otel_collector_plugin_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ func TestCollector_ProcessResourceUpdateTopicFails(t *testing.T) {
405405
conf.Collector.Processors.Batch = nil
406406
conf.Collector.Processors.Attribute = nil
407407
conf.Collector.Processors.Resource = nil
408+
conf.Collector.Processors.LogsGzip = nil
408409
conf.Collector.Exporters.OtlpExporters = nil
409410
conf.Collector.Exporters.PrometheusExporter = &config.PrometheusExporter{
410411
Server: &config.ServerConfig{
@@ -457,6 +458,7 @@ func TestCollector_ProcessResourceUpdateTopicFails(t *testing.T) {
457458
Batch: nil,
458459
Attribute: nil,
459460
Resource: nil,
461+
LogsGzip: nil,
460462
},
461463
collector.config.Collector.Processors)
462464
})
@@ -727,7 +729,7 @@ func TestCollector_updateTcplogReceivers(t *testing.T) {
727729
conf.Collector.Processors.Batch = nil
728730
conf.Collector.Processors.Attribute = nil
729731
conf.Collector.Processors.Resource = nil
730-
732+
conf.Collector.Processors.LogsGzip = nil
731733
collector, err := New(conf)
732734
require.NoError(t, err)
733735

internal/collector/otelcol.tmpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ processors:
143143
timeout: {{ .Processors.Batch.Timeout }}
144144
send_batch_max_size: {{ .Processors.Batch.SendBatchMaxSize }}
145145
{{- end }}
146+
{{- if ne .Processors.LogsGzip nil }}
147+
logsgzip: {}
148+
{{- end }}
146149

147150
exporters:
148151
{{- range $index, $otlpExporter := .Exporters.OtlpExporters }}
@@ -294,6 +297,9 @@ service:
294297
- resource
295298
{{- end }}
296299
{{- end }}
300+
{{- if ne .Processors.LogsGzip nil }}
301+
- logsgzip
302+
{{- end }}
297303
{{- if ne .Processors.Batch nil }}
298304
- batch
299305
{{- end }}

internal/config/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,7 @@ func resolveProcessors() Processors {
823823
SendBatchMaxSize: viperInstance.GetUint32(CollectorBatchProcessorSendBatchMaxSizeKey),
824824
Timeout: viperInstance.GetDuration(CollectorBatchProcessorTimeoutKey),
825825
},
826+
LogsGzip: &LogsGzip{},
826827
}
827828

828829
if viperInstance.IsSet(CollectorAttributeProcessorKey) {

internal/config/config_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ func TestResolveCollector(t *testing.T) {
188188
viperInstance.Set(CollectorBatchProcessorSendBatchSizeKey, expected.Processors.Batch.SendBatchSize)
189189
viperInstance.Set(CollectorBatchProcessorSendBatchMaxSizeKey, expected.Processors.Batch.SendBatchMaxSize)
190190
viperInstance.Set(CollectorBatchProcessorTimeoutKey, expected.Processors.Batch.Timeout)
191+
viperInstance.Set(CollectorLogsGzipProcessorKey, expected.Processors.LogsGzip)
191192
viperInstance.Set(CollectorExportersKey, expected.Exporters)
192193
viperInstance.Set(CollectorOtlpExportersKey, expected.Exporters.OtlpExporters)
193194
viperInstance.Set(CollectorExtensionsHealthServerHostKey, expected.Extensions.Health.Server.Host)
@@ -693,6 +694,7 @@ func getAgentConfig() *Config {
693694
SendBatchSize: DefCollectorBatchProcessorSendBatchSize,
694695
Timeout: DefCollectorBatchProcessorTimeout,
695696
},
697+
LogsGzip: &LogsGzip{},
696698
},
697699
Receivers: Receivers{
698700
OtlpReceivers: []OtlpReceiver{
@@ -856,6 +858,7 @@ func createConfig() *Config {
856858
},
857859
},
858860
},
861+
LogsGzip: &LogsGzip{},
859862
},
860863
Receivers: Receivers{
861864
OtlpReceivers: []OtlpReceiver{

internal/config/flags.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ var (
6464
CollectorBatchProcessorSendBatchSizeKey = pre(CollectorBatchProcessorKey) + "send_batch_size"
6565
CollectorBatchProcessorSendBatchMaxSizeKey = pre(CollectorBatchProcessorKey) + "send_batch_max_size"
6666
CollectorBatchProcessorTimeoutKey = pre(CollectorBatchProcessorKey) + "timeout"
67+
CollectorLogsGzipProcessorKey = pre(CollectorProcessorsKey) + "logsgzip"
6768
CollectorExtensionsKey = pre(CollectorRootKey) + "extensions"
6869
CollectorExtensionsHealthKey = pre(CollectorExtensionsKey) + "health"
6970
CollectorExtensionsHealthServerHostKey = pre(CollectorExtensionsHealthKey) + "server_host"

internal/config/testdata/nginx-agent.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ collector:
112112
- key: "test"
113113
action: "insert"
114114
value: "value"
115+
logsgzip: {}
115116
exporters:
116117
otlp:
117118
- server:

internal/config/types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ type (
153153
Attribute *Attribute `yaml:"attribute" mapstructure:"attribute"`
154154
Resource *Resource `yaml:"resource" mapstructure:"resource"`
155155
Batch *Batch `yaml:"batch" mapstructure:"batch"`
156+
LogsGzip *LogsGzip `yaml:"logsgzip" mapstructure:"logsgzip"`
156157
}
157158

158159
Attribute struct {
@@ -181,6 +182,8 @@ type (
181182
Timeout time.Duration `yaml:"timeout" mapstructure:"timeout"`
182183
}
183184

185+
LogsGzip struct{}
186+
184187
// OTel Collector Receiver configuration.
185188
Receivers struct {
186189
ContainerMetrics *ContainerMetricsReceiver `yaml:"container_metrics" mapstructure:"container_metrics"`

0 commit comments

Comments
 (0)