Skip to content

feat(log): add OpenTelemetry log for direct OTLP export#290

Draft
maxlengdell wants to merge 2 commits into
cloudnative-pg:mainfrom
maxlengdell:dev/11085
Draft

feat(log): add OpenTelemetry log for direct OTLP export#290
maxlengdell wants to merge 2 commits into
cloudnative-pg:mainfrom
maxlengdell:dev/11085

Conversation

@maxlengdell

Copy link
Copy Markdown

Add optional OTel log export support to the logging package. When
configured via --log-otel-endpoint flag or CNPG_LOG_OTEL_ENDPOINT
env var, log records are pushed directly to an OpenTelemetry Collector
via OTLP gRPC in addition to the existing stdout JSON output.

Implementation:

  • tee.go: logr.LogSink that duplicates records to two sinks
  • otel.go: OTel Logs SDK setup with otellogr bridge and batch processor
  • flags.go: new --log-otel-endpoint flag, wired into ConfigureLogging()

When the endpoint is not configured, behavior is identical to before.
No new dependencies are loaded and no connections are made.

closes cloudnative-pg/cloudnative-pg#11085

Add optional OTel log export support to the logging package. When
configured via --log-otel-endpoint flag or CNPG_LOG_OTEL_ENDPOINT
env var, log records are pushed directly to an OpenTelemetry Collector
via OTLP gRPC in addition to the existing stdout JSON output.

Implementation:
- tee.go: logr.LogSink that duplicates records to two sinks
- otel.go: OTel Logs SDK setup with otellogr bridge and batch processor
- flags.go: new --log-otel-endpoint flag, wired into ConfigureLogging()

When the endpoint is not configured, behavior is identical to before.
No new dependencies are loaded and no connections are made.

Signed-off-by: Max Lengdell <max.lengdell@ericsson.com>
Signed-off-by: Max Lengdell <max.lengdell@ericsson.com>
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.

[Feature]: Support Otel Log streaming w/o daemonset

1 participant