Skip to content

Unicron datadog logging#4896

Open
lukaszgryglicki wants to merge 15 commits intodevfrom
unicron-datadog-logging
Open

Unicron datadog logging#4896
lukaszgryglicki wants to merge 15 commits intodevfrom
unicron-datadog-logging

Conversation

@lukaszgryglicki
Copy link
Member

Currently WIP.

Signed-off-by: Lukasz Gryglicki lgryglicki@cncf.io

Assisted by OpenAI

Assisted by GitHub Copilot

Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>

Assisted by [OpenAI](https://platform.openai.com/)

Assisted by [GitHub Copilot](https://github.com/features/copilot)
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>

Assisted by [OpenAI](https://platform.openai.com/)

Assisted by [GitHub Copilot](https://github.com/features/copilot)
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>

Assisted by [OpenAI](https://platform.openai.com/)

Assisted by [GitHub Copilot](https://github.com/features/copilot)
@coderabbitai
Copy link

coderabbitai bot commented Feb 11, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds Datadog OpenTelemetry integration and feature flags for API logging; introduces idempotent Datadog OTLP/HTTP exporter and tracer initialization, conditional HTTP handler wrapping for OTEL, environment-driven flag evaluation, and serverless/IAM updates to provide Datadog secrets and extension layer support.

Changes

Cohort / File(s) Summary
Go server & telemetry
cla-backend-go/cmd/server.go, cla-backend-go/telemetry/datadog_otlp.go
Adds DDB_API_LOGGING and OTEL_DATADOG_API_LOGGING flags and helpers; implements DatadogOTelConfig, idempotent InitDatadogOTel, OTLP/HTTP exporter selection, resource/tracer setup, and WrapHTTPHandler; conditionally initializes telemetry and wraps HTTP handlers.
Go dependencies
cla-backend-go/go.mod
Updates module versions and dependency graph; adds OpenTelemetry packages (otel, otelhttp, otlp/otlptrace/http, sdk) and numerous transitive dependency bumps.
Go serverless config
cla-backend-go/serverless.yml
Adds custom.datadog block, new DD_/OTEL_ env vars, Secrets Manager ARN, IAM permission for secrets, and attaches Datadog extension layer to the Go API function.
Python request logging
cla-backend/cla/routes.py
Adds env parsing helpers and cached enabled_by_env_or_stage; gates DynamoDB API logging behind DDB_API_LOGGING; adds async OTEL/Datadog logging stub guarded by OTEL_DATADOG_API_LOGGING.
Python/serverless changes
cla-backend/serverless.yml
Adds custom.datadog, new environment variables, Secrets Manager IAM permission, and attaches Datadog extension layer to many Lambda functions (APIs, authorizers, event handlers, metrics, builders, callbacks).

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Handler as HTTP Handler
    participant Tracer as OTEL Tracer
    participant Exporter as OTLP/HTTP Exporter
    participant Datadog

    Client->>Handler: HTTP Request
    Handler->>Tracer: instrument via WrapHTTPHandler
    Tracer->>Tracer: start span "<METHOD> <PATH>"
    Handler->>Handler: process request (business logic, optional DDB logging)
    Handler-->>Client: HTTP Response
    Tracer->>Tracer: end span
    Tracer->>Exporter: batch/export spans (OTLP/HTTP)
    Exporter->>Datadog: send traces
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ❌ 3
❌ Failed checks (2 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description states 'Currently WIP' without explaining the changeset, failing to provide meaningful context about the implementation despite extensive code changes. Complete the WIP description by explaining the purpose of the changes, such as adding Datadog OTEL integration, conditional API logging, and environment-based feature flags.
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Unicron datadog logging' is vague and generic, using a non-descriptive project name without clearly conveying what the changeset accomplishes. Use a more descriptive title that clearly explains the main change, such as 'Add Datadog OpenTelemetry logging integration' or 'Enable conditional API request logging with Datadog'.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch unicron-datadog-logging

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Datadog/OTel-related configuration and instrumentation to the EasyCLA Python + Go backends, primarily by wiring in the Datadog Lambda Extension layer, introducing env-driven feature flags for API logging, and adding initial OTel trace export plumbing (Go) plus a placeholder stub (Python).

Changes:

  • Add Datadog config + Lambda extension layer to Serverless deployments for both backends, including Secrets Manager access for the Datadog API key secret.
  • Make API request logging feature-flagged via environment variables (DynamoDB + OTel/Datadog flags).
  • Introduce Go OTel SDK initialization + HTTP handler instrumentation for OTLP/HTTP export to the Datadog Lambda Extension.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
cla-backend/serverless.yml Adds Datadog config/env vars, Secrets Manager permission, and attaches the Datadog extension layer to multiple Lambdas.
cla-backend/cla/routes.py Adds env/stage-driven feature flags for API logging and an OTel/Datadog logging stub hook.
cla-backend-go/telemetry/datadog_otlp.go New Go telemetry package to init OTel and export traces via OTLP/HTTP to the Datadog Lambda Extension.
cla-backend-go/serverless.yml Adds Datadog config/env vars, Secrets Manager permission, and attaches the Datadog extension layer.
cla-backend-go/cmd/server.go Wires feature flags and telemetry init/wrapping into the Go server startup path.
cla-backend-go/go.mod Updates Go toolchain/dependencies and adds OTel modules needed for telemetry.
cla-backend-go/go.sum Corresponding dependency checksum updates for the new/updated Go modules.

Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>

Assisted by [OpenAI](https://platform.openai.com/)

Assisted by [GitHub Copilot](https://github.com/features/copilot)
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@cla-backend-go/telemetry/datadog_otlp.go`:
- Around line 116-167: The code in newOTLPHTTPExporter loses which environment
variable was chosen by using firstNonEmpty, causing incorrect path handling per
the OpenTelemetry spec; update the function to read
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT and OTEL_EXPORTER_OTLP_ENDPOINT separately,
determine which one is set (prefer per-signal OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
if non-empty), and then parse and normalize differently: if
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT is used, preserve its path verbatim (default
to "/" if no path), and if only OTEL_EXPORTER_OTLP_ENDPOINT (base) is used,
treat it as a base URL and append "/v1/traces" (handling trailing slashes) when
building path/host; keep the existing URL parsing logic and set
otlptracehttp.WithEndpoint(host) and otlptracehttp.WithURLPath(path)
accordingly, retaining insecure detection and the default Datadog fallback
("http://localhost:4318/v1/traces") when neither var is set.

Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>

Assisted by [OpenAI](https://platform.openai.com/)

Assisted by [GitHub Copilot](https://github.com/features/copilot)
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.

Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>

Assisted by [OpenAI](https://platform.openai.com/)

Assisted by [GitHub Copilot](https://github.com/features/copilot)
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>

Assisted by [OpenAI](https://platform.openai.com/)

Assisted by [GitHub Copilot](https://github.com/features/copilot)
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>

Assisted by [OpenAI](https://platform.openai.com/)

Assisted by [GitHub Copilot](https://github.com/features/copilot)
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>

Assisted by [OpenAI](https://platform.openai.com/)

Assisted by [GitHub Copilot](https://github.com/features/copilot)
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>

Assisted by [OpenAI](https://platform.openai.com/)

Assisted by [GitHub Copilot](https://github.com/features/copilot)
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>

Assisted by [OpenAI](https://platform.openai.com/)

Assisted by [GitHub Copilot](https://github.com/features/copilot)
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>

Assisted by [OpenAI](https://platform.openai.com/)

Assisted by [GitHub Copilot](https://github.com/features/copilot)
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>

Assisted by [OpenAI](https://platform.openai.com/)

Assisted by [GitHub Copilot](https://github.com/features/copilot)
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>

Assisted by [OpenAI](https://platform.openai.com/)

Assisted by [GitHub Copilot](https://github.com/features/copilot)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant