Skip to content

feat(electron): ship dd-trace-electron package with reduced dependencies#8948

Merged
tlhunter merged 16 commits into
masterfrom
rochdev/dd-trace-electron-package
Jul 14, 2026
Merged

feat(electron): ship dd-trace-electron package with reduced dependencies#8948
tlhunter merged 16 commits into
masterfrom
rochdev/dd-trace-electron-package

Conversation

@rochdev

@rochdev rochdev commented Jun 16, 2026

Copy link
Copy Markdown
Member

What does this PR do?

Adds the infrastructure to publish a separate dd-trace-electron npm package alongside the existing dd-trace package. Both packages ship identical source code — only the package.json dependencies differ.

  • scripts/electron-package-excludes.json — human-maintained list of optional dependencies to strip from the Electron build (native binaries not compatible with Electron)
  • scripts/generate-electron-package.js — generates package.electron.json from package.json minus the exclusion list; supports --check mode
  • scripts/release/publish-electron.js — swaps package.jsonpackage.electron.json at publish time, runs npm publish, then restores (mirrors the existing swap-v5-types.js pattern)
  • Release workflow jobs publish-electron-latest and publish-electron-dev call the publish script after their regular counterparts
  • packages/dd-trace/src/bootstrap.js — shared tracer initialization extracted so both entrypoints can require it without depending on each other
  • packages/dd-trace/index.electron.js and root index.electron.js — Electron entrypoints that omit OpenFeature registration
  • OpenFeature is made self-registering via Tracer.registerFeature / NoopProxy.registerNoop, so the Electron entrypoint cleanly excludes it by simply not requiring src/openfeature/register.js

Motivation

Electron apps cannot load native Node.js addons (.node files) the same way server apps can, and several of dd-trace's optional dependencies are native binaries (profiler, AppSec WAF, IAST taint tracking, etc.). Shipping a dedicated dd-trace-electron package lets Electron users get tracing without fighting optional dependency install failures.

Additional Notes

  • package.electron.json is gitignored — it is generated at publish time by publish-electron.js, never committed
  • Dependabot is unaffected: it only watches files named package.json
  • The two packages share 100% of source code; divergence is structurally impossible

Generated by Claude Code

@datadog-official

datadog-official Bot commented Jun 16, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🔄 Datadog auto-retried 1 job - 1 passed on retry View in Datadog

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 96.53% (+0.02%)

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

@dd-octo-sts

dd-octo-sts Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Overall package size

Self size: 6.71 MB
Deduped: 7.37 MB
No deduping: 7.37 MB

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

@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.57%. Comparing base (f8d1b6f) to head (54ca533).
⚠️ Report is 12 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8948      +/-   ##
==========================================
+ Coverage   96.55%   96.57%   +0.01%     
==========================================
  Files         918      921       +3     
  Lines      121410   121633     +223     
  Branches    20900    21190     +290     
