-
Notifications
You must be signed in to change notification settings - Fork 25
Conversation
3 flaky tests on run #15784 ↗︎
Details:
Review all test suite changes for PR #2262 ↗︎ |
1a7b68b
to
e5f39d6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job investigating this! I just had a few comments but it looks great to me and I'm excited to see how it looks in production
@@ -46,6 +47,21 @@ const sendError = ( | |||
withScope((scope) => { | |||
setScope(scope, { level: severity, context: metadata }); | |||
|
|||
const { gqlErr, operationName } = metadata ?? {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we improve the type safety on these by adding gqlErr
and operationName
as option fields in the metadata struct on line 46.
scope.setFingerprint(fingerprint); | ||
|
||
// Apply tag, which is a searchable/filterable property | ||
setTag("operationName", metadata.operationName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setTag("operationName", metadata.operationName); | |
setTag("operationName", operationName); |
Can we also make these changes in parsley |
const sendError = ( | ||
err: Error, | ||
severity: SeverityLevel, | ||
metadata?: { [key: string]: any }, | ||
metadata?: ErrorMetadata, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This typing is technically broken since
spruce/src/utils/errorReporting.ts
Line 10 in 45550f1
const reportError = ( |
{ [key:string]: any }
so this type is never actually used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is also not flexible enough to allow for any metadata to be passed in once the typing in reportError is fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the typing in errorReporting.ts
. If you want strict typing I think we should just go all the way and update this type as more metadata fields are added rather than allow the type to be flexible.
gqlErr?: ErrorResponse["graphQLErrors"][0]; | ||
operationName?: ErrorResponse["operation"]["operationName"]; | ||
variables?: ErrorResponse["operation"]["variables"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are all actually typed from
import { GraphQLError } from "graphql";
since they are properties of the GraphQL request and not specific to Apollo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the correct typing of Apollo's onError handlers if I'm not mistaken: https://github.com/apollographql/apollo-client/blob/17ccc42825d0b0355212f3ac823780edb467ea77/src/link/error/index.ts#L28
GraphQLError
doesn't include operationName
or variables
: https://github.com/graphql/graphql-js/blob/9c90a23dd430ba7b9db3d566b084e9f66aded346/src/error/GraphQLError.ts#L41
These are Apollo-specific since they come from Apollo links; the GraphQL request is just a part of the data in the graphQLErrors
field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We discussed offline and we will make this more generic to support general grouping in the future. Feel free to re-request a review when you are ready @sophstad
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀
Can we do this on Parsley as well please! @sophstad |
DEVPROD-356
Description
Added two new fields to GraphQL errors that should help with grouping in the app:
Testing
UserProjectSettingsPermissions
being thrown with an error in the project identifier.operationName
is now a tag appearing at the top of the page:I think this is a pretty logical way of grouping things. You can also take a look on staging and see how incoming errors are grouped. Sentry's "recommended error" view is still confusing to me, and the error titles are still somewhat useless, but I think the grouping is improved.