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

feat: upgrade to @sentry/browser 8 #467

Merged
merged 2 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@
},
"peerDependencies": {
"@apollo/client": "^3.2.3",
"@sentry/browser": "^7.41.0",
"@sentry/browser": "^8.0.0",
"graphql": "15 - 16"
},
"devDependencies": {
"@apollo/client": "^3.5.6",
"@semantic-release/changelog": "^6.0.2",
"@semantic-release/git": "^10.0.1",
"@sentry/browser": "^7.41.0",
"@sentry/browser": "^8.0.0",
"@types/jest": "^27.0.3",
"@typescript-eslint/eslint-plugin": "^5.7.0",
"@typescript-eslint/parser": "^5.7.0",
Expand Down
15 changes: 3 additions & 12 deletions src/sentry.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { Operation } from '@apollo/client/core';
import {
addBreadcrumb,
configureScope,
Breadcrumb,
Scope,
} from '@sentry/browser';
import { Breadcrumb, addBreadcrumb, getCurrentScope } from '@sentry/browser';

import { GraphQLBreadcrumb } from './breadcrumb';
import { extractDefinition } from './operation';
Expand All @@ -16,9 +11,7 @@ export function setTransaction(operation: Operation): void {
const name = definition.name;

if (name) {
configureScope((scope: Scope) => {
scope.setTransactionName(name.value);
});
getCurrentScope().setTransactionName(name.value);
}
}

Expand All @@ -29,9 +22,7 @@ export function setFingerprint(operation: Operation): void {
const name = definition.name;

if (name) {
configureScope((scope: Scope) => {
scope.setFingerprint([DEFAULT_FINGERPRINT, name.value]);
});
getCurrentScope().setFingerprint([DEFAULT_FINGERPRINT, name.value]);
}
}

Expand Down
8 changes: 3 additions & 5 deletions tests/SentryLink.test.ts
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Figuring out how to fix some tests here still ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not familiar with this sentry-testkit thing but it seems that whilst all tests pass individually, when the whole suite runs they conflict with each other as testkit.reports contains data from other tests.

@spawnia would you know anything about that?

Copy link
Collaborator

Choose a reason for hiding this comment

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

It appears that their API has not changed, see https://zivl.github.io/sentry-testkit/docs/getting-started#reset-between-tests. Perhaps we need to upgrade to the latest version, see https://github.com/zivl/sentry-testkit/tags?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea that was the first place I looked. I tried it locally, as it did not have an effect I did not commit it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I have no other ideas. Let me know when you have a fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I filed an issue with them zivl/sentry-testkit#200

I assume that is the problem

Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,9 @@ describe('SentryLink', () => {
beforeEach(() => {
testkit.reset();

Sentry.configureScope((scope) => {
scope.clearBreadcrumbs();
scope.setTransactionName();
scope.setFingerprint([]);
});
Sentry.getIsolationScope().clearBreadcrumbs();
Sentry.getCurrentScope().setTransactionName();
Sentry.getCurrentScope().setFingerprint([]);
});

it('should attach a sentry breadcrumb for an apolloOperation', (done) => {
Expand Down
113 changes: 71 additions & 42 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1081,47 +1081,76 @@
lodash "^4.17.4"
read-pkg-up "^7.0.0"

"@sentry/browser@^7.41.0":
version "7.41.0"
resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-7.41.0.tgz#f4e789417e3037cbc9cd15f3a000064b1873b964"
integrity sha512-ZEtgTXPOHZ9/Qn42rr9ZAPTKCV6fAjyDC4FFWMGP4HoUqJqr2woRddP9O5n1jvjsoIPAFOmGzbCuZwFrPVVnpQ==
dependencies:
"@sentry/core" "7.41.0"
"@sentry/replay" "7.41.0"
"@sentry/types" "7.41.0"
"@sentry/utils" "7.41.0"
tslib "^1.9.3"

"@sentry/[email protected]":
version "7.41.0"
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.41.0.tgz#a4a8291ef4e65f40c28fc38318e7dae721d5d609"
integrity sha512-yT3wl3wMfPymstIZRWNjuov4xhieIEPD0z9MIW9VmoemqkD5BEZsgPuvGaVIyQVMyx61GsN4H4xd0JCyNqNvLg==
dependencies:
"@sentry/types" "7.41.0"
"@sentry/utils" "7.41.0"
tslib "^1.9.3"

"@sentry/[email protected]":
version "7.41.0"
resolved "https://registry.yarnpkg.com/@sentry/replay/-/replay-7.41.0.tgz#73168d659b0e78ca58574831a6672a77ce9727ee"
integrity sha512-/vxuO17AysCoBbCl9wCwjsCFBD4lEbYgfC1GJm8ayWwPU1uhvZcEx6reUwi0rEFpWYGHSHh3+gi+QsOcY/EmnQ==
dependencies:
"@sentry/core" "7.41.0"
"@sentry/types" "7.41.0"
"@sentry/utils" "7.41.0"

"@sentry/[email protected]":
version "7.41.0"
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.41.0.tgz#3d53432a3d7693a31b606d3083ab9203c56f5aec"
integrity sha512-4z9VdObynwd64i0VHCqkeIAHmsFzapL21qN41Brzb7jY/eGxjn/0rxInDGH+vkoE9qacGqiYfWj4vRNPLsC/bw==

"@sentry/[email protected]":
version "7.41.0"
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.41.0.tgz#54224dba668dd8c8feb0ff1b4f39938b8fdefd3b"
integrity sha512-SL+MGitvkakbkrOTb48rDuJp9GYx/veB6EOzYygh49+zwz4DGM7dD4/rvf/mVlgmXUzPgdGDgkVmxgX3nT7I7g==
dependencies:
"@sentry/types" "7.41.0"
tslib "^1.9.3"
"@sentry-internal/[email protected]":
version "8.0.0"
resolved "https://registry.yarnpkg.com/@sentry-internal/browser-utils/-/browser-utils-8.0.0.tgz#69bd216abf78d9eef2e6fcdf99d7c281986508d7"
integrity sha512-dzmoDK7mzP7MvNt/jjs9a4OQ18H/8NyhDiKoJakVZnvk8ComGIv01vOOxDhrNmLyaJSq2KVNsiIJ+AkTmwcmyQ==
dependencies:
"@sentry/core" "8.0.0"
"@sentry/types" "8.0.0"
"@sentry/utils" "8.0.0"

"@sentry-internal/[email protected]":
version "8.0.0"
resolved "https://registry.yarnpkg.com/@sentry-internal/feedback/-/feedback-8.0.0.tgz#94795aea2d7fb23e698e50032899e9b4f4d04a68"
integrity sha512-2Jj0B5xn1y5kiOwso7EWQDlLGRt1tGcnglIYqCIpwNQM38yqn+5NMwH/Df7TkBlxBerKo4MYZZ2yHNUpkTXQ7Q==
dependencies:
"@sentry/core" "8.0.0"
"@sentry/types" "8.0.0"
"@sentry/utils" "8.0.0"

"@sentry-internal/[email protected]":
version "8.0.0"
resolved "https://registry.yarnpkg.com/@sentry-internal/replay-canvas/-/replay-canvas-8.0.0.tgz#eb4da3ec5c8371ed9112ad69712d960c24ee28b5"
integrity sha512-jeE5YQ42groVRvbM41iL4rxvWuKOVnZ7UXacHDgWerR2S+C7OtN3Ydzr34rfRYTVagqFPDcDswFrxrcWuZD+Kw==
dependencies:
"@sentry-internal/replay" "8.0.0"
"@sentry/core" "8.0.0"
"@sentry/types" "8.0.0"
"@sentry/utils" "8.0.0"

"@sentry-internal/[email protected]":
version "8.0.0"
resolved "https://registry.yarnpkg.com/@sentry-internal/replay/-/replay-8.0.0.tgz#3ba2dea8df79d1e31e4ec0ce948dfbb994731b0f"
integrity sha512-lh0opJuhvKFgLK0TxeN2FDhnCc9qNdgBOpjA69hwpKl10kMxDoZy+oLxE4hx8j5RYKtM2o7mCv2rf1n0wK22Kg==
dependencies:
"@sentry-internal/browser-utils" "8.0.0"
"@sentry/core" "8.0.0"
"@sentry/types" "8.0.0"
"@sentry/utils" "8.0.0"

"@sentry/browser@^8.0.0":
version "8.0.0"
resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-8.0.0.tgz#9c2f2d62f196a5b9b5a7174d0970c4f974722c98"
integrity sha512-HZt5bjujxz2XJA1iUqD51gEz/h8Ij+BYLu6D+qh6WpVtCSS1cfKoxJj8mQef7j5tIVVofxRtRr9PvAoFnehO0A==
dependencies:
"@sentry-internal/browser-utils" "8.0.0"
"@sentry-internal/feedback" "8.0.0"
"@sentry-internal/replay" "8.0.0"
"@sentry-internal/replay-canvas" "8.0.0"
"@sentry/core" "8.0.0"
"@sentry/types" "8.0.0"
"@sentry/utils" "8.0.0"

"@sentry/[email protected]":
version "8.0.0"
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-8.0.0.tgz#fd5f94c9ef72ce386ae37de852f156106ea807d5"
integrity sha512-PgOqQPdlIbiLFOo0F6IBzMbvusiEQ86+yXd76pIsuqQ2tj+iFL5gdYOckF/FKVpAwhfzIx64GKin2C+535c1qQ==
dependencies:
"@sentry/types" "8.0.0"
"@sentry/utils" "8.0.0"

"@sentry/[email protected]":
version "8.0.0"
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-8.0.0.tgz#5047dcbcff6a38699e4490acd941baffafb72f45"
integrity sha512-Dtd8dtFEq1XtdAntkguYHaL4tokzm4Aq5t0HP6Vl1P+MPImokDE1UcpKglkh0Z5aym/vF6e0qW9/CM7lAI5R/A==

"@sentry/[email protected]":
version "8.0.0"
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-8.0.0.tgz#24b2f3f24cf521c0180e4335da63a4c6e51fa7dd"
integrity sha512-oZex/dRKfkWHoK99W7QDQtr26IZrAD9EDd2+pwLmkFclApxVDGLLKNkmcbfj4LX1zMROxKWww/GTE7eo08tEKg==
dependencies:
"@sentry/types" "8.0.0"

"@sinonjs/commons@^1.7.0":
version "1.8.6"
Expand Down Expand Up @@ -6686,7 +6715,7 @@ tsconfig-paths@^3.14.1:
minimist "^1.2.6"
strip-bom "^3.0.0"

tslib@^1.8.1, tslib@^1.9.3:
tslib@^1.8.1:
version "1.14.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==
Expand Down
Loading