==========================================
+ Hits       117229   117464     +235     
+ Misses       4181     4169      -12     
Flag Coverage Δ
aiguard 53.63% <93.16%> (-0.04%) ⬇️
aiguard-integration 57.06% <88.88%> (+0.01%) ⬆️
apm-bucket-0 53.86% <93.16%> (-0.04%) ⬇️
apm-bucket-1 58.14% <93.16%> (-0.06%) ⬇️
apm-bucket-2 56.17% <93.16%> (-0.05%) ⬇️
apm-capabilities-tracing 60.51% <95.72%> (+0.24%) ⬆️
apm-integrations-aerospike 53.01% <93.16%> (-0.05%) ⬇️
apm-integrations-confluentinc-kafka-javascript 57.12% <93.16%> (-0.05%) ⬇️
apm-integrations-couchbase 53.34% <93.16%> (-0.03%) ⬇️
apm-integrations-http 58.01% <93.16%> (-0.06%) ⬇️
apm-integrations-kafkajs 57.77% <93.16%> (-0.07%) ⬇️
apm-integrations-next 54.30% <93.16%> (-0.04%) ⬇️
apm-integrations-prisma 54.23% <93.16%> (-0.04%) ⬇️
apm-integrations-tedious 53.11% <93.16%> (-0.04%) ⬇️
appsec 68.99% <93.16%> (-0.15%) ⬇️
appsec-express_fastify_graphql 65.64% <93.16%> (-0.09%) ⬇️
appsec-integration 45.63% <93.16%> (+0.03%) ⬆️
appsec-kafka_ldapjs_lodash 59.14% <93.16%> (-0.06%) ⬇️
appsec-mongodb-core_mongoose_mysql 62.29% <93.16%> (-0.07%) ⬇️
appsec-next 52.91% <93.16%> (-0.04%) ⬇️
appsec-node-serialize_passport_postgres 61.92% <93.16%> (-0.07%) ⬇️
appsec-sourcing_stripe_template 60.28% <93.16%> (-0.07%) ⬇️
debugger 65.78% <100.00%> (+0.04%) ⬆️
instrumentations-bucket-0 48.83% <93.16%> (-0.03%) ⬇️
instrumentations-bucket-1 55.02% <93.16%> (-0.05%) ⬇️
instrumentations-bucket-10 56.68% <93.16%> (-0.06%) ⬇️
instrumentations-bucket-11 48.82% <93.16%> (-0.03%) ⬇️
instrumentations-bucket-12 48.92% <93.16%> (-0.03%) ⬇️
instrumentations-bucket-13 48.76% <93.16%> (-0.03%) ⬇️
instrumentations-bucket-2 49.81% <93.16%> (-0.03%) ⬇️
instrumentations-bucket-3 53.89% <93.16%> (-0.04%) ⬇️
instrumentations-bucket-4 49.24% <93.16%> (-0.03%) ⬇️
instrumentations-bucket-5 53.07% <93.16%> (-0.03%) ⬇️
instrumentations-bucket-6 55.67% <93.16%> (-0.05%) ⬇️
instrumentations-bucket-7 53.67% <93.16%> (-0.03%) ⬇️
instrumentations-bucket-8 54.70% <93.16%> (-0.04%) ⬇️
instrumentations-bucket-9 56.15% <93.16%> (-0.05%) ⬇️
instrumentations-instrumentation-couchbase 48.26% <93.16%> (-0.02%) ⬇️
instrumentations-integration-esbuild 34.02% <82.05%> (+0.05%) ⬆️
llmobs-ai_anthropic_bedrock 57.78% <93.16%> (-0.05%) ⬇️
llmobs-bucket-1 57.04% <93.16%> (-0.05%) ⬇️
llmobs-openai 57.62% <93.16%> (-0.05%) ⬇️
llmobs-sdk 60.00% <93.16%> (-0.07%) ⬇️
llmobs-vertex-ai 54.27% <93.16%> (-0.04%) ⬇️
master-coverage 96.57% <100.00%> (?)
openfeature 54.68% <91.45%> (+0.02%) ⬆️
openfeature-unit 49.91% <93.16%> (-0.02%) ⬇️
platform-core_esbuild_instrumentations-misc 38.51% <93.16%> (+0.04%) ⬆️
platform-integration 62.28% <93.16%> (+0.04%) ⬆️
platform-shimmer_unit-guardrails_webpack 37.34% <93.16%> (+0.08%) ⬆️
plugins-axios_body-parser_bullmq ?
plugins-bucket-0 53.24% <93.16%> (-0.03%) ⬇️
plugins-bucket-1 55.15% <93.16%> (+0.02%) ⬆️
plugins-bucket-11 55.66% <93.16%> (-0.02%) ⬇️
plugins-bucket-17 ?
plugins-bucket-18 57.13% <93.16%> (-4.00%) ⬇️
plugins-bucket-19 55.45% <93.16%> (-0.05%) ⬇️
plugins-bucket-20 57.50% <93.16%> (-0.06%) ⬇️
plugins-bucket-4 53.91% <93.16%> (-0.04%) ⬇️
plugins-bullmq_cassandra_cookie 57.46% <93.16%> (-0.05%) ⬇️
plugins-cookie-parser_crypto_dd-trace-api 52.39% <93.16%> (-0.04%) ⬇️
plugins-fetch_fs_generic-pool 54.61% <93.16%> (+0.03%) ⬆️
plugins-google-cloud-pubsub_grpc_handlebars 59.92% <93.16%> (-0.06%) ⬇️
plugins-hapi_hono_ioredis 55.92% <93.16%> (-0.05%) ⬇️
plugins-jest_knex_langgraph 51.74% <93.16%> (-0.03%) ⬇️
plugins-ldapjs_light-my-request_limitd-client 53.48% <93.16%> (-0.06%) ⬇️
plugins-lodash_mariadb_memcached 54.28% <93.16%> (-0.04%) ⬇️
plugins-moleculer_mongodb_mongodb-core 57.35% <93.16%> (-0.06%) ⬇️
plugins-mongoose_multer_mysql 54.77% <93.16%> (-0.04%) ⬇️
plugins-mysql2_nats_node-serialize 56.27% <93.16%> (-0.05%) ⬇️
plugins-opensearch_passport-http_pino 55.12% <93.16%> (-0.05%) ⬇️
plugins-postgres_process_pug 54.36% <93.16%> (-0.04%) ⬇️
plugins-redis_router_sequelize 57.09% <93.16%> (-0.06%) ⬇️
plugins-test-and-upstream-rhea_undici_url 57.09% <93.16%> (-0.05%) ⬇️
plugins-valkey_vm_winston 54.00% <93.16%> (+0.04%) ⬆️
plugins-ws 54.86% <93.16%> (-0.05%) ⬇️
profiling 58.26% <93.16%> (-0.04%) ⬇️
serverless-aws-sdk-aws-sdk 50.73% <93.16%> (-0.02%) ⬇️
serverless-aws-sdk-bedrockruntime 50.75% <93.16%> (-0.02%) ⬇️
serverless-aws-sdk-client 52.04% <93.16%> (-0.01%) ⬇️
serverless-aws-sdk-dynamodb 51.84% <93.16%> (+<0.01%) ⬆️
serverless-aws-sdk-eventbridge 46.32% <93.16%> (+<0.01%) ⬆️
serverless-aws-sdk-kinesis 54.77% <93.16%> (-0.03%) ⬇️
serverless-aws-sdk-lambda 52.85% <93.16%> (-0.03%) ⬇️
serverless-aws-sdk-s3 51.60% <93.16%> (-0.03%) ⬇️
serverless-aws-sdk-serverless-peer-service 54.79% <93.16%> (-0.03%) ⬇️
serverless-aws-sdk-sns 55.54% <93.16%> (-0.04%) ⬇️
serverless-aws-sdk-sqs 55.97% <93.16%> (-0.04%) ⬇️
serverless-aws-sdk-stepfunctions 51.32% <93.16%> (-0.03%) ⬇️
serverless-aws-sdk-util 48.56% <93.16%> (-0.01%) ⬇️
serverless-bucket-0 55.29% <88.88%> (+<0.01%) ⬆️
serverless-bucket-1 56.06% <93.16%> (-0.05%) ⬇️
test-optimization-cucumber 72.96% <97.43%> (+0.03%) ⬆️
test-optimization-cypress 66.42% <88.03%> (+0.02%) ⬆️
test-optimization-jest 73.96% <100.00%> (-0.01%) ⬇️
test-optimization-mocha 74.33% <100.00%> (+0.04%) ⬆️
test-optimization-playwright-playwright-atr 61.60% <88.03%> (-0.05%) ⬇️
test-optimization-playwright-playwright-efd 61.79% <88.03%> (-0.04%) ⬇️
test-optimization-playwright-playwright-final-status 61.75% <88.03%> (-0.05%) ⬇️
test-optimization-playwright-playwright-impacted-tests 61.47% <88.03%> (+0.12%) ⬆️
test-optimization-playwright-playwright-reporting 61.38% <88.03%> (-0.05%) ⬇️
test-optimization-playwright-playwright-test-management 62.28% <88.03%> (-0.26%) ⬇️
test-optimization-playwright-playwright-test-span 61.52% <88.03%> (-0.10%) ⬇️
test-optimization-selenium 60.70% <88.03%> (-0.14%) ⬇️
test-optimization-testopt 59.19% <93.16%> (+0.08%) ⬆️
test-optimization-vitest 71.60% <97.43%> (-1.15%) ⬇️

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 Jun 16, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-07-10 19:32:29

