-
-
Notifications
You must be signed in to change notification settings - Fork 226
SentryGraphQLHttpFailedRequestHandler improved issue grouping. #4762
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
base: main
Are you sure you want to change the base?
Changes from all commits
dd0359b
e7cd5df
c3faef8
6692c2f
3a8b858
9301663
b74ff29
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| using System.Runtime.ExceptionServices; | ||
| using Sentry.Internal; | ||
| using Sentry.Internal.Extensions; | ||
| using Sentry.Protocol; | ||
|
|
@@ -24,15 +25,24 @@ protected internal override void DoEnsureSuccessfulResponse([NotNull] HttpReques | |
| JsonElement? json = null; | ||
| try | ||
| { | ||
| json = GraphQLContentExtractor.ExtractResponseContentAsync(response, _options).Result; | ||
| json = GraphQLContentExtractor.ExtractResponseContentAsync(response, _options).GetAwaiter().GetResult(); | ||
| if (json is { } jsonElement) | ||
| { | ||
| if (jsonElement.TryGetProperty("errors", out var errorsElement)) | ||
| { | ||
| // We just show the first error... maybe there's a better way to do this when multiple errors exist. | ||
| // We should check what the Java code is doing. | ||
| var errorMessage = errorsElement[0].GetProperty("message").GetString() ?? "GraphQL Error"; | ||
| throw new GraphQLHttpRequestException(errorMessage); | ||
| var exception = new GraphQLHttpRequestException(errorMessage); | ||
|
|
||
| #if NET5_0_OR_GREATER | ||
| // Add a full stack trace into the exception to improve Issue grouping, | ||
| // see https://github.com/getsentry/sentry-dotnet/issues/3582 | ||
| ExceptionDispatchInfo.Throw(ExceptionDispatchInfo.SetCurrentStackTrace(exception)); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So I think I'm getting confused now. How is this: ... different from this? I get that the behaviour for
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is different, I know it's not obvious--try it via the unit test and debugging, if you're interested. The one test should fail if you just throw
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. indeed via at Sentry.SentryGraphQLHttpFailedRequestHandler.DoEnsureSuccessfulResponse(HttpRequestMessage request, HttpResponseMessage response) in /../sentry-dotnet/src/Sentry/SentryGraphQLHttpFailedRequestHandler.cs:line 40
+ at Sentry.SentryFailedRequestHandler.HandleResponse(HttpResponseMessage response) in /../sentry-dotnet/src/Sentry/SentryFailedRequestHandler.cs:line 47
+ at Sentry.SentryGraphQLHttpMessageHandler.HandleResponse(HttpResponseMessage response, ISpan span, String method, String url) in /../sentry-dotnet/src/Sentry/SentryGraphQLHttpMessageHandler.cs:line 95
+ at Sentry.SentryMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) in /../sentry-dotnet/src/Sentry/SentryMessageHandler.cs:line 91
+ at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s)
+ at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
+ at ...
+ at System.Threading.ThreadPoolWorkQueue.Dispatch()
+ at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
+ at System.Threading.Thread.StartCallback()
+--- End of stack trace from previous location ---
+ at Sentry.SentryGraphQLHttpFailedRequestHandler.DoEnsureSuccessfulResponse(HttpRequestMessage request, HttpResponseMessage response) in /../sentry-dotnet/src/Sentry/SentryGraphQLHttpFailedRequestHandler.cs:line 40
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. however .... there isn't really a difference in user frames ... 🤔
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ericsampson, could you give 6.0.0-rc.2 a try to confirm that #4724 indeed improves your scenario?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Flash0ver sent you and James an email just now with some info, it doesn't look like it's working how I expected/wanted 😭
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's OK - this problem space turns us all on our heads at some point. Thanks heaps for looking into this @ericsampson and should we close this PR then?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd be interested in at least figuring out why it's turning out this way, for the HTTP Client case at least. It feels to me like maybe the Sentry server-side fingerprinting or something is transforming things in a way that is unexpected to me... |
||
| #else | ||
| // Where SetCurrentStackTrace is not available, just throw the Exception | ||
| throw exception; | ||
| #endif | ||
| } | ||
| } | ||
| // No GraphQL errors, but we still might have an HTTP error status | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.