Skip to content

Conversation

@s1gr1d
Copy link
Member

@s1gr1d s1gr1d commented Aug 8, 2025

DESCRIBE YOUR PR

This adds OTel documentation for bun. First, I added CJS/ESM snippets for all snippets to make it more inclusive.

For Bun, the biggest difference are the imports (@sentry/bun) and this snippet:

  integrations: (integrations) =>
    integrations
       // Filter out the BunServer integration to avoid emitting spans from there
      .filter((i) => i.name !== "Http" && i.name !== "BunServer")
      // Add the httpIntegration again and disable emitting spans
      .concat(Sentry.httpIntegration({ spans: false }))

closes getsentry/sentry-javascript#16969

IS YOUR CHANGE URGENT?

Help us prioritize incoming PRs by letting us know when the change needs to go live.

  • Urgent deadline (GA date, etc.):
  • Other deadline:
  • None: Not urgent, can wait up to 1 week+

SLA

  • Teamwork makes the dream work, so please add a reviewer to your PRs.
  • Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it.
    Thanks in advance for your help!

PRE-MERGE CHECKLIST

Make sure you've checked the following before merging your changes:

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs (subject matter experts)
  • PR was reviewed and approved by a member of the Sentry docs team

@vercel
Copy link

vercel bot commented Aug 8, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Project Deployment Preview Comments Updated (UTC)
sentry-docs Ready Preview Comment Aug 12, 2025 1:43pm
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
develop-docs ⬜️ Ignored Preview Aug 12, 2025 1:43pm

@s1gr1d s1gr1d changed the title Sig/add bun otel docs docs(bun): Add ESM/CJS and Bun-specific OTel docs Aug 8, 2025
@s1gr1d s1gr1d requested review from Lms24 and mydea August 8, 2025 13:27
cursor[bot]

This comment was marked as outdated.

Copy link
Member Author

Choose a reason for hiding this comment

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

The javascript.mdx files are just copied from the general docs page.

I only added some missing imports (BatchSpanProcessor and OTLPTraceExporter) and added the ESM version of it.

@codecov
Copy link

codecov bot commented Aug 8, 2025

Bundle Report

Changes will increase total bundle size by 4.19kB (0.02%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
sentry-docs-client-array-push 9.85MB -6 bytes (-0.0%) ⬇️
sentry-docs-server-cjs 12.38MB 4.19kB (0.03%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: sentry-docs-client-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
static/chunks/pages/_app-*.js -3 bytes 882.71kB -0.0%
static/chunks/8321-*.js -3 bytes 425.87kB -0.0%
server/middleware-*.js 5.55kB 6.55kB 555.3% ⚠️
server/middleware-*.js -5.55kB 1.0kB -84.74%
static/oD0H_cmvm3qkbE9K4DzWN/_buildManifest.js (New) 684 bytes 684 bytes 100.0% 🚀
static/oD0H_cmvm3qkbE9K4DzWN/_ssgManifest.js (New) 77 bytes 77 bytes 100.0% 🚀
static/J11oGDy1aB2DDuIWnLIzP/_buildManifest.js (Deleted) -684 bytes 0 bytes -100.0% 🗑️
static/J11oGDy1aB2DDuIWnLIzP/_ssgManifest.js (Deleted) -77 bytes 0 bytes -100.0% 🗑️
view changes for bundle: sentry-docs-server-cjs

Assets Changed:

Asset Name Size Change Total Size Change (%)
1729.js -3 bytes 1.77MB -0.0%
../instrumentation.js -3 bytes 1.1MB -0.0%
9523.js -3 bytes 1.08MB -0.0%
../app/[[...path]]/page.js.nft.json 1.4kB 745.6kB 0.19%
../app/platform-redirect/page.js.nft.json 1.4kB 745.51kB 0.19%
../app/sitemap.xml/route.js.nft.json 1.4kB 742.98kB 0.19%

Comment on lines 124 to 126
// Also filter out the BunServer integration to avoid emitting duplicated spans from Sentry AND your custom OTel instrumentation
.filter((i) => i.name !== "Http" && i.name !== "BunServer")
.concat(Sentry.httpIntegration({ spans: false })),
Copy link
Member

Choose a reason for hiding this comment

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

q: I thought we just have to filter out the bun integration, isn't spans: false already covered by skipOpenTelemetrySetup: true?

Copy link
Member Author

Choose a reason for hiding this comment

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

I wanted it to align with the already existing docs (here) and they mention setting this option as well.

I'm not sure myself either how we should handle documenting this. I think it's fine writing it like this explicitly as it also supports older versions, where this was not yet the default.

@Lms24 @mydea what do you think of this here? This covers both the Node and Bun examples.

Comment on lines 20 to 23
// Filter out the BunServer integration to avoid emitting spans from there
.filter((i) => i.name !== "Http" && i.name !== "BunServer")
// Add the httpIntegration again and disable emitting spans
.concat(Sentry.httpIntegration({ spans: false }))
Copy link
Member

Choose a reason for hiding this comment

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

Same here.

// This leads to tracing being disabled

// Disable emitting of spans in the httpIntegration
integrations: [Sentry.httpIntegration({ spans: false })],
Copy link
Member

Choose a reason for hiding this comment

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

Same here.

Comment on lines 63 to 64
// Disable emitting of spans in the httpIntegration
integrations: [Sentry.httpIntegration({ spans: false })],
Copy link
Member

Choose a reason for hiding this comment

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

Same here.

```javascript {tabTitle: NodeSDK}
const Sentry = require("@sentry/node");

const { NodeSDK } = require("@opentelemetry/sdk-node")
Copy link
Member

Choose a reason for hiding this comment

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

This is true, it's already imported on #L48

cursor[bot]

This comment was marked as outdated.

Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

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

Thanks!

@s1gr1d s1gr1d merged commit 4cf4fea into master Aug 13, 2025
13 checks passed
@s1gr1d s1gr1d deleted the sig/add-bun-otel-docs branch August 13, 2025 12:00
@github-actions github-actions bot locked and limited conversation to collaborators Aug 29, 2025
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.

Unable to setup custom OpenTelemetry with @sentry/bun. Docs are lacking info

4 participants