Comparing candidate commit 54ca533 in PR branch rochdev/dd-trace-electron-package with baseline commit f8d1b6f in branch master.

📊 Benchmarking dashboard

Found 0 performance improvements and 0 performance regressions! Performance is the same for 2314 metrics, 44 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 [-210.371ms; +215.858ms] or [-7.907%; +8.114%]

scenario:appsec-appsec-enabled-26

  • unstable execution_time [-235.266ms; +238.034ms] or [-9.198%; +9.306%]

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

  • unstable execution_time [-162.109ms; +169.511ms] or [-5.251%; +5.490%]

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

  • unstable execution_time [-179.650ms; +185.916ms] or [-6.180%; +6.396%]

scenario:appsec-control-20

  • unstable execution_time [-125466.999µs; +126704.766µs] or [-7.636%; +7.711%]

scenario:appsec-control-24

  • unstable execution_time [-111.402ms; +109.124ms] or [-8.999%; +8.815%]

scenario:appsec-control-26

  • unstable execution_time [-132.524ms; +115.464ms] or [-10.807%; +9.416%]

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

  • unstable execution_time [-18.713ms; +25.684ms] or [-7.202%; +9.885%]

scenario:appsec-iast-no-vulnerability-iast-enabled-always-active-20

  • unstable execution_time [-17.729ms; +13.340ms] or [-6.990%; +5.259%]

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

  • unstable cpu_user_time [-556.127ms; +252.451ms] or [-6.971%; +3.164%]
  • unstable execution_time [-639.828ms; +343.877ms] or [-7.363%; +3.957%]
  • unstable throughput [-137.979op/s; +268.235op/s] or [-3.730%; +7.250%]

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

  • unstable cpu_user_time [-2.711s; +5.807s] or [-26.253%; +56.228%]
  • unstable execution_time [-2.835s; +5.964s] or [-25.618%; +53.890%]
  • unstable instructions [-23.7G instructions; +51.2G instructions] or [-27.419%; +59.182%]
  • unstable max_rss_usage [-7.189MB; +17.890MB] or [-4.436%; +11.039%]
  • unstable throughput [-1153.538op/s; +558.533op/s] or [-37.465%; +18.140%]

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

  • unstable cpu_user_time [-2761.325ms; +3754.074ms] or [-29.049%; +39.493%]
  • unstable execution_time [-2767.951ms; +3785.278ms] or [-27.073%; +37.024%]
  • unstable instructions [-23.6G instructions; +32.2G instructions] or [-30.209%; +41.221%]
  • unstable max_rss_usage [-11.621MB; +16.029MB] or [-7.186%; +9.912%]
  • unstable throughput [-1003.075op/s; +748.709op/s] or [-30.205%; +22.545%]

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

  • unstable cpu_user_time [-3.180s; +0.469s] or [-31.268%; +4.610%]
  • unstable execution_time [-3.206s; +0.475s] or [-29.422%; +4.362%]
  • unstable instructions [-28.4G instructions; +3.9G instructions] or [-33.421%; +4.584%]
  • unstable throughput [-102.814op/s; +655.307op/s] or [-3.326%; +21.202%]

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

  • unstable cpu_user_time [-1719.683ms; +2763.069ms] or [-20.996%; +33.735%]
  • unstable execution_time [-1717.777ms; +2732.250ms] or [-19.317%; +30.725%]
  • unstable instructions [-14.5G instructions; +23.1G instructions] or [-21.755%; +34.567%]
  • unstable max_rss_usage [-7.128MB; +11.138MB] or [-4.558%; +7.123%]
  • unstable throughput [-778.781op/s; +489.704op/s] or [-21.150%; +13.299%]

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

  • unstable cpu_user_time [-2875.982ms; +2886.325ms] or [-28.810%; +28.914%]
  • unstable execution_time [-2905.765ms; +2867.375ms] or [-27.121%; +26.763%]
  • unstable instructions [-25746.7M instructions; +25683.6M instructions] or [-30.782%; +30.707%]
  • unstable max_rss_usage [-8477.084KB; +9453.084KB] or [-5.263%; +5.869%]
  • unstable throughput [-625.256op/s; +633.966op/s] or [-20.064%; +20.344%]

