From 497913ec8ea443810c2c7d8e37c179dad66a32c0 Mon Sep 17 00:00:00 2001 From: Michael Vitz Date: Fri, 24 Jul 2026 12:59:16 +0200 Subject: [PATCH] feat: add batch_size support to opentelemetry output plugin Signed-off-by: Michael Vitz --- .../v1alpha2/plugins/output/open_telemetry_types.go | 4 ++++ .../plugins/output/open_telemetry_types_test.go | 2 ++ .../v1alpha2/plugins/output/zz_generated.deepcopy.go | 5 +++++ .../fluentbit.fluent.io_clusteroutputs.yaml | 6 ++++++ .../templates/fluentbit.fluent.io_outputs.yaml | 6 ++++++ .../crds/fluentbit.fluent.io_clusteroutputs.yaml | 6 ++++++ .../crds/fluentbit.fluent.io_outputs.yaml | 6 ++++++ .../bases/fluentbit.fluent.io_clusteroutputs.yaml | 6 ++++++ config/crd/bases/fluentbit.fluent.io_outputs.yaml | 6 ++++++ docs/plugins/fluentbit/output/open_telemetry.md | 1 + manifests/setup/setup.yaml | 12 ++++++++++++ 11 files changed, 60 insertions(+) diff --git a/apis/fluentbit/v1alpha2/plugins/output/open_telemetry_types.go b/apis/fluentbit/v1alpha2/plugins/output/open_telemetry_types.go index 5d13907f4..92e34c538 100644 --- a/apis/fluentbit/v1alpha2/plugins/output/open_telemetry_types.go +++ b/apis/fluentbit/v1alpha2/plugins/output/open_telemetry_types.go @@ -46,6 +46,9 @@ type OpenTelemetry struct { *plugins.Networking `json:"networking,omitempty"` // Limit the maximum number of Chunks in the filesystem for the current output logical destination. TotalLimitSize string `json:"totalLimitSize,omitempty"` + // Set the maximum number of log records to be flushed at a time. + // +kubebuilder:validation:Minimum:=0 + BatchSize *int32 `json:"batchSize,omitempty"` } // Name implement Section() method @@ -101,6 +104,7 @@ func (o *OpenTelemetry) Params(sl plugins.SecretLoader) (*params.KVs, error) { } plugins.InsertKVString(kvs, "storage.total_limit_size", o.TotalLimitSize) + plugins.InsertKVField(kvs, "batch_size", o.BatchSize) return kvs, nil } diff --git a/apis/fluentbit/v1alpha2/plugins/output/open_telemetry_types_test.go b/apis/fluentbit/v1alpha2/plugins/output/open_telemetry_types_test.go index f90ac9711..518753ff1 100644 --- a/apis/fluentbit/v1alpha2/plugins/output/open_telemetry_types_test.go +++ b/apis/fluentbit/v1alpha2/plugins/output/open_telemetry_types_test.go @@ -40,6 +40,7 @@ func TestOpenTelemetry_Params(t *testing.T) { LogsBodyKey: "expected_logs_body_key", TLS: &plugins.TLS{Verify: utils.ToPtr(false)}, Networking: &plugins.Networking{SourceAddress: utils.ToPtr("expected_source_address")}, + BatchSize: utils.ToPtr[int32](512), } expected := params.NewKVs() @@ -59,6 +60,7 @@ func TestOpenTelemetry_Params(t *testing.T) { expected.Insert("tls", "On") expected.Insert("tls.verify", "false") expected.Insert("net.source_address", "expected_source_address") + expected.Insert("batch_size", "512") kvs, err := ot.Params(sl) g.Expect(err).NotTo(HaveOccurred()) diff --git a/apis/fluentbit/v1alpha2/plugins/output/zz_generated.deepcopy.go b/apis/fluentbit/v1alpha2/plugins/output/zz_generated.deepcopy.go index e748af620..81c81ac35 100644 --- a/apis/fluentbit/v1alpha2/plugins/output/zz_generated.deepcopy.go +++ b/apis/fluentbit/v1alpha2/plugins/output/zz_generated.deepcopy.go @@ -852,6 +852,11 @@ func (in *OpenTelemetry) DeepCopyInto(out *OpenTelemetry) { *out = new(plugins.Networking) (*in).DeepCopyInto(*out) } + if in.BatchSize != nil { + in, out := &in.BatchSize, &out.BatchSize + *out = new(int32) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpenTelemetry. diff --git a/charts/fluent-operator-fluent-bit-crds/templates/fluentbit.fluent.io_clusteroutputs.yaml b/charts/fluent-operator-fluent-bit-crds/templates/fluentbit.fluent.io_clusteroutputs.yaml index c82289587..97b1f2b7f 100644 --- a/charts/fluent-operator-fluent-bit-crds/templates/fluentbit.fluent.io_clusteroutputs.yaml +++ b/charts/fluent-operator-fluent-bit-crds/templates/fluentbit.fluent.io_clusteroutputs.yaml @@ -3176,6 +3176,12 @@ spec: exposed through the OpenTelemetry exporter. You may have multiple of these fields. type: object + batchSize: + description: Set the maximum number of log records to be flushed + at a time. + format: int32 + minimum: 0 + type: integer header: additionalProperties: type: string diff --git a/charts/fluent-operator-fluent-bit-crds/templates/fluentbit.fluent.io_outputs.yaml b/charts/fluent-operator-fluent-bit-crds/templates/fluentbit.fluent.io_outputs.yaml index 5131cd21a..abac9a4c1 100644 --- a/charts/fluent-operator-fluent-bit-crds/templates/fluentbit.fluent.io_outputs.yaml +++ b/charts/fluent-operator-fluent-bit-crds/templates/fluentbit.fluent.io_outputs.yaml @@ -3176,6 +3176,12 @@ spec: exposed through the OpenTelemetry exporter. You may have multiple of these fields. type: object + batchSize: + description: Set the maximum number of log records to be flushed + at a time. + format: int32 + minimum: 0 + type: integer header: additionalProperties: type: string diff --git a/charts/fluent-operator/crds/fluentbit.fluent.io_clusteroutputs.yaml b/charts/fluent-operator/crds/fluentbit.fluent.io_clusteroutputs.yaml index 8a3e9f4f8..824bbaa0e 100644 --- a/charts/fluent-operator/crds/fluentbit.fluent.io_clusteroutputs.yaml +++ b/charts/fluent-operator/crds/fluentbit.fluent.io_clusteroutputs.yaml @@ -3174,6 +3174,12 @@ spec: exposed through the OpenTelemetry exporter. You may have multiple of these fields. type: object + batchSize: + description: Set the maximum number of log records to be flushed + at a time. + format: int32 + minimum: 0 + type: integer header: additionalProperties: type: string diff --git a/charts/fluent-operator/crds/fluentbit.fluent.io_outputs.yaml b/charts/fluent-operator/crds/fluentbit.fluent.io_outputs.yaml index 01d666ef8..4cbf806ab 100644 --- a/charts/fluent-operator/crds/fluentbit.fluent.io_outputs.yaml +++ b/charts/fluent-operator/crds/fluentbit.fluent.io_outputs.yaml @@ -3174,6 +3174,12 @@ spec: exposed through the OpenTelemetry exporter. You may have multiple of these fields. type: object + batchSize: + description: Set the maximum number of log records to be flushed + at a time. + format: int32 + minimum: 0 + type: integer header: additionalProperties: type: string diff --git a/config/crd/bases/fluentbit.fluent.io_clusteroutputs.yaml b/config/crd/bases/fluentbit.fluent.io_clusteroutputs.yaml index df9acd574..a95b10538 100644 --- a/config/crd/bases/fluentbit.fluent.io_clusteroutputs.yaml +++ b/config/crd/bases/fluentbit.fluent.io_clusteroutputs.yaml @@ -3175,6 +3175,12 @@ spec: exposed through the OpenTelemetry exporter. You may have multiple of these fields. type: object + batchSize: + description: Set the maximum number of log records to be flushed + at a time. + format: int32 + minimum: 0 + type: integer header: additionalProperties: type: string diff --git a/config/crd/bases/fluentbit.fluent.io_outputs.yaml b/config/crd/bases/fluentbit.fluent.io_outputs.yaml index b5b6ca833..440d8fbed 100644 --- a/config/crd/bases/fluentbit.fluent.io_outputs.yaml +++ b/config/crd/bases/fluentbit.fluent.io_outputs.yaml @@ -3175,6 +3175,12 @@ spec: exposed through the OpenTelemetry exporter. You may have multiple of these fields. type: object + batchSize: + description: Set the maximum number of log records to be flushed + at a time. + format: int32 + minimum: 0 + type: integer header: additionalProperties: type: string diff --git a/docs/plugins/fluentbit/output/open_telemetry.md b/docs/plugins/fluentbit/output/open_telemetry.md index 1752d760e..416748687 100644 --- a/docs/plugins/fluentbit/output/open_telemetry.md +++ b/docs/plugins/fluentbit/output/open_telemetry.md @@ -21,3 +21,4 @@ The OpenTelemetry plugin allows you to take logs, metrics, and traces from Fluen | tls | | *[plugins.TLS](../tls.md) | | networking | Include fluentbit networking options for this output-plugin | *[plugins.Networking](../net.md) | | totalLimitSize | Limit the maximum number of Chunks in the filesystem for the current output logical destination. | string | +| batchSize | Set the maximum number of log records to be flushed at a time. | *int32 | diff --git a/manifests/setup/setup.yaml b/manifests/setup/setup.yaml index 5ce672971..159f0b1a2 100644 --- a/manifests/setup/setup.yaml +++ b/manifests/setup/setup.yaml @@ -7375,6 +7375,12 @@ spec: exposed through the OpenTelemetry exporter. You may have multiple of these fields. type: object + batchSize: + description: Set the maximum number of log records to be flushed + at a time. + format: int32 + minimum: 0 + type: integer header: additionalProperties: type: string @@ -38051,6 +38057,12 @@ spec: exposed through the OpenTelemetry exporter. You may have multiple of these fields. type: object + batchSize: + description: Set the maximum number of log records to be flushed + at a time. + format: int32 + minimum: 0 + type: integer header: additionalProperties: type: string