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(browser): Add graphqlClientIntegration #13783

Open
wants to merge 62 commits into
base: develop
Choose a base branch
from

Conversation

Zen-cronic
Copy link
Contributor

@Zen-cronic Zen-cronic commented Sep 25, 2024

Resolves #13399

Todo:

  • Support fetch spans and tests
  • Support shorthand graphql queries (i.e., without a name) Moved to later
  • Enhance breadcrumb data

  • If you've added code that should be tested, please add tests.
  • Ensure your code lints and the test suite passes (yarn lint) & (yarn test).

@Zen-cronic Zen-cronic requested a review from mydea September 26, 2024 15:05
@Zen-cronic
Copy link
Contributor Author

Zen-cronic commented Sep 26, 2024

  • Todo: fix failing fetch tests by removing body from non-graphql requests

@Zen-cronic Zen-cronic requested a review from mydea September 30, 2024 13:02
@Zen-cronic
Copy link
Contributor Author

Just wanted to inform about the failing tests:

Copy link
Member

@mydea mydea left a comment

Choose a reason for hiding this comment

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

I finally found the time to review this in depth. Overall, I really like it, I left some comments with requests for changes. Mostly it is about moving stuff around, and avoiding any graphql-specific code in the "general" places. Also, please note that if you rebase this in develop, there are/will be a bunch of conflicts - this is mostly because the utils package is deprecated and all that code was moved to core.

@Zen-cronic
Copy link
Contributor Author

Zen-cronic commented Dec 20, 2024

noted, i'll implement the feedback. thanks for the comprehensive review!

  • update span hook
  • update breadcrumb hook
  • resolve rebase conflicts

will move on with the conflicts if the current implementation checks out

@Zen-cronic Zen-cronic requested a review from a team as a code owner January 7, 2025 15:53
@@ -0,0 +1,121 @@
import { SENTRY_XHR_DATA_KEY } from '@sentry-internal/browser-utils';
import { getBodyString } from '@sentry-internal/replay';
Copy link
Member

Choose a reason for hiding this comment

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

@mydea should this util be in the replay package?

Copy link
Member

Choose a reason for hiding this comment

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

if we use/need it here, I would move it to @sentry-internal/browser-utils, and use it from there both in replay and here!

Copy link
Member

Choose a reason for hiding this comment

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

otherwise, this will lead to circular dependency issues :)

@Zen-cronic Zen-cronic requested a review from mydea January 7, 2025 18:58
packages/types/src/client.ts Outdated Show resolved Hide resolved
packages/types/src/client.ts Outdated Show resolved Hide resolved
Zen-cronic and others added 19 commits January 23, 2025 19:15
Signed-off-by: Kaung Zin Hein <[email protected]>
- Moved fetch-related operations into the grahqlClient integration.
- Used Hint types for `beforeOutgoingRequestSpan` hooks.

Signed-off-by: Kaung Zin Hein <[email protected]>
Signed-off-by: Kaung Zin Hein <[email protected]>
- Also moved `NetworkMetaWarning` type.

Signed-off-by: Kaung Zin Hein <[email protected]>
Signed-off-by: Kaung Zin Hein <[email protected]>
Signed-off-by: Kaung Zin Hein <[email protected]>
…ntegration' into feat/graphqlClientIntegration
…s other than string

- Moved internal `getFetchRequestArgBody` to `browser-utils`.
- Added unit tests.

Signed-off-by: Kaung Zin Hein <[email protected]>
@Zen-cronic
Copy link
Contributor Author

i'm not sure what's making the webkit tests flaky for the added integration tests; locally they all pass on consecutive runs via yarn test --project='webkit' graphQLClient

- Moved replay-specific `_serializeFormData` to `browser-utils` and added test.

Signed-off-by: Kaung Zin Hein <[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.

Add optional graphqlClientIntegration to @sentry/browser
4 participants