scenario:dogstatsd-with-tags-20

  • unstable cpu_user_time [-533.806ms; +190.181ms] or [-10.406%; +3.707%]
  • unstable execution_time [-532.847ms; +193.805ms] or [-10.236%; +3.723%]
  • unstable throughput [-65588.141op/s; +184343.912op/s] or [-4.072%; +11.445%]

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

  • unstable cpu_user_time [-702.226ms; +715.050ms] or [-5.457%; +5.556%]
  • unstable execution_time [-704.207ms; +718.751ms] or [-5.356%; +5.466%]
  • unstable throughput [-3.278op/s; +3.224op/s] or [-5.355%; +5.268%]

scenario:plugin-mongodb-core-deep-aggregate-26

  • unstable execution_time [-115.041ms; +169.900ms] or [-4.250%; +6.277%]

scenario:test-optimization-large-suite-20

  • unstable max_rss_usage [-4395.058KB; +6176.058KB] or [-5.484%; +7.707%]

rochdev and others added 14 commits July 8, 2026 19:47
…ackage.electron.json

Adds scripts/generate-electron-package.js to automatically generate a
version of package.json with excluded optional dependencies for the
dd-trace-electron package variant. Supports --check flag for CI validation.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…istering

Adds Tracer.registerFeature() / NoopProxy.registerNoop() so subsystems
can opt into the tracer without being hardcoded in proxy.js. OpenFeature
uses this via a new register.js that self-registers on require.

