Skip to content

fix(proxy): retain feature modules across tracing reconfiguration#9331

Merged
BridgeAR merged 4 commits into
masterfrom
BridgeAR/2026-07-13-openfeature-reconfigure
Jul 15, 2026
Merged

fix(proxy): retain feature modules across tracing reconfiguration#9331
BridgeAR merged 4 commits into
masterfrom
BridgeAR/2026-07-13-openfeature-reconfigure

Conversation

@BridgeAR

Copy link
Copy Markdown
Member

Summary

Remote configuration can disable and later re-enable tracing in one process. This retains the OpenFeature provider registered by callers, then restores OpenFeature exposure reporting and AI Guard integrations when tracing returns.

@dd-octo-sts

dd-octo-sts Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Overall package size

Self size: 6.77 MB
Deduped: 7.43 MB
No deduping: 7.43 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.3.1 | 122.62 kB | 438.86 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-prod-us1-4

datadog-prod-us1-4 Bot commented Jul 14, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 96.61% (-0.00%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 82fbf8e | Docs | Datadog PR Page | Give us feedback!

@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.64%. Comparing base (51fdd86) to head (82fbf8e).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9331      +/-   ##
==========================================
- Coverage   96.65%   96.64%   -0.02%     
==========================================
  Files         923      923              
  Lines      122977   122993      +16     
  Branches    21408    21751     +343     
==========================================
+ Hits       118861   118863       +2     
- Misses       4116     4130      +14     
Flag Coverage Δ
aiguard 53.64% <57.89%> (-0.05%) ⬇️
aiguard-integration 57.10% <57.89%> (-0.01%) ⬇️
apm-bucket-0 53.87% <47.36%> (-0.05%) ⬇️
apm-bucket-1 58.44% <47.36%> (-0.05%) ⬇️
apm-bucket-2 56.17% <47.36%> (-0.05%) ⬇️
apm-capabilities-tracing 60.66% <57.89%> (-0.01%) ⬇️
apm-integrations-aerospike 53.02% <47.36%> (-0.05%) ⬇️
apm-integrations-confluentinc-kafka-javascript 57.11% <47.36%> (-0.05%) ⬇️
apm-integrations-couchbase 53.36% <47.36%> (-0.05%) ⬇️
apm-integrations-http 58.03% <47.36%> (-0.05%) ⬇️
apm-integrations-kafkajs 57.82% <47.36%> (-0.05%) ⬇️
apm-integrations-next 54.25% <47.36%> (-0.05%) ⬇️
apm-integrations-prisma 54.25% <47.36%> (-0.05%) ⬇️
apm-integrations-tedious 53.13% <47.36%> (-0.05%) ⬇️
appsec 68.90% <47.36%> (+<0.01%) ⬆️
appsec-express_fastify_graphql 65.73% <47.36%> (-0.04%) ⬇️
appsec-integration 51.94% <47.36%> (-0.01%) ⬇️
appsec-kafka_ldapjs_lodash 59.16% <47.36%> (-0.05%) ⬇️
appsec-mongodb-core_mongoose_mysql 62.39% <47.36%> (-0.05%) ⬇️
appsec-next 52.85% <47.36%> (-0.04%) ⬇️
appsec-node-serialize_passport_postgres 62.03% <47.36%> (-0.04%) ⬇️
appsec-sourcing_stripe_template 60.42% <47.36%> (-0.04%) ⬇️
debugger 65.69% <73.68%> (-0.01%) ⬇️
instrumentations-bucket-0 48.88% <47.36%> (-0.05%) ⬇️
instrumentations-bucket-1 55.08% <47.36%> (-0.05%) ⬇️
instrumentations-bucket-10 56.70% <47.36%> (-0.05%) ⬇️
instrumentations-bucket-11 48.87% <47.36%> (-0.05%) ⬇️
instrumentations-bucket-12 49.04% <47.36%> (-0.05%) ⬇️
instrumentations-bucket-13 48.81% <47.36%> (-0.05%) ⬇️
instrumentations-bucket-2 50.01% <47.36%> (-0.05%) ⬇️
instrumentations-bucket-3 53.98% <47.36%> (-0.05%) ⬇️
instrumentations-bucket-4 49.28% <47.36%> (-0.05%) ⬇️
instrumentations-bucket-5 53.13% <47.36%> (-0.05%) ⬇️
instrumentations-bucket-6 55.72% <47.36%> (-0.05%) ⬇️
instrumentations-bucket-7 53.62% <47.36%> (-0.05%) ⬇️
instrumentations-bucket-8 54.75% <47.36%> (-0.05%) ⬇️
instrumentations-bucket-9 56.18% <47.36%> (-0.05%) ⬇️
instrumentations-instrumentation-couchbase 48.27% <47.36%> (-0.05%) ⬇️
instrumentations-integration-esbuild 34.05% <42.10%> (+<0.01%) ⬆️
llmobs-ai_anthropic_bedrock 57.76% <47.36%> (-0.05%) ⬇️
llmobs-bucket-1 57.10% <47.36%> (-0.04%) ⬇️
llmobs-openai 57.49% <47.36%> (-0.05%) ⬇️
llmobs-sdk 60.06% <47.36%> (-0.05%) ⬇️
llmobs-vertex-ai 54.30% <47.36%> (-0.05%) ⬇️
master-coverage 96.64% <100.00%> (?)
openfeature 54.71% <89.47%> (+0.02%) ⬆️
openfeature-unit 49.93% <89.47%> (-0.02%) ⬇️
platform-core_esbuild_instrumentations-misc 38.52% <47.36%> (-0.03%) ⬇️
platform-integration 62.32% <47.36%> (-0.01%) ⬇️
platform-shimmer_unit-guardrails_webpack 37.32% <47.36%> (-0.03%) ⬇️
plugins-bucket-0 53.25% <47.36%> (-0.05%) ⬇️
plugins-bucket-1 55.19% <47.36%> (-0.01%) ⬇️
plugins-bucket-11 58.63% <47.36%> (+0.96%) ⬆️
plugins-bucket-17 56.89% <47.36%> (?)
plugins-bucket-18 57.60% <47.36%> (+0.40%) ⬆️
plugins-bucket-19 57.38% <47.36%> (+1.87%) ⬆️
plugins-bucket-20 59.45% <47.36%> (+1.74%) ⬆️
plugins-bucket-4 53.87% <47.36%> (-0.05%) ⬇️
plugins-bullmq_cassandra_cookie 57.46% <47.36%> (-0.05%) ⬇️
plugins-cookie-parser_crypto_dd-trace-api 52.41% <47.36%> (-0.05%) ⬇️
plugins-fetch_fs_generic-pool 54.58% <47.36%> (-0.13%) ⬇️
plugins-google-cloud-pubsub_grpc_handlebars 59.91% <47.36%> (-0.05%) ⬇️
plugins-hapi_hono_ioredis 55.85% <47.36%> (-0.05%) ⬇️
plugins-jest_knex_langgraph ?
plugins-jest_langgraph_ldapjs 51.74% <47.36%> (?)
plugins-ldapjs_light-my-request_limitd-client ?
plugins-light-my-request_limitd-client_lodash 53.61% <47.36%> (?)
plugins-lodash_mariadb_memcached ?
plugins-mariadb_memcached_mercurius 56.91% <47.36%> (?)
plugins-moleculer_mongodb_mongodb-core ?
plugins-mongodb_mongodb-core_mongoose 55.53% <47.36%> (?)
plugins-mongoose_multer_mysql ?
plugins-multer_mysql_mysql2 54.45% <47.36%> (?)
plugins-mysql2_nats_node-serialize ?
plugins-nats_node-serialize_opensearch 56.17% <47.36%> (?)
plugins-opensearch_passport-http_pino ?
plugins-passport-http_pino_postgres 54.83% <47.36%> (?)
plugins-postgres_process_pug ?
plugins-process_pug_redis 53.93% <47.36%> (?)
plugins-redis_router_sequelize ?
plugins-test-and-upstream-rhea_undici_url ?
plugins-undici_url_valkey 54.44% <47.36%> (?)
plugins-valkey_vm_winston ?
plugins-vm_winston_ws 55.39% <47.36%> (?)
plugins-ws ?
profiling 58.25% <47.36%> (-0.05%) ⬇️
serverless-aws-sdk-aws-sdk 50.75% <47.36%> (-0.04%) ⬇️
serverless-aws-sdk-bedrockruntime 50.74% <47.36%> (-0.05%) ⬇️
serverless-aws-sdk-client 52.08% <47.36%> (-0.05%) ⬇️
serverless-aws-sdk-dynamodb 51.80% <47.36%> (-0.07%) ⬇️
serverless-aws-sdk-eventbridge 46.44% <47.36%> (-0.05%) ⬇️
serverless-aws-sdk-kinesis 54.78% <47.36%> (-0.05%) ⬇️
serverless-aws-sdk-lambda 52.86% <47.36%> (-0.05%) ⬇️
serverless-aws-sdk-s3 51.58% <47.36%> (-0.05%) ⬇️
serverless-aws-sdk-serverless-peer-service 54.81% <47.36%> (-0.05%) ⬇️
serverless-aws-sdk-sns 55.53% <47.36%> (-0.05%) ⬇️
serverless-aws-sdk-sqs 55.95% <47.36%> (-0.12%) ⬇️
serverless-aws-sdk-stepfunctions 51.35% <47.36%> (-0.05%) ⬇️
serverless-aws-sdk-util 48.53% <47.36%> (-0.05%) ⬇️
serverless-bucket-0 55.23% <47.36%> (-0.01%) ⬇️
serverless-bucket-1 56.05% <47.36%> (-0.05%) ⬇️
test-optimization-cucumber 72.97% <73.68%> (+0.01%) ⬆️
test-optimization-cypress 66.37% <47.36%> (+0.01%) ⬆️
test-optimization-jest 74.37% <84.21%> (-0.03%) ⬇️
test-optimization-mocha 74.73% <73.68%> (+0.05%) ⬆️
test-optimization-playwright-playwright-atr 61.44% <47.36%> (+0.09%) ⬆️
test-optimization-playwright-playwright-efd 61.63% <47.36%> (+0.02%) ⬆️
test-optimization-playwright-playwright-final-status 61.60% <47.36%> (+0.02%) ⬆️
test-optimization-playwright-playwright-impacted-tests 61.32% <47.36%> (+0.03%) ⬆️
test-optimization-playwright-playwright-reporting 61.21% <47.36%> (+0.09%) ⬆️
test-optimization-playwright-playwright-test-management 61.88% <47.36%> (-0.38%) ⬇️
test-optimization-playwright-playwright-test-span 61.34% <47.36%> (-0.04%) ⬇️
test-optimization-selenium 60.74% <47.36%> (-0.14%) ⬇️
test-optimization-testopt 61.47% <47.36%> (+2.32%) ⬆️
test-optimization-vitest 71.30% <73.68%> (+0.04%) ⬆️

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.

@pr-commenter

pr-commenter Bot commented Jul 14, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-07-15 14:54:35

Comparing candidate commit 82fbf8e in PR branch BridgeAR/2026-07-13-openfeature-reconfigure with baseline commit 51fdd86 in branch master.

📊 Benchmarking dashboard

Found 0 performance improvements and 0 performance regressions! Performance is the same for 2320 metrics, 38 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-appsec-enabled-24

  • unstable execution_time [-207.822ms; +215.440ms] or [-7.840%; +8.127%]

scenario:appsec-appsec-enabled-26

  • unstable execution_time [-246390.362µs; +248386.396µs] or [-9.610%; +9.688%]

scenario:appsec-appsec-enabled-with-attacks-24

  • unstable execution_time [-157.609ms; +161.996ms] or [-5.100%; +5.242%]

scenario:appsec-appsec-enabled-with-attacks-26

  • unstable execution_time [-188.171ms; +143.380ms] or [-6.505%; +4.956%]

scenario:appsec-control-24

  • unstable execution_time [-117.514ms; +103.892ms] or [-9.524%; +8.420%]

scenario:appsec-control-26

  • unstable execution_time [-124338.976µs; +123516.143µs] or [-10.042%; +9.976%]

scenario:appsec-iast-no-vulnerability-control-20

  • unstable execution_time [-13400.213µs; +13501.551µs] or [-5.315%; +5.355%]

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

  • unstable execution_time [-33.754ms; +29.141ms] or [-6.131%; +5.293%]

scenario:child_process-file-args-24

  • unstable execution_time [-24508.650µs; +23901.183µs] or [-5.165%; +5.037%]

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

  • unstable cpu_user_time [-1941.795ms; +3160.403ms] or [-23.476%; +38.208%]
  • unstable execution_time [-1949.508ms; +3172.373ms] or [-21.724%; +35.350%]
  • unstable instructions [-16.8G instructions; +26.8G instructions] or [-24.831%; +39.656%]
  • unstable max_rss_usage [-7.814MB; +12.981MB] or [-4.981%; +8.274%]
  • unstable throughput [-853.733op/s; +517.226op/s] or [-23.270%; +14.098%]

scenario:debugger-line-probe-with-snapshot-default-26

  • unstable cpu_user_time [-3628.083ms; +3656.371ms] or [-35.166%; +35.441%]
  • unstable execution_time [-3637.055ms; +3627.086ms] or [-32.874%; +32.784%]
  • unstable instructions [-32224.4M instructions; +32362.5M instructions] or [-37.247%; +37.407%]
  • unstable max_rss_usage [-11599.859KB; +11456.659KB] or [-7.156%; +7.068%]
  • unstable throughput [-706.773op/s; +715.845op/s] or [-23.051%; +23.346%]

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

  • unstable cpu_user_time [-3621.290ms; +5148.148ms] or [-32.750%; +46.558%]
  • unstable execution_time [-3754.243ms; +5308.247ms] or [-31.786%; +44.944%]
  • unstable instructions [-31.8G instructions; +45.7G instructions] or [-34.112%; +48.919%]
  • unstable max_rss_usage [-12.559MB; +15.400MB] or [-7.622%; +9.346%]
  • unstable throughput [-1042.458op/s; +733.585op/s] or [-35.423%; +24.928%]

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

  • unstable cpu_user_time [-1.658s; +6.250s] or [-13.143%; +49.530%]
  • unstable execution_time [-1.701s; +6.332s] or [-12.708%; +47.319%]
  • unstable instructions [-14.3G instructions; +55.5G instructions] or [-13.382%; +51.858%]
  • unstable max_rss_usage [-5.518MB; +20.390MB] or [-3.270%; +12.082%]
  • unstable throughput [-1240.813op/s; +337.529op/s] or [-47.311%; +12.870%]

scenario:dogstatsd-with-tags-20

  • unstable cpu_user_time [-319.341ms; +261.842ms] or [-6.932%; +5.684%]
  • unstable execution_time [-315.553ms; +262.932ms] or [-6.727%; +5.605%]
  • unstable throughput [-95590.844op/s; +108136.353op/s] or [-5.348%; +6.049%]

scenario:plugin-claude-agent-sdk-compact-hook-indexed-24

  • unstable cpu_usage_percentage [-6.811%; +3.895%]

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

  • unstable cpu_usage_percentage [-5.805%; +4.466%]

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

  • unstable cpu_usage_percentage [-6.676%; +3.463%]

scenario:plugin-graphql-long-with-depth-on-max-20

  • unstable cpu_user_time [-755098.961µs; +753387.961µs] or [-5.878%; +5.865%]
  • unstable execution_time [-764.743ms; +752.750ms] or [-5.822%; +5.730%]
  • unstable throughput [-3.433op/s; +3.520op/s] or [-5.602%; +5.743%]

@BridgeAR
BridgeAR marked this pull request as ready for review July 14, 2026 14:53
@BridgeAR
BridgeAR requested a review from a team as a code owner July 14, 2026 14:53
@BridgeAR
BridgeAR force-pushed the BridgeAR/2026-07-13-openfeature-reconfigure branch from e86c187 to 8d8d4fc Compare July 15, 2026 08:31
@BridgeAR
BridgeAR requested a review from a team as a code owner July 15, 2026 08:31
@BridgeAR
BridgeAR requested review from leoromanovsky and sameerank and removed request for a team July 15, 2026 08:31
sameerank
sameerank previously approved these changes Jul 15, 2026
proxy._modules.openfeature.enable(config)
lazyProxy(proxy, 'openfeature', () => require('./flagging_provider'), tracer, config)
const openfeature = proxy._modules.openfeature
const shouldCreateProvider = openfeature.module === undefined

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.

Looks similar to #9359

You check if undefined and I checked the provider properties of the public proxy.openfeature object

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I just combined both approaches, since your approach seemed more correct overall :)

