Title: Introduce Multiplexing Transport · Issue #5185 · getsentry/sentry-javascript · GitHub
Open Graph Title: Introduce Multiplexing Transport · Issue #5185 · getsentry/sentry-javascript
X Title: Introduce Multiplexing Transport · Issue #5185 · getsentry/sentry-javascript
Description: Problem Statement Usage of multiple hubs/clients has been a long standing issue within the SDK. https://github.com/getsentry/sentry-javascript/issues?q=is:open+is:issue+label:"Feature:+Multiple+hubs/clients" A big use case ...
Open Graph Description: Problem Statement Usage of multiple hubs/clients has been a long standing issue within the SDK. https://github.com/getsentry/sentry-javascript/issues?q=is:open+is:issue+label:"Feature:+Mu...
X Description: Problem Statement Usage of multiple hubs/clients has been a long standing issue within the SDK. https://github.com/getsentry/sentry-javascript/issues?q=is:open+is:issue+label:"Feature:+Mu...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/5185
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Introduce Multiplexing Transport","articleBody":"### Problem Statement\n\nUsage of multiple hubs/clients has been a long standing issue within the SDK. https://github.com/getsentry/sentry-javascript/issues?q=is%3Aopen+is%3Aissue+label%3A%22Feature%3A+Multiple+hubs%2Fclients%22\r\n\r\nA big use case for using multi-hub is to send Sentry event's to different projects. By introducing an optional transport multiplexer, we can allow users to route envelopes to different DSNs (or the same envelope to multiple DSNs).\r\n\r\nThis means users can route events to different Sentry projects based on any characteristics of an event - like tags, stacktrace or contexts\n\n### Solution Brainstorm\n\nMost transports constructors right now (`makeFetchTransport`, `makeXHRTransport`) are a function that takes some transport options and returns a transport.\r\n\r\n```ts\r\ntransport: (options: TransportOptions) => Transport\r\n```\r\n\r\nWe could then make a wrapper class typed like so:\r\n\r\n```ts\r\ntype DsnToMatcher = {\r\n // TODO: Adjust matcher function type based on UX needs\r\n [dsn: string]: (type: string, envelopeItemBody: unknown, envelopeItem: BaseEnvelopeItem) => boolean;\r\n}\r\n\r\ntype TransportCreator = (options: TransportOptions) => Transport\r\ntype TransportMultiplexer = (opts: DsnToMatcher, wrappedTransport: TransportCreator) => TransportCreator;\r\n```\r\n\r\nIt's just a wrapper func, so it would be used like so:\r\n\r\n```ts\r\nSentry.init({\r\n dsn: ...,\r\n transport: multiplexTransport(makeFetchTransport),\r\n});\r\n```\r\n\r\nThere are a couple open questions here:\r\n\r\n- Do we make this errors/transaction only? What do we do about sessions, attachments and other envelope items\r\n- How do we easily design the API so that it can we can route to different DSNs and send envelopes to multiple DSNs at the same time.\r\n- Do we expose entire envelope items? Or just the body.\r\n\r\nThere is an argument that this needs can just be a code snippet in docs, instead of exporting something, but it would be nice to have this functionality out of the box to address some of the MFE concerns.","author":{"url":"https://github.com/AbhiPrasad","@type":"Person","name":"AbhiPrasad"},"datePublished":"2022-05-31T11:22:23Z","url":"https://github.com/getsentry/sentry-javascript/issues/5185"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c5d9a23e-c84a-50a3-823e-256faf330b11 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D30C:181E33:3FB87E:56EF8D:6B04BEFD |
| html-safe-nonce | 9a61362d038daf558373890648a624265494d17a946bdd90dae675152f87f98b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMzBDOjE4MUUzMzozRkI4N0U6NTZFRjhEOjZCMDRCRUZEIiwidmlzaXRvcl9pZCI6Ijg4OTI1NTk2MDQzNzkzMzY0NDYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | acb6f281164fdce1daf35899836209544c5977389afcea1ce590518c2a6e11aa |
| hovercard-subject-tag | issue:1253720817 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/5185/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7fd6519492f03e79a1482631b34403787acded5f74de8a73a81e5669cc544953/getsentry/sentry-javascript/issues/5185 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7fd6519492f03e79a1482631b34403787acded5f74de8a73a81e5669cc544953/getsentry/sentry-javascript/issues/5185 |
| og:image:alt | Problem Statement Usage of multiple hubs/clients has been a long standing issue within the SDK. https://github.com/getsentry/sentry-javascript/issues?q=is:open+is:issue+label:"Feature:+Mu... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | AbhiPrasad |
| hostname | github.com |
| expected-hostname | github.com |
| None | 85dd75377eb77313206b8fc108bcee6a3a029286d94bf32bf9b4426e4d92e0c4 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 0d64fa748a2bab9a5b587a967ac4da1cfa8da6dd |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width