Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): Silently fail maybeInstrument #14140

Merged
merged 8 commits into from
Nov 4, 2024
Merged

Conversation

chargome
Copy link
Member

We have some cases where certain instrumentations fails while patching (e.g. xhr).
This PR wraps the patching of these functions in a try catch to fail silently and log an error so we don't break user's apps.

relates to #14077

@chargome chargome self-assigned this Oct 30, 2024
Copy link
Contributor

github-actions bot commented Oct 30, 2024

size-limit report 📦

⚠️ 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.

Path Size % Change Change
@sentry/browser 22.76 KB +0.08% +17 B 🔺
@sentry/browser - with treeshaking flags 21.54 KB +0.03% +6 B 🔺
@sentry/browser (incl. Tracing) 35.15 KB +0.04% +13 B 🔺
@sentry/browser (incl. Tracing, Replay) 71.87 KB +0.03% +18 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 62.3 KB +0.01% +4 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 76.19 KB +0.03% +21 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 88.99 KB +0.03% +19 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback, metrics) 90.83 KB +0.03% +19 B 🔺
@sentry/browser (incl. metrics) 27 KB +0.06% +16 B 🔺
@sentry/browser (incl. Feedback) 39.9 KB +0.04% +15 B 🔺
@sentry/browser (incl. sendFeedback) 27.4 KB +0.05% +14 B 🔺
@sentry/browser (incl. FeedbackAsync) 32.2 KB +0.05% +16 B 🔺
@sentry/react 25.51 KB +0.06% +14 B 🔺
@sentry/react (incl. Tracing) 38.12 KB +0.04% +12 B 🔺
@sentry/vue 26.9 KB +0.06% +14 B 🔺
@sentry/vue (incl. Tracing) 37.04 KB +0.04% +14 B 🔺
@sentry/svelte 22.9 KB +0.07% +16 B 🔺
CDN Bundle 24.1 KB +0.03% +5 B 🔺
CDN Bundle (incl. Tracing) 36.97 KB +0.02% +6 B 🔺
CDN Bundle (incl. Tracing, Replay) 71.63 KB +0.01% +7 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 76.97 KB +0.01% +7 B 🔺
CDN Bundle - uncompressed 70.66 KB +0.03% +18 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 109.73 KB +0.02% +18 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 222.25 KB +0.01% +18 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 235.46 KB +0.01% +18 B 🔺
@sentry/nextjs (client) 38.2 KB +0.05% +19 B 🔺
@sentry/sveltekit (client) 35.75 KB +0.02% +6 B 🔺
@sentry/node 129.62 KB +0.02% +20 B 🔺
@sentry/node - without tracing 94.31 KB +0.02% +12 B 🔺
@sentry/aws-serverless 105.18 KB +0.02% +17 B 🔺

View base workflow run

@chargome chargome requested a review from andreiborza October 30, 2024 16:46
@chargome chargome marked this pull request as ready for review October 30, 2024 16:56
@chargome chargome requested a review from mydea October 30, 2024 16:56
packages/utils/src/instrument/handlers.ts Outdated Show resolved Hide resolved
@chargome
Copy link
Member Author

the size checks seems off