bss and others added 4 commits July 15, 2026 16:43
…onfigure

`Tracer#updateTracing` runs on the initial `init()` and again on every
`APM_TRACING` remote-config update (via the reconfigure callback registered in
`init`). The OpenFeature provider's `lazyProxy` was outside the
`_tracingInitialized` guard, so in the non-serverless path `defineEagerly`
reassigned `tracer.openfeature = new FlaggingProvider(...)` on each reconfigure.

Consumers register the provider once with the OpenFeature SDK, e.g.
`OpenFeature.setProvider(tracer.openfeature)`. When a remote-config update then
replaces the instance, remote flag configuration is applied (via the FFE_FLAGS
product handler's `() => this.openfeature`) to the new instance while the SDK
keeps evaluating against the original, now-orphaned one. That orphaned provider
never receives configuration, stays in its error/not-ready state, and evaluations
fall back to defaults for the lifetime of the process.

Move the provider creation inside the `_tracingInitialized` guard, alongside the
other tracing SDKs (appsec/llmobs/aiguard), so it is created exactly once and the
instance consumers registered keeps receiving remote config.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This makes sure OpenFeature exposure reporting and AI Guard integrations resume after remote config re-enables tracing, without replacing their public SDKs.
AI Guard remained disabled when a remote configuration restored tracing, leaving its SDK active without its feature module.
The generic proxy and the feature registration hook both created a provider during initial non-serverless setup, orphaning the first instance. Keep creation in the feature registration and gate it on the public provider so consumers remain bound to the object receiving FFE_FLAGS.
@BridgeAR
BridgeAR force-pushed the BridgeAR/2026-07-13-openfeature-reconfigure branch from 8d8d4fc to 82fbf8e Compare July 15, 2026 14:43
@BridgeAR
BridgeAR requested a review from a team as a code owner July 15, 2026 14:43
@BridgeAR
BridgeAR merged commit e45de38 into master Jul 15, 2026
873 of 880 checks passed
@BridgeAR
BridgeAR deleted the BridgeAR/2026-07-13-openfeature-reconfigure branch July 15, 2026 16:27
dd-octo-sts Bot pushed a commit that referenced this pull request Jul 16, 2026
)

