Skip to content

feat: export the logs via OpenTelemetry - #562

Open
armru wants to merge 6 commits into
mainfrom
dev/549
Open

armru wants to merge 6 commits into
mainfrom
dev/549

Conversation

@armru

@armru armru commented Nov 3, 2026

Copy link
Copy Markdown
Member

Klio exports its traces and metrics through OpenTelemetry, but its logs
only reach the standard output, so collecting them still needs a node
agent or a sidecar.

Every Klio process now builds a log provider with the resource and the
exporter selection of its other signals, and hands it to the logging of
machinery before configuring it, so the records written on the standard
output are exported too. OTEL_LOGS_EXPORTER enables the export and is
unset by default, so a configuration written for the traces and the
metrics does not start sending the logs. Each command exports its own
records and flushes them before exiting, including the short-lived
commands that the plugin sidecar spawns, while retention get now runs
without the OTEL_* variables like get-metadata, as its output is
captured.

The operator moves from the controller-runtime logger to the one of
machinery, which the server and the sidecar already use: it now logs in
JSON at the info level by default, and keeps accepting the --zap-*
arguments along with --log-level.

This needs cloudnative-pg/machinery#343, pinned to its head until it is
released.

Closes #549

armru and others added 6 commits November 9, 2026 10:56
Klio exports its traces and metrics through OpenTelemetry, but its logs
only reach the standard output, so collecting them still needs a node
agent or a sidecar.

Every Klio process now builds a log provider with the resource and the
exporter selection of its other signals, and hands it to the logging of
machinery before configuring it, so the records written on the standard
output are exported too. OTEL_LOGS_EXPORTER enables the export and is
unset by default, so a configuration written for the traces and the
metrics does not start sending the logs. Each command exports its own
records and flushes them before exiting, including the short-lived
commands that the plugin sidecar spawns, while `retention get` now runs
without the OTEL_* variables like `get-metadata`, as its output is
captured.

The operator moves from the controller-runtime logger to the one of
machinery, which the server and the sidecar already use: it now logs in
JSON at the info level by default, and keeps accepting the --zap-*
arguments along with --log-level.

This needs cloudnative-pg/machinery#343, pinned to its head until it is
released.

Closes #549

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Signed-off-by: Francesco Canovai <francesco.canovai@enterprisedb.com>
Make the operator's ShutdownLogs own its timeout and error logging, as
in core, and defer it in run right after the logging is configured, so
main reduces to os.Exit(run()).

Assisted-by: Claude
Signed-off-by: Francesco Canovai <francesco.canovai@enterprisedb.com>
The command logs nothing on success and its output is discarded on
failure, so the console exporters cannot reach the logged policy.

Assisted-by: Claude
Signed-off-by: Francesco Canovai <francesco.canovai@enterprisedb.com>
Logs now follow the specification and the other signals: they are
exported via OTLP as soon as OpenTelemetry is configured, unless
OTEL_LOGS_EXPORTER is "none". OTEL_SDK_DISABLED=true now disables every
signal; previously, being an OTEL_* variable, it enabled the traces and
the metrics.

Assisted-by: Claude
Signed-off-by: Francesco Canovai <francesco.canovai@enterprisedb.com>
Pick up the OTEL_SDK_DISABLED and OTEL_LOGS_EXPORTER handling of the
OpenTelemetry log export.

Signed-off-by: Francesco Canovai <francesco.canovai@enterprisedb.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Evaluate reuse of machinery's OpenTelemetry log export to complete native OTEL support (logs, metrics, traces)

2 participants