@chargome chargome merged commit 6729214 into develop Nov 4, 2024
147 checks passed
@chargome chargome deleted the cg/catch-instrumentation branch November 4, 2024 11:41
alexandresoro pushed a commit to alexandresoro/ouca that referenced this pull request Nov 9, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@sentry/node](https://github.com/getsentry/sentry-javascript/tree/master/packages/node) ([source](https://github.com/getsentry/sentry-javascript)) | dependencies | minor | [`8.36.0` -> `8.37.1`](https://renovatebot.com/diffs/npm/@sentry%2fnode/8.36.0/8.37.1) |
| [@sentry/react](https://github.com/getsentry/sentry-javascript/tree/master/packages/react) ([source](https://github.com/getsentry/sentry-javascript)) | dependencies | minor | [`8.36.0` -> `8.37.1`](https://renovatebot.com/diffs/npm/@sentry%2freact/8.36.0/8.37.1) |

---

### Release Notes

<details>
<summary>getsentry/sentry-javascript (@&#8203;sentry/node)</summary>

### [`v8.37.1`](https://github.com/getsentry/sentry-javascript/blob/HEAD/CHANGELOG.md#8371)

[Compare Source](getsentry/sentry-javascript@8.37.0...8.37.1)

-   feat(deps): Bump [@&#8203;opentelemetry/instrumentation](https://github.com/opentelemetry/instrumentation) from 0.53.0 to 0.54.0 for [@&#8203;sentry/opentelemetry](https://github.com/sentry/opentelemetry) ([#&#8203;14187](getsentry/sentry-javascript#14187))

### [`v8.37.0`](https://github.com/getsentry/sentry-javascript/blob/HEAD/CHANGELOG.md#8370)

[Compare Source](getsentry/sentry-javascript@8.36.0...8.37.0)

##### Important Changes

-   **feat(nuxt): Add `piniaIntegration` ([#&#8203;14138](getsentry/sentry-javascript#14138

The Nuxt SDK now allows you to track Pinia state for captured errors. To enable the Pinia plugin, add the `piniaIntegration` to your client config:

```ts
// sentry.client.config.ts
import { usePinia } from '#imports';

Sentry.init({
  integrations: [
    Sentry.piniaIntegration(usePinia(), {
      /* optional Pinia plugin options */
    }),
  ],
});
```

-   **feat: Deprecate metrics API ([#&#8203;14157](getsentry/sentry-javascript#14157

The Sentry Metrics beta has ended in favour of revisiting metrics in another form at a later date.

This new approach will include different APIs, making the current metrics API unnecessary. This release
deprecates the metrics API with the plan to remove in the next SDK major version. If you currently use the
metrics API in your code, you can safely continue to do so but sent data will no longer be processed by Sentry.

[Learn more](https://sentry.zendesk.com/hc/en-us/articles/26369339769883-Metrics-Beta-Ended-on-October-7th) about the end of the Metrics beta.

##### Other Changes

-   feat(browser): Add `http.response_delivery_type` attribute to resource spans ([#&#8203;14056](getsentry/sentry-javascript#14056))
-   feat(browser): Add `skipBrowserExtensionCheck` escape hatch option ([#&#8203;14147](getsentry/sentry-javascript#14147))
-   feat(deps): Bump [@&#8203;opentelemetry/instrumentation](https://github.com/opentelemetry/instrumentation) from 0.53.0 to 0.54.0 ([#&#8203;14174](getsentry/sentry-javascript#14174))
-   feat(deps): Bump [@&#8203;opentelemetry/instrumentation-fastify](https://github.com/opentelemetry/instrumentation-fastify) from 0.40.0 to 0.41.0 ([#&#8203;14175](getsentry/sentry-javascript#14175))
-   feat(deps): Bump [@&#8203;opentelemetry/instrumentation-graphql](https://github.com/opentelemetry/instrumentation-graphql) from 0.43.0 to 0.44.0 ([#&#8203;14173](getsentry/sentry-javascript#14173))
-   feat(deps): Bump [@&#8203;opentelemetry/instrumentation-mongodb](https://github.com/opentelemetry/instrumentation-mongodb) from 0.47.0 to 0.48.0 ([#&#8203;14171](getsentry/sentry-javascript#14171))
-   feat(deps): Bump [@&#8203;opentelemetry/propagator-aws-xray](https://github.com/opentelemetry/propagator-aws-xray) from 1.25.1 to 1.26.0 ([#&#8203;14172](getsentry/sentry-javascript#14172))
-   feat(nuxt): Add `asyncFunctionReExports` to define re-exported server functions ([#&#8203;14104](getsentry/sentry-javascript#14104))
-   feat(nuxt): Add `piniaIntegration` ([#&#8203;14138](getsentry/sentry-javascript#14138))
-   fix(browser): Avoid recording long task spans starting before their parent span ([#&#8203;14183](getsentry/sentry-javascript#14183))
-   fix(core): Ensure errors thrown in async cron jobs bubble up ([#&#8203;14182](getsentry/sentry-javascript#14182))
-   fix(core): Silently fail `maybeInstrument` ([#&#8203;14140](getsentry/sentry-javascript#14140))
-   fix(nextjs): Resolve path for dynamic webpack import ([#&#8203;13751](getsentry/sentry-javascript#13751))
-   fix(node): Make sure `modulesIntegration` does not crash esm apps ([#&#8203;14169](getsentry/sentry-javascript#14169))

Work in this release was contributed by [@&#8203;rexxars](https://github.com/rexxars). Thank you for your contribution!

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4xNDIuNyIsInVwZGF0ZWRJblZlciI6IjM4LjE0Mi43IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=-->

Reviewed-on: https://git.tristess.app/alexandresoro/ouca/pulls/299
Reviewed-by: Alexandre Soro <[email protected]>
Co-authored-by: renovate <[email protected]>
Co-committed-by: renovate <[email protected]>
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.

5 participants