Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/compute-plane-services/byoo-otel-collector/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.157.0
0.157.1
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ type OpenTelemetryConfig struct {
const (
defaultLogChunkMaxPayloadBytes = 262144
minConfiguredLogChunkMaxPayloadBytes = 4
defaultLogExporterBatchFlushTimeout = "200ms"
// Leave 100 KB below the 1 MB receiver limit for the export envelope.
defaultLogExporterBatchSizeBytes = int64(900_000)
)

const (
Expand Down Expand Up @@ -267,6 +270,18 @@ func logExporterSendingQueue() map[string]interface{} {
}
}

func enableChunkedLogExporterBatching(otelConfig *OpenTelemetryConfig, exporterID string) {
exporter := otelConfig.Exporters[exporterID]
queue := mapFromInterface(exporter["sending_queue"])
queue["batch"] = map[string]interface{}{
"flush_timeout": defaultLogExporterBatchFlushTimeout,
"sizer": "bytes",
"min_size": defaultLogExporterBatchSizeBytes,
"max_size": defaultLogExporterBatchSizeBytes,
}
exporter["sending_queue"] = queue
}

func exporterLogs(config TelemetryConfig, otelConfig *OpenTelemetryConfig) (exporterId string, err error) {
var exporterType, exporterName string
var exporterCredential interface{}
Expand Down Expand Up @@ -857,6 +872,9 @@ func generateExportersAndService(config TelemetryConfig, otelConfig *OpenTelemet
"dry_run": logChunking.DryRun,
}
logPipeline.Processors = append(logPipeline.Processors, "logchunk/byoo")
if !logChunking.DryRun {
enableChunkedLogExporterBatching(otelConfig, exporterId)
}
}
logPipeline.Processors = append(logPipeline.Processors, "batch")
otelConfig.Service.Pipelines["logs"] = logPipeline
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,8 @@ func TestGenerateExportersAndServiceAddsLogChunkDefaultsWhenEnabled(t *testing.T
Logs: &Telemetry{
Name: "example-logs",
Protocol: ProtocolHTTP,
Provider: ProviderSplunk,
Endpoint: "https://splunk.example.invalid",
Provider: ProviderKratosLogs,
Endpoint: "https://kratos.example.invalid",
},
},
}
Expand All @@ -502,8 +502,18 @@ func TestGenerateExportersAndServiceAddsLogChunkDefaultsWhenEnabled(t *testing.T
"max_payload_bytes": defaultLogChunkMaxPayloadBytes,
"dry_run": false,
}, otelConfig.Processors["logchunk/byoo"])
exporter := otelConfig.Exporters["splunk_hec/SPLUNK-example-logs-logs"]
assert.NotContains(t, exporter["sending_queue"].(map[string]interface{}), "batch")
exporter := otelConfig.Exporters["otlp_http/KRATOS-example-logs-logs"]
assert.Equal(t, map[string]interface{}{
"enabled": true,
"num_consumers": 10,
"queue_size": 1000,
"batch": map[string]interface{}{
"flush_timeout": defaultLogExporterBatchFlushTimeout,
"sizer": "bytes",
"min_size": defaultLogExporterBatchSizeBytes,
"max_size": defaultLogExporterBatchSizeBytes,
},
}, exporter["sending_queue"])
}

func TestGenerateExportersAndServiceUsesExporterHelperQueueBatchConfig(t *testing.T) {
Expand Down
Loading