Title: Apply stateTransformer to Attachments in createSentryPiniaPlugin · Issue #14441 · getsentry/sentry-javascript · GitHub
Open Graph Title: Apply stateTransformer to Attachments in createSentryPiniaPlugin · Issue #14441 · getsentry/sentry-javascript
X Title: Apply stateTransformer to Attachments in createSentryPiniaPlugin · Issue #14441 · getsentry/sentry-javascript
Description: Problem Statement Feature Request: Apply stateTransformer to Attachments in createSentryPiniaPlugin First, thank you for createSentryPiniaPlugin—it's been a lifesaver! Would it be possible to apply the stateTransformer not just to the co...
Open Graph Description: Problem Statement Feature Request: Apply stateTransformer to Attachments in createSentryPiniaPlugin First, thank you for createSentryPiniaPlugin—it's been a lifesaver! Would it be possible to apply...
X Description: Problem Statement Feature Request: Apply stateTransformer to Attachments in createSentryPiniaPlugin First, thank you for createSentryPiniaPlugin—it's been a lifesaver! Would it be possible to a...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/14441
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Apply stateTransformer to Attachments in createSentryPiniaPlugin","articleBody":"### Problem Statement\n\n## Feature Request: Apply `stateTransformer` to Attachments in `createSentryPiniaPlugin`\n\nFirst, thank you for `createSentryPiniaPlugin`—it's been a lifesaver! \n\nWould it be possible to apply the `stateTransformer` not just to the context but also to the attachments? This would greatly reduce the size of the attachments when they contain items that don’t need to be in Sentry. Currently, we're hitting our monthly attachment cap just a few days after starting to use `createSentryPiniaPlugin`.\n\n\n### Solution Brainstorm\n\n#### Potential Implementation:\n\n```diff\ntry {\n+ const transformedState = options.stateTransformer \n+ ? options.stateTransformer(store.$state) \n+ : store.$state;\n // Get current timestamp in hh:mm:ss\n const timestamp = new Date().toTimeString().split(' ')[0];\n const filename = `pinia_state_${store.$id}_${timestamp}.json`;\n\n hint.attachments = [\n ...(hint.attachments || []),\n {\n filename,\n- data: JSON.stringify(store.$state),\n+ data: JSON.stringify(transformedState),\n },\n ];\n} catch (_) {\n // empty\n}\n```\n\nThis adjustment would make the plugin more efficient by ensuring attachment size is minimized by excluding unnecessary data from the state with `stateTransformer`.\n\nLet me know if you’d like me to submit a PR for this change.\n\nThanks again!","author":{"url":"https://github.com/sircharlo","@type":"Person","name":"sircharlo"},"datePublished":"2024-11-24T15:36:00Z","url":"https://github.com/getsentry/sentry-javascript/issues/14441"}
| 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:c60ef496-a9ec-e83c-6fe4-4ae3a8bbb026 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B1E6:3B2069:21D8DF:2EFED3:6B074887 |
| html-safe-nonce | 7e78f803319d05458763a8dc3404c2f830784a05c788042ab44e24ee518275fb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMUU2OjNCMjA2OToyMUQ4REY6MkVGRUQzOjZCMDc0ODg3IiwidmlzaXRvcl9pZCI6Ijg2MjAwNzE2MTkxMDI0NjAwMzkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 53252c1b628af382095bcec62720d6342b803bb2b276b0b8d17b88cee90378ae |
| hovercard-subject-tag | issue:2687931119 |
| 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/14441/issue_layout |
| twitter:image | https://opengraph.githubassets.com/de103dd44e55f1862ffcc10a1d87b40b1e8819f63bd76cd90991610c1320f956/getsentry/sentry-javascript/issues/14441 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/de103dd44e55f1862ffcc10a1d87b40b1e8819f63bd76cd90991610c1320f956/getsentry/sentry-javascript/issues/14441 |
| og:image:alt | Problem Statement Feature Request: Apply stateTransformer to Attachments in createSentryPiniaPlugin First, thank you for createSentryPiniaPlugin—it's been a lifesaver! Would it be possible to apply... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sircharlo |
| hostname | github.com |
| expected-hostname | github.com |
| None | 26f151990bcb5b67b87df8b3f96ed340f849939d44e36f348402de5e39cca989 |
| 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 | cd00d8452bcb4e56a60ba7c0e61a697b46513fe9 |
| 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