refactor(elysia): drop @elysiajs/opentelemetry dependency#19947
Draft
logaretm wants to merge 5 commits intoawad/js-1542-add-elysia-integrationfrom
Draft
refactor(elysia): drop @elysiajs/opentelemetry dependency#19947logaretm wants to merge 5 commits intoawad/js-1542-add-elysia-integrationfrom
logaretm wants to merge 5 commits intoawad/js-1542-add-elysia-integrationfrom
Conversation
Replace @elysiajs/opentelemetry with Elysia's native .trace() and
.wrap() APIs combined with Sentry's own span APIs. This eliminates
the version mismatch issues caused by the OTel plugin's transitive
OpenTelemetry dependencies.
Key changes:
- Use .wrap() to capture/create root spans (Bun creates new server
span, Node.js captures existing HTTP instrumentation span) and
bridge them to .trace() via a WeakMap<Request, Span>
- Use .trace({ as: "global" }) with startInactiveSpan to create
lifecycle phase spans (Request, Parse, Handle, etc.) and child
handler spans (named functions get their name, arrow functions
get 'anonymous')
- Move all SDK logic (request metadata, trace propagation, error
capture) inside .trace() callbacks via onPhaseEnd so no separate
lifecycle hooks are registered (which would show up as handler
spans in the trace)
- Remove clientHooks.ts (no more post-hoc span enrichment or
<unknown> span filtering needed)
- Remove OTel resolution overrides from root package.json
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨Deps
Other
Bug Fixes 🐛Cloudflare
Core
Deps
Other
Internal Changes 🔧Deps Dev
Nuxt
Other
🤖 This preview updates automatically when you update the PR. |
The size limit bumps were needed for @elysiajs/opentelemetry's transitive OTel dependencies. Now that we dropped the plugin, the limits can go back to the develop baseline. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
size-limit report 📦
|
Contributor
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.
|
- Import TraceHandler, TraceListener, TraceProcess from elysia instead of defining custom interfaces or casting to any - Add void to floating promises (TraceListener callbacks) - Fix package.json lint/fix scripts to use oxlint instead of eslint Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Restore onRequest, onAfterHandle, onError as real lifecycle hooks (.trace() is observational only — used for span creation, not SDK logic) - Set HTTP error status on root span in onError handler - Update elysia-bun E2E tests: origin auto.http.otel.elysia -> auto.http.elysia - Use /with-middleware/test route for anonymous span test (needs actual handlers) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Mimics
@elysia/opentelemetryown implementation and swaps out OTEL APIs with our own, main reason is I didn't want to lock OTEL deps to specific versions that may break in the wild.This is an exploration, but if all is green then I will consider merging this first into Elysia SDK before release.