The Electron entrypoint (index.electron.js) simply omits that require,
so OpenFeature and its native dep (@datadog/openfeature-node-server) are
absent from the Electron build with no conditional logic in the core.
index.js delegates to index.electron.js after calling register.js,
keeping both entrypoints in sync with zero duplication.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
OpenFeature is no longer hardcoded in proxy.js so the test now calls
registerFeature() explicitly with the mocked modules instead of passing
them through proxyquire.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Both index.js and index.electron.js now require ./src/bootstrap directly
rather than one depending on the other. index.js remains the only
entrypoint that registers OpenFeature.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
bootstrap.js was requiring ./proxy directly, bypassing src/index.js which
handles DD_TRACE_ENABLED=false and Jest worker environments by returning
the noop proxy instead. This caused global._ddtrace to always be the full
Tracer in contexts where it should be the noop.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
The agent test helper clears specific module cache entries before
rebuilding the tracer. src/bootstrap.js was not in the eviction list,
so after global._ddtrace was deleted the cached bootstrap module still
exported the stale (deleted) proxy instance instead of re-running
initialization.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Requiring openfeature/register.js from index.js previously loaded
proxy.js as a side-effect (to call Tracer.registerFeature), which
transitively loaded datadog-instrumentations/register.js. That module
registers logAbortedIntegrations with beforeExitHandlers, but at that
point the global symbol was not yet set up by bootstrap.js, so the
optional-chaining silently no-oped and the handler was never registered.

Introduce a feature-registry module that openfeature/register.js pushes
to directly without requiring proxy.js. proxy.js and noop/proxy.js read
from it at class-definition time (after the global symbol is set up by
bootstrap.js). This keeps all initialization gated on !global._ddtrace.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@rochdev
rochdev force-pushed the rochdev/dd-trace-electron-package branch from 269673d to 68e0b28 Compare July 8, 2026 23:56
Fix broken `needs: publish-latest` reference by renaming to
`publish-electron` with `needs: publish`. Drop the v5.x branch
guard since the job already only runs when publish succeeds
(which itself is gated to release branch pushes via setup).

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@rochdev
rochdev marked this pull request as ready for review July 9, 2026 00:11
@rochdev
rochdev requested review from a team as code owners July 9, 2026 00:11
@rochdev
rochdev requested review from leoromanovsky, sameerank and tlhunter and removed request for a team July 9, 2026 00:11

@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: 1b7dac6977

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread .github/workflows/release.yml Outdated
Comment thread scripts/release/publish-electron.js Outdated
Comment thread scripts/electron-package-excludes.json Outdated
Comment thread scripts/electron-package-excludes.json
- Pass computed npm dist-tag to electron publish so maintenance
  branches don't erroneously move the latest tag
- Make electron publish idempotent: skip if the version is already
  on the registry, matching the behaviour of the regular publish step
