Skip to content

feat(node, bun): Enforce minimum collection interval in runtime metrics integrations#20068

Merged
chargome merged 9 commits intodevelopfrom
cg/runtime-metrics-min-interval
Apr 2, 2026
Merged

feat(node, bun): Enforce minimum collection interval in runtime metrics integrations#20068
chargome merged 9 commits intodevelopfrom
cg/runtime-metrics-min-interval

Conversation

@chargome
Copy link
Copy Markdown
Member

@chargome chargome commented Apr 1, 2026

  • Values below 1000ms are normalized to 1000ms with a console.warn
  • Non-finite values (e.g. NaN) are also caught and fall back to 1000ms
  • Shared _INTERNAL_normalizeCollectionInterval helper extracted to @sentry/node-core and re-exported through @sentry/node for use in @sentry/bun
  • Each runtime retains ownership of its own DEFAULT_INTERVAL_MS
  • Also adapted deno logging to be in sync with the other runtimes

@chargome chargome self-assigned this Apr 1, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

Deps

  • Bump lodash.template from 4.5.0 to 4.18.1 by dependabot in #20085
  • Bump @xmldom/xmldom from 0.8.3 to 0.8.12 by dependabot in #20066

Other

  • (core) Support embeddings in langchain by nicohrubec in #20017
  • (core, node) Portable Express integration by isaacs in #19928
  • (deno) Add denoRuntimeMetricsIntegration by chargome in #20023
  • (node, bun) Enforce minimum collection interval in runtime metrics integrations by chargome in #20068

Bug Fixes 🐛

  • (aws-serverless) Add timeout to _endSpan forceFlush to prevent Lambda hanging by logaretm in #20064
  • (cloudflare) Ensure every request instruments functions by JPeer264 in #20044
  • (gatsby) Fix errorHandler signature to match bundler-plugin-core API by JPeer264 in #20048

Internal Changes 🔧

Core

  • Do not emit spans for chats.create in google-genai by nicohrubec in #19990
  • Unify .do* span ops to gen_ai.generate_content by nicohrubec in #20074
  • Simplify addResponseAttributes in openai integration by nicohrubec in #20013
  • Extract shared endStreamSpan for AI integrations by nicohrubec in #20021
  • Remove provider-specific AI span attributes in favor of gen_ai attributes in sentry conventions by nicohrubec in #20011

Deps

  • Bump mshick/add-pr-comment from dd126dd8c253650d181ad9538d8b4fa218fc31e8 to e7516d74559b5514092f5b096ed29a629a1237c6 by dependabot in #20078
  • Bump getsentry/craft/.github/workflows/changelog-preview.yml from 2.24.1 to 2.25.2 by dependabot in #20081

Other

  • (node) Add node integration tests for Vercel ToolLoopAgent by nicohrubec in #20087
  • Update validate-pr workflow by stephanie-anderson in #20072
  • Remove unused tsconfig-template folder by mydea in #20067

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

size-limit report 📦

Path Size % Change Change
@sentry/browser 25.65 kB - -
@sentry/browser - with treeshaking flags 24.14 kB - -
@sentry/browser (incl. Tracing) 42.16 kB - -
@sentry/browser (incl. Tracing, Profiling) 46.77 kB - -
@sentry/browser (incl. Tracing, Replay) 80.94 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 70.56 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 85.66 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 97.92 kB - -
@sentry/browser (incl. Feedback) 42.42 kB - -
@sentry/browser (incl. sendFeedback) 30.31 kB - -
@sentry/browser (incl. FeedbackAsync) 35.3 kB - -
@sentry/browser (incl. Metrics) 26.96 kB - -
@sentry/browser (incl. Logs) 27.11 kB - -
@sentry/browser (incl. Metrics & Logs) 27.78 kB - -
@sentry/react 27.41 kB - -
@sentry/react (incl. Tracing) 44.48 kB - -
@sentry/vue 30.08 kB - -
@sentry/vue (incl. Tracing) 44.05 kB - -
@sentry/svelte 25.67 kB - -
CDN Bundle 28.33 kB - -
CDN Bundle (incl. Tracing) 43.13 kB - -
CDN Bundle (incl. Logs, Metrics) 29.7 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 44.17 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 68.5 kB - -
CDN Bundle (incl. Tracing, Replay) 80.02 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 81.06 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 85.56 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 86.59 kB - -
CDN Bundle - uncompressed 82.72 kB - -
CDN Bundle (incl. Tracing) - uncompressed 127.86 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 86.86 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 131.27 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 209.84 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 244.74 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 248.13 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 257.65 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 261.04 kB - -
@sentry/nextjs (client) 46.9 kB - -
@sentry/sveltekit (client) 42.62 kB - -
@sentry/node-core 55.77 kB +0.02% +8 B 🔺
@sentry/node 172.41 kB +0.01% +13 B 🔺
@sentry/node - without tracing 96.05 kB +0.02% +15 B 🔺
@sentry/aws-serverless 112.85 kB +0.01% +8 B 🔺

View base workflow run

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.
⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 8,673 - 9,338 -7%
GET With Sentry 1,671 19% 1,722 -3%
GET With Sentry (error only) 5,961 69% 6,158 -3%
POST Baseline 1,156 - 1,197 -3%
POST With Sentry 550 48% 603 -9%
POST With Sentry (error only) 994 86% 1,049 -5%
MYSQL Baseline 3,102 - 3,227 -4%
MYSQL With Sentry 393 13% 447 -12%
MYSQL With Sentry (error only) 2,550 82% 2,666 -4%

View base workflow run

chargome and others added 7 commits April 1, 2026 14:02
…public API

Exporting _INTERNAL_normalizeCollectionInterval from @sentry/node triggers the
consistent-exports check, requiring all node-dependent packages to re-export it.
Inline the logic in bun directly instead.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…kages

The consistent exports CI check requires that packages depending on
@sentry/node re-export everything @sentry/node exports. Add the missing
_INTERNAL_normalizeCollectionInterval re-export to @sentry/astro,
@sentry/bun, @sentry/aws-serverless, and @sentry/google-cloud-serverless.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…s check

This export is an internal helper consumed by integrations (e.g.
bunRuntimeMetricsIntegration) and does not need to be re-exported by
every package that depends on @sentry/node.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@chargome chargome marked this pull request as ready for review April 2, 2026 12:23
@chargome chargome requested a review from nicohrubec April 2, 2026 12:23
…valMs is NaN

Previously, non-finite values like NaN would fall back to the 1000ms
minimum, which could surprise users expecting the documented default.
Distinguish between two error cases:
- NaN/Infinity: invalid input → fall back to the integration's default
- Below minimum: too low → clamp to 1000ms minimum

Update _INTERNAL_normalizeCollectionInterval to accept a defaultInterval
parameter and apply it for non-finite inputs. Update deno's inline logic
and all tests accordingly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@chargome chargome merged commit 4be2e67 into develop Apr 2, 2026
470 of 472 checks passed
@chargome chargome deleted the cg/runtime-metrics-min-interval branch April 2, 2026 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants