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

Document Apollo3 GraphQL client errors #7135

Merged
merged 24 commits into from
Jun 15, 2023
Merged

Conversation

marandaneto
Copy link
Contributor

Pre-merge checklist

If you work at Sentry, you're able to merge your own PR without review, but please don't unless there's a good reason.

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs
  • PR was reviewed and approved by a member of the Sentry docs team

Description of changes

Describe your changes here. If your PR relates to or resolves an issue, add a link to that too.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

Extra resources

@vercel
Copy link

vercel bot commented Jun 13, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sentry-docs 🛑 Canceled (Inspect) Jun 14, 2023 9:06am

@marandaneto marandaneto marked this pull request as ready for review June 13, 2023 13:00
@marandaneto marandaneto requested a review from a team as a code owner June 13, 2023 13:00
@marandaneto
Copy link
Contributor Author

After the content is reviewed, I will duplicate the content to the Java docs since it can be reused, eg https://docs.sentry.io/platforms/java/performance/instrumentation/apollo3/

Copy link
Member

@kahest kahest left a comment

Choose a reason for hiding this comment

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

Good stuff! Left a few notes and suggestions :)

@@ -32,7 +32,8 @@ Add `Interceptors` to `ApolloClient.Builder` using `ApolloBuilderExtensions`:
import com.apollographql.apollo3.ApolloClient;
import io.sentry.apollo3.SentryApolloBuilderExtensionsKt;

ApolloClient apollo = SentryApolloBuilderExtensionsKt.sentryTracing(new ApolloClient.Builder())
ApolloClient apollo = SentryApolloBuilderExtensionsKt
Copy link
Member

Choose a reason for hiding this comment

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

m: is there a reason why we use a different snippet here than below?

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 just did indentation here, the code already exists, not sure I follow the question.
There's a difference between Kotlin vs Java as well.

Copy link
Member

Choose a reason for hiding this comment

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

Oh right, you only need SentryApolloBuilderExtensionsKt on Java, and the snippets below are only in Kotlin, sorry for the confusion. Should we add Java snippets for client errors as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To be honest, I think we should go Kotlin first and only, less to maintain, nowadays IDEs auto convert the code on copy and paste.
Also, the Apollo3 is designed for KMP, Kotlin first, 90%+ won't be using Kotlin anymore most likely.

Copy link
Member

Choose a reason for hiding this comment

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

That's fair, we could add a section "you can also use this in Java like this: " and the other snippets only in Kotlin. But not necesserily in ths PR

Copy link
Contributor

@lizokm lizokm left a comment

Choose a reason for hiding this comment

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

Made some language suggestions.

Comment on lines 141 to 144
By default, only GraphQL client errors with a response that includes the [errors](https://spec.graphql.org/October2021/#sec-Errors) array are captured as error events.

GraphQL client errors from every target (`.*` regular expression) are automatically captured, but you can change this behavior by setting the `failedRequestTargets` option with either a regular expression or a plain `String`. A plain string must contain at least one of the items from the list. Plain strings don't have to be full matches, meaning the URL of a request is matched when it contains a string provided through the option.

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
By default, only GraphQL client errors with a response that includes the [errors](https://spec.graphql.org/October2021/#sec-Errors) array are captured as error events.
GraphQL client errors from every target (`.*` regular expression) are automatically captured, but you can change this behavior by setting the `failedRequestTargets` option with either a regular expression or a plain `String`. A plain string must contain at least one of the items from the list. Plain strings don't have to be full matches, meaning the URL of a request is matched when it contains a string provided through the option.
By default, only GraphQL client errors with a response that includes the [errors](https://spec.graphql.org/October2021/#sec-Errors) array will be captured as error events.
GraphQL client errors from every target (`.*` regular expression) will be automatically captured, but you can change this behavior by setting the `failedRequestTargets` option with either a regular expression or a plain `String`. Plain strings don't have to be full matches – the URL of a request will be matched if it contains a string provided through the option, but a plain string must contain at least one of the items from the list.

From the list of errors? Can we specify the list of what please?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

failedRequestTargets is the list provided by the user.

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'm applying the fix for the 1st part, let me know if the 2nd part needs adaption after clarification here https://github.com/getsentry/sentry-docs/pull/7135/files#r1229248641

marandaneto and others added 19 commits June 14, 2023 10:47
Co-authored-by: openapi-getsentry-bot <[email protected]>
* add redirects for sourcemaps best practices

* add clientdev redirects
* remove link to Apple debug symbols page
Add React Router Info to:
*src/wizard/javascript/react/index.md
* src/wizard/javascript/react/with-error-monitoring-performance-and-replay.md
* src/wizard/javascript/react/with-error-monitoring-and-performance.md
@marandaneto marandaneto requested a review from a team as a code owner June 14, 2023 08:52
@@ -32,7 +32,8 @@ Add `Interceptors` to `ApolloClient.Builder` using `ApolloBuilderExtensions`:
import com.apollographql.apollo3.ApolloClient;
import io.sentry.apollo3.SentryApolloBuilderExtensionsKt;

ApolloClient apollo = SentryApolloBuilderExtensionsKt.sentryTracing(new ApolloClient.Builder())
ApolloClient apollo = SentryApolloBuilderExtensionsKt
Copy link
Member

Choose a reason for hiding this comment

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

Oh right, you only need SentryApolloBuilderExtensionsKt on Java, and the snippets below are only in Kotlin, sorry for the confusion. Should we add Java snippets for client errors as well?

@marandaneto marandaneto merged commit f35d333 into master Jun 15, 2023
@marandaneto marandaneto deleted the chore/apollo3-graphql-errors branch June 15, 2023 11:47
@github-actions github-actions bot locked and limited conversation to collaborators Jul 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

10 participants