Remote configuration that disables and re-enables tracing could leave OpenFeature consumers bound to an orphaned provider and leave AI Guard integrations unsubscribed. Preserve lazily initialized feature modules across reconfiguration and re-enable their integrations when tracing resumes.

Co-authored-by: Bo Stendal Sørensen <[email protected]>
Co-authored-by: Sameeran Kunche <[email protected]
@dd-octo-sts dd-octo-sts Bot mentioned this pull request Jul 16, 2026
dd-octo-sts Bot pushed a commit that referenced this pull request Jul 16, 2026
)

Remote configuration that disables and re-enables tracing could leave OpenFeature consumers bound to an orphaned provider and leave AI Guard integrations unsubscribed. Preserve lazily initialized feature modules across reconfiguration and re-enable their integrations when tracing resumes.

Co-authored-by: Bo Stendal Sørensen <[email protected]>
Co-authored-by: Sameeran Kunche <[email protected]
@dd-octo-sts dd-octo-sts Bot mentioned this pull request Jul 16, 2026
juan-fernandez pushed a commit that referenced this pull request Jul 16, 2026
)

Remote configuration that disables and re-enables tracing could leave OpenFeature consumers bound to an orphaned provider and leave AI Guard integrations unsubscribed. Preserve lazily initialized feature modules across reconfiguration and re-enable their integrations when tracing resumes.

Co-authored-by: Bo Stendal Sørensen <[email protected]>
Co-authored-by: Sameeran Kunche <[email protected]
juan-fernandez pushed a commit that referenced this pull request Jul 16, 2026
)

Remote configuration that disables and re-enables tracing could leave OpenFeature consumers bound to an orphaned provider and leave AI Guard integrations unsubscribed. Preserve lazily initialized feature modules across reconfiguration and re-enable their integrations when tracing resumes.

Co-authored-by: Bo Stendal Sørensen <[email protected]>
Co-authored-by: Sameeran Kunche <[email protected]
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.

3 participants