- Exclude oxc-parser from the electron package (native bindings)
- Restore @DataDog/libdatadog exclusion; crashtracking is not
  supported in Electron — wrap its start() in a local try/catch so
  a missing libdatadog doesn't abort tracer initialization

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Comment on lines +11 to +14
const ROOT = path.join(__dirname, '..', '..')
const PACKAGE_JSON = path.join(ROOT, 'package.json')
const ELECTRON_JSON = path.join(ROOT, 'package.electron.json')
const BACKUP = path.join(ROOT, 'package.json.bak')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do customers run their application code through bundlers with Electron? And if so does this all work when doing so?

@tlhunter
tlhunter merged commit ffb89f4 into master Jul 14, 2026
691 of 692 checks passed
@tlhunter
tlhunter deleted the rochdev/dd-trace-electron-package branch July 14, 2026 19:13
This was referenced Jul 15, 2026
juan-fernandez pushed a commit that referenced this pull request Jul 16, 2026
…ies (#8948)

* chore(electron): add electron package exclusion config

* chore(electron): add electron package generation script and initial package.electron.json

Adds scripts/generate-electron-package.js to automatically generate a
version of package.json with excluded optional dependencies for the
dd-trace-electron package variant. Supports --check flag for CI validation.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* chore(electron): wire electron package verify into lint

* chore(electron): add electron publish script

* docs(electron): document Dependabot behavior for package.electron.json

* chore(electron): move generation to publish time, add release jobs, gitignore generated file

* feat(electron): add Electron entrypoint and make OpenFeature self-registering

Adds Tracer.registerFeature() / NoopProxy.registerNoop() so subsystems
can opt into the tracer without being hardcoded in proxy.js. OpenFeature
uses this via a new register.js that self-registers on require.

The Electron entrypoint (index.electron.js) simply omits that require,
so OpenFeature and its native dep (@datadog/openfeature-node-server) are
absent from the Electron build with no conditional logic in the core.
index.js delegates to index.electron.js after calling register.js,
keeping both entrypoints in sync with zero duplication.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* test(proxy): adapt spec to OpenFeature self-registration

OpenFeature is no longer hardcoded in proxy.js so the test now calls
registerFeature() explicitly with the mocked modules instead of passing
them through proxyquire.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* refactor(electron): extract bootstrap into shared module

Both index.js and index.electron.js now require ./src/bootstrap directly
rather than one depending on the other. index.js remains the only
entrypoint that registers OpenFeature.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(electron): use src/index.js in bootstrap to respect DD_TRACE_ENABLED

bootstrap.js was requiring ./proxy directly, bypassing src/index.js which
handles DD_TRACE_ENABLED=false and Jest worker environments by returning
the noop proxy instead. This caused global._ddtrace to always be the full
Tracer in contexts where it should be the noop.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* test(plugins): evict src/bootstrap from require cache on tracer rebuild

The agent test helper clears specific module cache entries before
rebuilding the tracer. src/bootstrap.js was not in the eviction list,
so after global._ddtrace was deleted the cached bootstrap module still
exported the stale (deleted) proxy instance instead of re-running
initialization.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* chore: add CODEOWNERS entries for electron entrypoints and release workflow

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(electron): fix abort.integration telemetry missing with OpenFeature

Requiring openfeature/register.js from index.js previously loaded
proxy.js as a side-effect (to call Tracer.registerFeature), which
transitively loaded datadog-instrumentations/register.js. That module
registers logAbortedIntegrations with beforeExitHandlers, but at that
point the global symbol was not yet set up by bootstrap.js, so the
optional-chaining silently no-oped and the handler was never registered.

Introduce a feature-registry module that openfeature/register.js pushes
to directly without requiring proxy.js. proxy.js and noop/proxy.js read
from it at class-definition time (after the global symbol is set up by
bootstrap.js). This keeps all initialization gated on !global._ddtrace.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* chore: add CODEOWNERS entries for bootstrap and feature-registry

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* ci(electron): refactor release jobs for electron package

Fix broken `needs: publish-latest` reference by renaming to
`publish-electron` with `needs: publish`. Drop the v5.x branch
guard since the job already only runs when publish succeeds
(which itself is gated to release branch pushes via setup).

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(electron): address Codex review findings

- Pass computed npm dist-tag to electron publish so maintenance
  branches don't erroneously move the latest tag
- Make electron publish idempotent: skip if the version is already
  on the registry, matching the behaviour of the regular publish step
- Exclude oxc-parser from the electron package (native bindings)
- Restore @DataDog/libdatadog exclusion; crashtracking is not
  supported in Electron — wrap its start() in a local try/catch so
  a missing libdatadog doesn't abort tracer initialization

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

---------

Co-authored-by: Claude Sonnet 4.6 <[email protected]>
juan-fernandez pushed a commit that referenced this pull request Jul 16, 2026
…ies (#8948)

* chore(electron): add electron package exclusion config

* chore(electron): add electron package generation script and initial package.electron.json

Adds scripts/generate-electron-package.js to automatically generate a
version of package.json with excluded optional dependencies for the
dd-trace-electron package variant. Supports --check flag for CI validation.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* chore(electron): wire electron package verify into lint

* chore(electron): add electron publish script

* docs(electron): document Dependabot behavior for package.electron.json

* chore(electron): move generation to publish time, add release jobs, gitignore generated file

* feat(electron): add Electron entrypoint and make OpenFeature self-registering

Adds Tracer.registerFeature() / NoopProxy.registerNoop() so subsystems
can opt into the tracer without being hardcoded in proxy.js. OpenFeature
uses this via a new register.js that self-registers on require.

The Electron entrypoint (index.electron.js) simply omits that require,
so OpenFeature and its native dep (@datadog/openfeature-node-server) are
absent from the Electron build with no conditional logic in the core.
index.js delegates to index.electron.js after calling register.js,
keeping both entrypoints in sync with zero duplication.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* test(proxy): adapt spec to OpenFeature self-registration

OpenFeature is no longer hardcoded in proxy.js so the test now calls
registerFeature() explicitly with the mocked modules instead of passing
them through proxyquire.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* refactor(electron): extract bootstrap into shared module

Both index.js and index.electron.js now require ./src/bootstrap directly
rather than one depending on the other. index.js remains the only
entrypoint that registers OpenFeature.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(electron): use src/index.js in bootstrap to respect DD_TRACE_ENABLED

bootstrap.js was requiring ./proxy directly, bypassing src/index.js which
handles DD_TRACE_ENABLED=false and Jest worker environments by returning
the noop proxy instead. This caused global._ddtrace to always be the full
Tracer in contexts where it should be the noop.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* test(plugins): evict src/bootstrap from require cache on tracer rebuild

The agent test helper clears specific module cache entries before
rebuilding the tracer. src/bootstrap.js was not in the eviction list,
so after global._ddtrace was deleted the cached bootstrap module still
exported the stale (deleted) proxy instance instead of re-running
initialization.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* chore: add CODEOWNERS entries for electron entrypoints and release workflow

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(electron): fix abort.integration telemetry missing with OpenFeature

Requiring openfeature/register.js from index.js previously loaded
proxy.js as a side-effect (to call Tracer.registerFeature), which
transitively loaded datadog-instrumentations/register.js. That module
registers logAbortedIntegrations with beforeExitHandlers, but at that
point the global symbol was not yet set up by bootstrap.js, so the
optional-chaining silently no-oped and the handler was never registered.

Introduce a feature-registry module that openfeature/register.js pushes
to directly without requiring proxy.js. proxy.js and noop/proxy.js read
from it at class-definition time (after the global symbol is set up by
bootstrap.js). This keeps all initialization gated on !global._ddtrace.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* chore: add CODEOWNERS entries for bootstrap and feature-registry

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* ci(electron): refactor release jobs for electron package

Fix broken `needs: publish-latest` reference by renaming to
`publish-electron` with `needs: publish`. Drop the v5.x branch
guard since the job already only runs when publish succeeds
(which itself is gated to release branch pushes via setup).

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(electron): address Codex review findings

- Pass computed npm dist-tag to electron publish so maintenance
  branches don't erroneously move the latest tag
- Make electron publish idempotent: skip if the version is already
  on the registry, matching the behaviour of the regular publish step
- Exclude oxc-parser from the electron package (native bindings)
- Restore @DataDog/libdatadog exclusion; crashtracking is not
  supported in Electron — wrap its start() in a local try/catch so
  a missing libdatadog doesn't abort tracer initialization

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

---------

Co-authored-by: Claude Sonnet 4.6 <[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.

2 participants