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

Make BugsnagNetworkRequestPlugin more useful, especially for GraphQL APIs #1275

Open
gonzalonunez opened this issue Jan 10, 2022 · 3 comments
Labels
backlog We hope to fix this feature/bug in the future feature request Request for a new feature

Comments

@gonzalonunez
Copy link

Description

I'm curious if there is any interest in increasing the general utility of the BugsnagNetworkRequestPlugin, especially for GraphQL APIs. What if, at the very least, the request and response bodies were sent over to Bugsnag?

By default, the URLRequests sent by GraphQL APIs don't end up providing very useful information when they make it over to Bugsnag: every request has the same URL, for example.

Screen Shot 2022-01-10 at 3 50 05 PM

Describe the solution you'd like
Since the BSGURLSessionTracingDelegate has access to the NSHTTPURLResponse when it comes time to log, what if we exposed a way for clients to parse the Data to a String however they'd like (I wouldn't want to assume JSON, but I'm interested in JSON personally) and that was included in the error information that gets sent up to Bugsnag?

Describe alternatives you've considered
I'm aware of the ability to make some changes here server-side, but I'm mostly interested in having the bodies themselves show up in Bugsnag – regardless of whatever the web can do to change the URLs themselves.

Additional context
This would make the plugin extremely useful for me, and I would prefer a built-in approach instead of dropping the plugin altogether and adding additional logging myself.

@luke-belton
Copy link
Member

luke-belton commented Jan 12, 2022

Hi @gonzalonunez - thanks for the suggestions, this sounds like it would be a useful addition to the BugsnagNetworkRequestPlugin! We're already looking at investigating better support for GraphQL across our notifier librariers so I've flagged this use case with our product team. I'll keep you updated on this thread when there are any changes!

@luke-belton luke-belton added backlog We hope to fix this feature/bug in the future feature request Request for a new feature labels Jan 12, 2022
@gonzalonunez
Copy link
Author

@luke-belton awesome, thank you!

@lickel
Copy link

lickel commented Jan 27, 2023

Since the BSGURLSessionTracingDelegate has access to the NSHTTPURLResponse when it comes time to log, what if we exposed a way for clients to parse the Data to a String however they'd like (I wouldn't want to assume JSON, but I'm interested in JSON personally) and that was included in the error information that gets sent up to Bugsnag?

Personally I think this would be bad to do holistically.
That said, it would be great if the plugin supported configuration.

My proposal would be a block API that the network plugin accepts to persist additional metadata.
In my particular use case, I would like to capture a tracing header that I originally sent to the backend.
E.g.:

@escaping (NSHTTPURLResponse) -> [String: Any])
typedef NSDictionary (^BugsnagNetworkBreadcrumbMetadataProvider)(NSHTTPURLResponse *_Nonnull response);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog We hope to fix this feature/bug in the future feature request Request for a new feature
Projects
None yet
Development

No branches or pull requests

3 participants