Skip to content

refactor(exporters): add shared EVP proxy utilities - #9738

Merged
leoromanovsky merged 5 commits into
masterfrom
leo.romanovsky/evp-proxy-utilities
Aug 18, 2026
Merged

refactor(exporters): add shared EVP proxy utilities#9738
leoromanovsky merged 5 commits into
masterfrom
leo.romanovsky/evp-proxy-utilities

Conversation

@leoromanovsky

@leoromanovsky leoromanovsky commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Motivation

Our business goal is a simple, standalone Datadog OpenFeature client integration. Users must be able to send exposure events without a local receiver.

OpenFeature exposure delivery already uses /info to discover an EVP proxy. This path works when an Agent-compatible receiver is available. Today, discovery is required. Exposure delivery stops when no receiver answers /info. There is no direct fallback.

Standalone mode needs a different contract. Route use must not depend on discovery. Discovery must be optional. A caller must also be able to provide a known route.

This PR adds that shared EVP contract. Feature Flags is the first consumer. The next PR, #9527, uses the contract for agentless delivery. It uses serverless-init when available. It uses direct EVP when no receiver is available.

Users can add serverless-init later if trace delivery requires it. Exposure delivery does not need to wait for that requirement.

flowchart TB
  subgraph Current["This PR: current Agent mode"]
    Client["OpenFeature client"] --> Flags["Feature Flags"]
    Flags --> Writer["Exposure writer"]
    Info["Agent /info"] --> Discovery["EVP discovery"]
    Discovery --> Writer
    Writer --> Proxy["Agent EVP proxy v2"]
    Proxy --> Intake["Exposure intake"]
  end

  subgraph Next["Next PR: agentless mode"]
    Agentless["Agentless Feature Flags"] --> Serverless["serverless-init EVP"]
    Agentless --> Direct["Direct EVP fallback"]
  end

  Discovery -. "shared route contract" .-> Agentless
  style Next fill:transparent,stroke-dasharray:6 4
Loading

Datadog provides setup guides for serverless-init as a sidecar and serverless-init in the application container.

Changes and Decisions

  • Add shared EVP constants for proxy paths, routing headers, and the intake subdomain.
  • Add a utility that joins an EVP proxy path and a product endpoint.
  • Add optional /info discovery for supported EVP proxy paths.
  • Keep route use separate from discovery.
  • Use the existing Agent information client for /info requests and caching.
  • Treat /info as capability data. Do not use it to identify the receiver or test its health.
  • Refactor the existing Feature Flags Agent v2 path to use these utilities.
  • Ignore a discovery result when the exposure writer has changed.
  • Keep Test Optimization and LLM Observability behavior unchanged. Add migration comments only.
  • Leave agentless routing, direct delivery, and fallback behavior to feat(openfeature): route agentless exposure events #9527.

Validation

  • system-tests main 17a45f60c: the Agent exposure suite passed with 10 passed, 1 xfailed.
  • dd-trace-js 6bf1846c6: the same suite passed with 10 passed, 1 xfailed after this refactor.

@dd-octo-sts

dd-octo-sts Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Overall package size

Self size: 8.2 MB
Deduped: 8.87 MB
No deduping: 8.87 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.3.3 | 125.43 kB | 445.14 kB | | opentracing | 0.14.7 | 194.81 kB | 194.81 kB | | dc-polyfill | 0.1.11 | 25.74 kB | 25.74 kB |

🤖 This report was automatically generated by heaviest-objects-in-the-universe

@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Aug 8, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🔄 Datadog retried 1 test - 1 passed on retry View in Datadog

