From a2a2083e9cd5ab1b8881763eb34ebf27f44f5d01 Mon Sep 17 00:00:00 2001 From: amosd92 Date: Thu, 26 Nov 2026 15:52:26 +0200 Subject: [PATCH] Default combined config: receive OTLP logs, drop duplicate and START/END lines Since #24 the Node.js wrapper sends console output as OTLP logs (with trace and span IDs) by default, but config.combined.yaml only received logs from the Telemetry API, so the SDK's log exports failed and console lines arrived without trace IDs. Add an OTLP logs pipeline and drop the Telemetry API copy of lines written inside an invocation plus Lambda's per-invocation START/END lines, matching config.gateway.yaml. config_test.go now covers config.combined.yaml. Claude-Session: https://claude.ai/code/session_01QdKvbfTtH9eMeMyYNq5Nht --- collector/config.combined.yaml | 18 ++++++++++++++++-- collector/config_test.go | 6 +++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/collector/config.combined.yaml b/collector/config.combined.yaml index fd97cb11ad..bf02f41b5f 100644 --- a/collector/config.combined.yaml +++ b/collector/config.combined.yaml @@ -29,7 +29,17 @@ processors: action: delete - key: process.tags action: delete - + # Console output during an invocation arrives over OTLP from the Logz.io hooks, with trace and span IDs. + # Drop the Telemetry API copy of those lines so they are not sent twice, and Lambda's per-invocation + # START and END lines. Platform records and output written outside an invocation (init, crashes) are kept. + filter/invocation-output: + error_mode: ignore + logs: + log_record: + # Runtime line format: "\t\t\t"; init lines carry "undefined". + - 'attributes["type"] == "function" and IsMatch(body, "^\\S+\\t[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\t")' + - 'attributes["type"] == "platform.start" or attributes["type"] == "platform.runtimeDone"' + exporters: logzio/logs: account_token: "${env:LOGZIO_LOGS_TOKEN}" @@ -60,9 +70,13 @@ service: processors: [batch] exporters: [prometheusremotewrite] logs: - receivers: [telemetryapireceiver] + receivers: [otlp] processors: [batch] exporters: [logzio/logs] + logs/telemetryapi: + receivers: [telemetryapireceiver] + processors: [filter/invocation-output, batch] + exporters: [logzio/logs] telemetry: logs: level: "info" diff --git a/collector/config_test.go b/collector/config_test.go index 8a65e7c192..6b10e2a4ab 100644 --- a/collector/config_test.go +++ b/collector/config_test.go @@ -33,11 +33,15 @@ import ( func TestShippedConfigsAreValid(t *testing.T) { t.Setenv("LOGZIO_GATEWAY_ENDPOINT", "https://gateway.example.com") t.Setenv("LOGZIO_GATEWAY_TOKEN", "test-token") + t.Setenv("LOGZIO_TRACES_TOKEN", "test-token") + t.Setenv("LOGZIO_LOGS_TOKEN", "test-token") + t.Setenv("LOGZIO_METRICS_TOKEN", "test-token") + t.Setenv("LOGZIO_REGION", "us") factories, err := lambdacomponents.Components("collector") require.NoError(t, err) - for _, file := range []string{"config.gateway.yaml", "config.gateway-traces.yaml"} { + for _, file := range []string{"config.combined.yaml", "config.gateway.yaml", "config.gateway-traces.yaml"} { t.Run(file, func(t *testing.T) { provider, err := otelcol.NewConfigProvider(otelcol.ConfigProviderSettings{ ResolverSettings: confmap.ResolverSettings{