Skip to content

feat: Introduce OpenTelemetry for logs, traces, and metrics#308

Draft
Copilot wants to merge 3 commits intobetafrom
copilot/introduce-opentelemetry-logging
Draft

feat: Introduce OpenTelemetry for logs, traces, and metrics#308
Copilot wants to merge 3 commits intobetafrom
copilot/introduce-opentelemetry-logging

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 18, 2026

Adds OpenTelemetry (OTel) support covering all three observability pillars — traces, logs, and metrics — exported via OTLP/gRPC. OTel is disabled by default and opt-in via environment variable.

Description of change

New OpenTelemetryConfig added to ApplicationConfiguration:

  • UNICORE__OPENTELEMETRY__ENABLED — enables OTel export (default: false)
  • UNICORE__OPENTELEMETRY__ENDPOINT — OTLP gRPC endpoint (default: http://localhost:4317)

Traces — existing tracing spans are bridged to OTel via tracing-opentelemetry. No instrumentation changes needed at call sites.

Logstracing events (info!, debug!, warn!, error!) are bridged to OTel via opentelemetry-appender-tracing::OpenTelemetryTracingBridge.

Metrics — OTel SdkMeterProvider with OTLP periodic export is registered as the global meter provider.

Log level respected — the existing EnvFilter (driven by RUST_LOG, defaulting to info) sits at the subscriber root, so all layers — fmt and OTel alike — are filtered consistently.

Graceful shutdownshutdown_telemetry() flushes all three providers before the process exits; called at the end of run().

# Enable OpenTelemetry export
UNICORE__OPENTELEMETRY__ENABLED=true
UNICORE__OPENTELEMETRY__ENDPOINT="http://otel-collector:4317"

New dependencies: opentelemetry 0.31, opentelemetry_sdk 0.31, opentelemetry-otlp 0.31, opentelemetry-appender-tracing 0.31, tracing-opentelemetry 0.32.

Links to any relevant issues

How the change has been tested

  • cargo test -p agent_shared — all 21 unit tests pass, including the existing configuration serialization test updated to include the new opentelemetry field.
  • cargo build -p agent_application — full application builds successfully.
  • Checked all new OTel dependencies against the GitHub Advisory Database — no known vulnerabilities.

Definition of Done checklist

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have successfully tested this change in a docker environment
Original prompt

Introduce OpenTelemetry for logs, traces and metrics. Logs should be created using the tracing crate. OTel should be enabled and disabled via an environment variable. It should respect the global log level.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits March 18, 2026 15:11
Co-authored-by: daniel-mader <45594838+daniel-mader@users.noreply.github.com>
Co-authored-by: daniel-mader <45594838+daniel-mader@users.noreply.github.com>
Copilot AI changed the title [WIP] Add OpenTelemetry for logs, traces, and metrics feat: Introduce OpenTelemetry for logs, traces, and metrics Mar 18, 2026
Copilot AI requested a review from daniel-mader March 18, 2026 15:21
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.

2 participants