🔄 Datadog auto-retried 2 jobs - 0 passed on retry View in Datadog

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 98.51% (-0.02%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 6796798 | Docs | View more details | Give us feedback!

@pr-commenter

pr-commenter Bot commented Aug 8, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-08-17 18:02:14

Comparing candidate commit 6796798 in PR branch leo.romanovsky/evp-proxy-utilities with baseline commit f3e5e1a in branch master.

📊 Benchmarking dashboard

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

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

Unstable benchmarks

These benchmarks have a confidence interval too wide to call a change; treat them as noise rather than signal.

scenario:appsec-iast-no-vulnerability-iast-enabled-default-config-20

  • unstable max_rss_usage [-16.422MB; +23.764MB] or [-6.877%; +9.952%]

scenario:appsec-iast-with-vulnerability-iast-enabled-default-config-20

  • unstable max_rss_usage [-26.377MB; +18.951MB] or [-6.950%; +4.993%]

scenario:debugger-line-probe-with-snapshot-minimal-24

  • unstable max_rss_usage [-13449.323KB; +13341.323KB] or [-5.365%; +5.322%]

scenario:debugger-line-probe-without-snapshot-24

  • unstable max_rss_usage [-12.732MB; +19.931MB] or [-4.536%; +7.100%]

scenario:dogstatsd-with-tags-20

  • unstable cpu_user_time [-195.701ms; +438.853ms] or [-4.049%; +9.079%]
  • unstable execution_time [-196.363ms; +438.939ms] or [-4.001%; +8.943%]
  • unstable throughput [-155226.787op/s; +68175.768op/s] or [-9.079%; +3.988%]

scenario:plugin-claude-agent-sdk-compact-stream-scan-26

  • unstable cpu_usage_percentage [-5.331%; +5.834%]

scenario:plugin-graphql-long-with-depth-and-collapse-off-20

  • unstable max_rss_usage [-18.116MB; +39.413MB] or [-4.602%; +10.013%]

scenario:test-optimization-large-suite-20

  • unstable max_rss_usage [-3.114MB; +8.766MB] or [-3.914%; +11.019%]

@codecov

codecov Bot commented Aug 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.51%. Comparing base (f3e5e1a) to head (6796798).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9738      +/-   ##
==========================================
- Coverage   98.53%   98.51%   -0.02%     
==========================================
  Files         978      981       +3     
  Lines      144181   144349     +168     
  Branches    12936    13097     +161     
==========================================
+ Hits       142068   142205     +137     
- Misses       2113     2144      +31     
Flag Coverage Δ
aiguard 57.43% <ø> (-0.04%) ⬇️
aiguard-integration 55.45% <ø> (-0.02%) ⬇️
apm-bucket-0 57.60% <ø> (-0.04%) ⬇️
apm-bucket-1 62.79% <ø> (-0.04%) ⬇️
apm-bucket-2 61.62% <ø> (-0.04%) ⬇️
apm-bucket-3 59.26% <ø> (-0.04%) ⬇️
apm-capabilities-tracing 62.35% <55.50%> (-0.02%) ⬇️
apm-integrations-aerospike 55.49% <ø> (-0.05%) ⬇️
apm-integrations-confluentinc-kafka-javascript 60.61% <ø> (-0.04%) ⬇️
apm-integrations-couchbase 56.19% <ø> (-0.05%) ⬇️
apm-integrations-http 61.36% <ø> (-0.04%) ⬇️
apm-integrations-kafkajs 61.12% <ø> (-0.04%) ⬇️
apm-integrations-next 58.86% <ø> (-0.04%) ⬇️
apm-integrations-prisma 58.31% <ø> (-0.04%) ⬇️
appsec 71.47% <ø> (-0.06%) ⬇️
appsec-express 67.68% <ø> (?)
appsec-express_fastify_graphql 68.90% <ø> (-0.03%) ⬇️
appsec-integration 49.60% <ø> (-0.02%) ⬇️
appsec-kafka_ldapjs_lodash 62.86% <ø> (-0.04%) ⬇️
appsec-mongodb-core_mongoose_mysql 66.35% <ø> (-0.03%) ⬇️
appsec-next 56.23% <ø> (-0.04%) ⬇️
appsec-node-serialize_passport_postgres 65.76% <ø> (-0.03%) ⬇️
appsec-sourcing_stripe 62.33% <ø> (?)
appsec-sourcing_stripe_template ?
debugger 63.66% <ø> (-0.03%) ⬇️
instrumentations-bucket-0 58.27% <ø> (+7.01%) ⬆️
instrumentations-bucket-1 59.11% <ø> (-0.04%) ⬇️
instrumentations-bucket-10 60.37% <ø> (-0.04%) ⬇️
instrumentations-bucket-11 61.02% <ø> (-0.04%) ⬇️
instrumentations-bucket-12 51.13% <ø> (-0.05%) ⬇️
instrumentations-bucket-13 51.98% <ø> (-0.05%) ⬇️
instrumentations-bucket-14 51.23% <ø> (-0.05%) ⬇️
instrumentations-bucket-2 52.46% <ø> (-0.04%) ⬇️
instrumentations-bucket-3 53.10% <ø> (-0.05%) ⬇️
instrumentations-bucket-4 58.19% <ø> (-0.04%) ⬇️
instrumentations-bucket-5 48.80% <ø> (-0.04%) ⬇️
instrumentations-bucket-6 59.71% <ø> (-0.04%) ⬇️
instrumentations-bucket-7 51.42% <ø> (-0.05%) ⬇️
instrumentations-bucket-8 57.90% <ø> (-0.03%) ⬇️
instrumentations-bucket-9 56.75% <ø> (-0.04%) ⬇️
instrumentations-instrumentation-bluebird 51.10% <ø> (?)
instrumentations-instrumentation-couchbase 50.19% <ø> (-0.05%) ⬇️
instrumentations-instrumentation-router 51.27% <ø> (?)
instrumentations-integration-esbuild 33.87% <ø> (-0.02%) ⬇️
llmobs-ai_anthropic_bedrock 62.30% <ø> (-0.04%) ⬇️
llmobs-bucket-1 60.81% <ø> (-0.04%) ⬇️
llmobs-google-genai 60.04% <ø> (?)
llmobs-openai 61.50% <ø> (-0.04%) ⬇️
llmobs-openai-agents_vertex-ai 59.53% <ø> (-0.05%) ⬇️
llmobs-sdk 67.21% <ø> (-0.04%) ⬇️
master-coverage 98.51% <100.00%> (?)
openfeature 55.31% <89.47%> (+0.12%) ⬆️
openfeature-unit 53.07% <100.00%> (+0.21%) ⬆️
platform-core_esbuild_instrumentations-misc 40.84% <ø> (-0.03%) ⬇️
platform-esbuild 38.71% <ø> (?)
platform-integration 59.90% <ø> (-0.02%) ⬇️
platform-shimmer 50.86% <ø> (?)
platform-shimmer_unit-guardrails_webpack 38.49% <ø> (-0.03%) ⬇️
plugins-azure-cosmos 57.77% <ø> (?)
plugins-azure-service-bus 50.98% <ø> (?)
plugins-browser-bunyan_bullmq_cassandra 61.00% <ø> (-0.04%) ⬇️
plugins-bucket-0 56.41% <ø> (-0.04%) ⬇️
plugins-bucket-1 53.53% <ø> (-0.02%) ⬇️
plugins-bucket-11 61.37% <ø> (-0.04%) ⬇️
plugins-bucket-18 60.93% <ø> (-0.04%) ⬇️
plugins-bucket-19 59.17% <ø> (-0.04%) ⬇️
plugins-bucket-20 61.09% <ø> (-0.04%) ⬇️
plugins-bucket-4 55.80% <ø> (-0.05%) ⬇️
plugins-cookie_cookie-parser_crypto 50.75% <ø> (-0.05%) ⬇️
plugins-fastify_fetch_fs 60.04% <ø> (-0.01%) ⬇️
plugins-generic-pool_google-cloud-pubsub_grpc 63.56% <ø> (-0.05%) ⬇️
plugins-handlebars_hapi_hono 58.03% <ø> (-0.04%) ⬇️
plugins-ioredis_knex_langgraph 56.49% <ø> (-0.04%) ⬇️
plugins-ldapjs_light-my-request_limitd-client 57.73% <ø> (-0.04%) ⬇️
plugins-lodash_mariadb_memcached 57.43% <ø> (-0.04%) ⬇️
plugins-moleculer_mongodb_mongodb-core 60.88% <ø> (-0.04%) ⬇️
plugins-mongoose_multer_mysql 58.71% <ø> (-0.04%) ⬇️
plugins-mysql2_nats_node-serialize 60.34% <ø> (-0.04%) ⬇️
plugins-node-serialize 50.77% <ø> (?)
plugins-opensearch_passport-http_pino 58.58% <ø> (-0.04%) ⬇️
plugins-postgres_process_pug 57.73% <ø> (-0.04%) ⬇️
plugins-redis_router_sequelize 60.95% <ø> (-0.04%) ⬇️
plugins-test-and-upstream-rhea_undici_url 60.53% <ø> (-0.04%) ⬇️
plugins-valkey_vm_winston 57.16% <ø> (-0.04%) ⬇️
plugins-ws 58.71% <ø> (-0.04%) ⬇️
profiling 61.13% <ø> (-0.04%) ⬇️
serverless-aws-sdk-aws-sdk 54.38% <ø> (-0.04%) ⬇️
serverless-aws-sdk-base-inject-field 50.45% <ø> (-0.05%) ⬇️
serverless-aws-sdk-bedrockruntime 54.17% <ø> (-0.04%) ⬇️
serverless-aws-sdk-client 55.68% <ø> (-0.04%) ⬇️
serverless-aws-sdk-dynamodb 55.00% <ø> (-0.03%) ⬇️
serverless-aws-sdk-eventbridge 56.47% <ø> (-0.04%) ⬇️
serverless-aws-sdk-kinesis 58.52% <ø> (-0.04%) ⬇️
serverless-aws-sdk-lambda 56.70% <ø> (-0.04%) ⬇️
serverless-aws-sdk-s3 55.08% <ø> (-0.04%) ⬇️
serverless-aws-sdk-serverless-peer-service 59.10% <ø> (-0.04%) ⬇️
serverless-aws-sdk-sns 59.31% <ø> (-0.04%) ⬇️
serverless-aws-sdk-sqs 59.76% <ø> (+<0.01%) ⬆️
serverless-aws-sdk-stepfunctions 54.91% <ø> (-0.04%) ⬇️
serverless-aws-sdk-util 50.96% <ø> (-0.05%) ⬇️
serverless-azure-functions-servicebus 52.29% <ø> (?)
serverless-bucket-0 53.78% <ø> (+0.43%) ⬆️
serverless-bucket-1 58.33% <ø> (-0.04%) ⬇️
test-bucket-0 66.84% <ø> (?)
test-bucket-1 63.97% <ø> (?)
test-optimization-cucumber 70.59% <ø> (+<0.01%) ⬆️
test-optimization-cypress 64.74% <ø> (+0.04%) ⬆️
test-optimization-jest 71.98% <ø> (-0.01%) ⬇️
test-optimization-mocha 72.05% <ø> (+0.03%) ⬆️
test-optimization-playwright-playwright-atr 59.50% <ø> (-0.04%) ⬇️
test-optimization-playwright-playwright-efd 59.66% <ø> (-0.03%) ⬇️
test-optimization-playwright-playwright-final-status 59.82% <ø> (-0.04%) ⬇️
test-optimization-playwright-playwright-impacted-tests 59.38% <ø> (+0.18%) ⬆️
test-optimization-playwright-playwright-reporting 61.03% <ø> (+0.10%) ⬆️
test-optimization-playwright-playwright-test-management 60.31% <ø> (-0.15%) ⬇️
test-optimization-playwright-playwright-test-span 59.55% <ø> (-0.09%) ⬇️
test-optimization-selenium 58.76% <ø> (-0.16%) ⬇️
test-optimization-testopt 57.41% <ø> (+0.06%) ⬆️
test-optimization-vitest 72.69% <ø> (+0.01%) ⬆️
test-optimization-vitest-browser 58.61% <ø> (-0.03%) ⬇️
test-optimization-webdriverio 64.89% <ø> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a shared internal EVP proxy “route + discovery” contract under src/evp_proxy/ and migrates OpenFeature exposure delivery to use it, while leaving CI Visibility and LLMObs behavior unchanged (with TODO markers for future migration).

Changes:

  • Introduces shared EVP proxy constants, path-joining helper, and /info-based route discovery/selection logic.
  • Refactors OpenFeature Agent v2 exposure writer to accept/use a discovered or caller-supplied { url, basePath } route.
  • Adds unit tests for EVP proxy utilities and extends OpenFeature tests to cover route injection and propagation.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/dd-trace/test/openfeature/writers/util.spec.js Adds coverage for OpenFeature’s agent strategy using shared EVP discovery.
packages/dd-trace/test/openfeature/writers/exposures.spec.js Verifies writer can use a caller-supplied EVP route (no discovery).
packages/dd-trace/test/openfeature/index.spec.js Ensures discovered route is passed through to the exposures writer.
packages/dd-trace/test/evp_proxy/path.spec.js Adds tests for shared EVP proxy path joining behavior.
packages/dd-trace/test/evp_proxy/discovery.spec.js Adds tests for EVP proxy discovery and path selection.
packages/dd-trace/test/evp_proxy/constants.spec.js Adds tests for shared EVP proxy constants.
packages/dd-trace/src/openfeature/writers/util.js Switches OpenFeature agent strategy to discoverEVPProxy() and returns route.
packages/dd-trace/src/openfeature/writers/exposures.js Adds route support (constructor + setEnabled) and uses shared constants/path joiner.
packages/dd-trace/src/openfeature/index.js Passes (hasAgent, route) into exposuresWriter.setEnabled().
packages/dd-trace/src/openfeature/constants/constants.js Removes OpenFeature-local EVP proxy constants now provided by shared module.
packages/dd-trace/src/llmobs/writers/util.js Adds TODO hint to migrate to shared EVP proxy utilities later.
packages/dd-trace/src/llmobs/writers/base.js Adds TODO hint for migrating EVP headers/subdomain to shared utilities later.
packages/dd-trace/src/evp_proxy/path.js Adds shared helper to join proxy base path + product endpoint safely (trailing/leading slash normalization).
packages/dd-trace/src/evp_proxy/discovery.js Adds shared discovery + selection logic based on Agent /info.
packages/dd-trace/src/evp_proxy/constants.js Adds shared EVP proxy constants (paths + header + common subdomain).
packages/dd-trace/src/ci-visibility/exporters/agentless/writer.js Adds TODO hint to migrate EVP headers/subdomain to shared utilities later.
packages/dd-trace/src/ci-visibility/exporters/agent-proxy/index.js Adds TODO hint to migrate to shared EVP utilities later.
package.json Adds test:evp_proxy and includes EVP proxy tests in test:openfeature.
.github/CODEOWNERS Adds ownership entries for new src/test/evp_proxy directories.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Add shared EVP protocol constants, route discovery, and path construction.\n\nRefactor the existing Feature Flags Agent path to use the shared utilities. Add migration pointers for CI Visibility and LLM Observability. Document the Agent-compatible receiver contract.
@leoromanovsky
leoromanovsky force-pushed the leo.romanovsky/evp-proxy-utilities branch from 92d1d56 to 59ba684 Compare August 8, 2026 04:09
@leoromanovsky
leoromanovsky marked this pull request as ready for review August 8, 2026 05:24
@leoromanovsky
leoromanovsky requested review from a team as code owners August 8, 2026 05:24
@leoromanovsky
leoromanovsky requested review from BridgeAR, btthomas and dd-oleksii and removed request for a team August 8, 2026 05:24

@datadog-datadog-prod-us1-2 datadog-datadog-prod-us1-2 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Datadog Autotest: PASS

More details

The Agent’s actual /info contract matches the new normalization logic. A realistic discovery-to-delivery flow preserved the selected route, EVP subdomain header, buffered exposure, and serialized payload.

Was this helpful? React 👍 or 👎

📊 Validated against 8 scenarios · Open Bits AI session

🤖 Datadog Autotest · Commit 59ba684 · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest

sameerank
sameerank previously approved these changes Aug 12, 2026
Comment thread packages/dd-trace/test/evp_proxy/discovery.spec.js Outdated
dd-oleksii
dd-oleksii previously approved these changes Aug 12, 2026

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

Copy link
Copy Markdown

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.

Reviewed commit: 2849f0e63d

ℹ️ 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 thread .github/CODEOWNERS Outdated
dd-oleksii
dd-oleksii previously approved these changes Aug 13, 2026
@leoromanovsky
leoromanovsky merged commit f125075 into master Aug 18, 2026
1389 of 1396 checks passed
@leoromanovsky
leoromanovsky deleted the leo.romanovsky/evp-proxy-utilities branch August 18, 2026 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants