Skip to content

Conversation

@eliottness
Copy link
Contributor

@eliottness eliottness commented Nov 3, 2025

What does this PR do?

This PR implements feature flag exposure tracking for the Datadog OpenFeature provider. It adds the ability to automatically capture and report
feature flag evaluations to Datadog's Event Platform Intake, providing visibility into which feature flags are being evaluated and by which users.

Key changes:

  • Adds exposureWriter for buffering and flushing exposure events to the Datadog agent via EVP proxy
  • Implements exposureHook that integrates with the OpenFeature SDK to capture evaluation details
  • Introduces ProviderConfig field to allow configuration of exposure flush intervals
  • Adds attribute flattening utilities to ensure subject attributes comply with EVP intake schema
  • Updates documentation with configuration options and environment variables

Out of scope refactoring

Moved the tracer private method udsClient, defaultHTTPClient and defaultDialer to the internal package to simply code between telemetry/tracer/openfeature writers

Reviewer's Checklist

  • Changed code has unit tests for its functionality at or near 100% coverage.
  • System-Tests covering this feature have been added and enabled with the va.b.c-dev version tag.
  • There is a benchmark for any new code, or changes to existing code.
  • If this interacts with the agent in a new way, a system test has been added.
  • New code is free of linting errors. You can check this by running ./scripts/lint.sh locally.
  • Add an appropriate team label so this PR gets put in the right place for the release notes.
  • Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild.

Unsure? Have a question? Request a review!

@pr-commenter
Copy link

pr-commenter bot commented Nov 3, 2025

Benchmarks

Benchmark execution time: 2025-11-04 13:34:07

Comparing candidate commit 7dff30e in PR branch eliottness/ffe-exposures with baseline commit b2e6ba7 in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 24 metrics, 0 unstable metrics.

@eliottness eliottness changed the title feat(openfeature): After Hook Exposure events feat(openfeature): After Hook Exposure event writer Nov 3, 2025
@github-actions github-actions bot added the apm:ecosystem contrib/* related feature requests or bugs label Nov 3, 2025
# Conflicts:
#	openfeature/provider.go
Signed-off-by: Eliott Bouhana <[email protected]>
Signed-off-by: Eliott Bouhana <[email protected]>
Signed-off-by: Eliott Bouhana <[email protected]>
Signed-off-by: Eliott Bouhana <[email protected]>
Signed-off-by: Eliott Bouhana <[email protected]>
@eliottness eliottness force-pushed the eliottness/ffe-exposures branch from 2b6db30 to 2804703 Compare November 3, 2025 15:13
Signed-off-by: Eliott Bouhana <[email protected]>
@eliottness eliottness added enhancement quick change/addition that does not need full team approval AI Assisted AI/LLM assistance used in this PR (partially or fully) and removed apm:ecosystem contrib/* related feature requests or bugs labels Nov 3, 2025
@github-actions github-actions bot added the apm:ecosystem contrib/* related feature requests or bugs label Nov 3, 2025
@eliottness eliottness marked this pull request as ready for review November 3, 2025 15:17
@eliottness eliottness requested a review from a team as a code owner November 3, 2025 15:17
@eliottness
Copy link
Contributor Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Nov 3, 2025

⚠️ Tests

⚠️ Warnings

❄️ 11 New flaky tests detected

    Test from github.com/DataDog/dd-trace-go/v2/internal/orchestrion/_integration/99designs.gqlgen

TestLoadDefaultConfig from github.com/DataDog/dd-trace-go/v2/internal/orchestrion/_integration/aws.v2 (Datadog)
Failed

=== RUN   TestLoadDefaultConfig
    generated_test.go:19: Running setup
    lifecycle.go:79: 🐳 Creating container for image amazon/dynamodb-local:latest
    lifecycle.go:85: ✅ Container created: f9f947a088cc
    lifecycle.go:91: 🐳 Starting container: f9f947a088cc
    lifecycle.go:97: ✅ Container started: f9f947a088cc
    logs.go:29: Initializing DynamoDB Local with the following configuration:
        
...

    Test from github.com/DataDog/dd-trace-go/v2/internal/orchestrion/_integration/chi.v5

View all

🧪 14 Tests failed

    Test from github.com/DataDog/dd-trace-go/v2/internal/orchestrion/_integration/aws.v1

    Test from github.com/DataDog/dd-trace-go/v2/internal/orchestrion/_integration/confluent-kafka-go.v1

    Test from github.com/DataDog/dd-trace-go/v2/internal/orchestrion/_integration/confluent-kafka-go.v2

View all
This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 7dff30e | Docs | Datadog PR Page | Was this helpful? Give us feedback!

@eliottness
Copy link
Contributor Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@eliottness eliottness force-pushed the eliottness/ffe-exposures branch from 2358c60 to 78bf8d9 Compare November 4, 2025 11:39
@eliottness eliottness requested review from a team as code owners November 4, 2025 11:39
Signed-off-by: Eliott Bouhana <[email protected]>
@eliottness
Copy link
Contributor Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +119 to +121
return &exposureWriter{
buffer: make([]exposureEvent, 1<<8), // Initial capacity of 256
flushInterval: cmp.Or(config.ExposureFlushInterval, defaultExposureFlushInterval),

Choose a reason for hiding this comment

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

P1 Badge Avoid sending 256 empty exposure events on startup

The exposure writer initializes its buffer with make([]exposureEvent, 1<<8). That creates a slice with length 256, not just capacity, so before any flag is evaluated the periodic flush sees 256 entries and pushes them to the agent as zero‑valued exposures. On the first tick this will POST 256 bogus events (likely rejected by the agent and logged as errors) even though no exposures occurred. The buffer should start with length 0 and capacity 256 instead.

Useful? React with 👍 / 👎.

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

Labels

AI Assisted AI/LLM assistance used in this PR (partially or fully) apm:ecosystem contrib/* related feature requests or bugs enhancement quick change/addition that does not need full team approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants