Skip to content

✨ add @datadog/js-core/sample sub-path with performDraw - #4844

Merged
BeltranBulbarellaDD merged 4 commits into
mainfrom
worktree-js-core-sample-entry
Aug 10, 2026
Merged

✨ add @datadog/js-core/sample sub-path with performDraw#4844
BeltranBulbarellaDD merged 4 commits into
mainfrom
worktree-js-core-sample-entry

Conversation

@thomas-lebeau

Copy link
Copy Markdown
Collaborator

Motivation

Per the @datadog/js-core RFC, electron-sdk needs performDraw (used for telemetry sampling decisions), which requires a new @datadog/js-core/sample sub-path — previously there was no sample entry at all.

Changes

  • New sub-path @datadog/js-core/sample, exporting performDraw, ported verbatim from browser-core/tools/utils/numberUtils.ts (the round/isNumber/isPercentage helpers in that same file were left out — not in scope).
  • Wired up per packages/js-core/AGENTS.md's "adding a new sub-path" checklist:
    • package.json exports field + physical sample/package.json fallback (legacy resolvers)
    • tsconfig.base.json path mapping
    • typedoc.json entry point
    • api/sample.api.md API Extractor golden file (auto-generated by yarn api:check --update)

Pure additive change (brand new sub-path), no existing behavior changes.

Test instructions

  • yarn workspace @datadog/js-core build && yarn api:check passes.
  • yarn typecheck passes.
  • yarn test:unit --spec 'packages/js-core/src/**/*.spec.ts' passes (61/61), including a new sample.spec.ts mirroring browser-core's performDraw test coverage.

Checklist

  • Tested locally
  • Tested on staging
  • Added unit tests for this change.
  • Added e2e/integration tests for this change.
  • Updated documentation and/or relevant AGENTS.md file

Introduces a new sample sub-path per the js-core RFC, containing
performDraw, ported from browser-core's tools/utils/numberUtils.ts.
Used by electron-sdk for telemetry sampling decisions.

Wires up the new sub-path: package.json exports + physical
sample/package.json fallback, tsconfig.base.json path mapping, and
typedoc.json entry point, per packages/js-core/AGENTS.md.
@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Jul 3, 2026

Copy link
Copy Markdown

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 180.58 KiB 180.44 KiB -143 B -0.08%
Rum Profiler 8.43 KiB 8.43 KiB 0 B 0.00%
Rum Recorder 21.12 KiB 21.12 KiB 0 B 0.00%
Logs 57.03 KiB 57.04 KiB +6 B +0.01%
Rum Salesforce N/A 138.47 KiB N/A N/A N/A
Rum Slim 138.46 KiB 138.47 KiB +6 B +0.00%
Worker 22.96 KiB 22.96 KiB 0 B 0.00%
Rum Shopify N/A 200.02 KiB N/A N/A N/A
Rum-shopify Profiler N/A 8.43 KiB N/A N/A N/A
Rum-shopify Recorder N/A 3.72 KiB N/A N/A N/A

@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Jul 3, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 0.00%
Overall Coverage: 77.20% (+0.00%)

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

Deletes performDraw from tools/utils/numberUtils.ts (round/isPercentage/
isNumber stay, they're not migrated) and points telemetry.ts and
browser-core's own public re-export in index.ts at
@datadog/js-core/sample instead.

Adds '@datadog/js-core/sample' to the disallow-side-effects lint
rule's allowlist, alongside the other side-effect-free js-core
sub-paths.

Removes the now-redundant performDraw test from numberUtils.spec.ts
since it has identical coverage in js-core's own sample.spec.ts.

Downstream packages are unaffected: performDraw was only consumed
internally by browser-core; the public re-export keeps
'@datadog/browser-core' backward compatible regardless.
@thomas-lebeau
thomas-lebeau marked this pull request as ready for review July 8, 2026 12:27
@thomas-lebeau
thomas-lebeau requested a review from a team as a code owner July 8, 2026 12:27
@sbarrio
sbarrio requested a review from amortemousque July 9, 2026 07:05

@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: f0147ce420

ℹ️ 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 packages/browser-core/src/index.ts Outdated
Comment thread packages/js-core/src/entries/sample.ts
@BeltranBulbarellaDD
BeltranBulbarellaDD merged commit 8ba13be into main Aug 10, 2026
31 checks passed
@BeltranBulbarellaDD
BeltranBulbarellaDD deleted the worktree-js-core-sample-entry branch August 10, 2026 14:19
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants