-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
feat(browser-reporting): Add ReportingEndpoint header when staff loads Sentry #93138
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
Conversation
We want to start collecting browser reports on a temporary endpoint in S4S. This will only be enable for staff members. This is a temporary solution until we can build the proper Relay endpoint.
Codecov ReportAll modified and coverable lines are covered by tests ✅ ✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## master #93138 +/- ##
==========================================
+ Coverage 87.89% 87.90% +0.01%
==========================================
Files 10298 10309 +11
Lines 591455 592226 +771
Branches 23007 23007
==========================================
+ Hits 519876 520614 +738
- Misses 71143 71176 +33
Partials 436 436 |
staff = getattr(request, "staff", None) | ||
if staff and staff.is_active: |
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.
pretty sure there's a helper for this that's supposed to be used instead?
from django.http.response import HttpResponseBase | ||
|
||
|
||
class ReportingEndpointMiddleware: |
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.
you may find the functional approach to middleware easier -- for instance sentry.middleware.env
Suspect IssuesThis pull request was deployed and Sentry observed the following issues:
Did you find this useful? React with a 👍 or 👎 |
#93306) This adds an API endpoint, `api/0/reporting-api-experiment`, to collect deprecation, intervention, and crash reports enabled by the recently added[1] `Reporting-Endpoints` header This will hopefully get us a bit more real-world data to work with when deciding how we want to group/process/etc the reports. Since we don't yet know what kind of volume we're going to see, by default the endpoint is a no-op, and just returns a 404. However, if the new `issues.browser_reporting.collector_endpoint_enabled` option is set to `True` (as we are planning to do in S4S), the endpoint will log the incoming report to GCP and collect a metric on the overall report type. DISCLAIMER: This is proving hell on wheels to test locally. You have to proxy through an https server, it's unclear if the CORS and CSRF set up is correct, Chrome offers almost no data about the requests it's sending (and none at all unless you flip a hidden flag[2]), you have to run Chrome from the command line with a different hidden flag[3] in order to have the reports immediately rather than after a random delay... So thus far this endpoint has only been observed working a small handful of times, under circumstances that now seem unreplicable. However, since the entire thing is experimental and temporary (and by default doesn't do anything), we decided in the interest of time to just give it a shot and see what comes through. If we want to guarantee reports will be sent (to test if it's working at all), adding `navigator.vibrate(2000)` to our FE pageload will generate an intervention report, and adding `new Range().expand("dogs.are.great", 0, 1)` anywhere in our FE will generate a deprecation report. [1] #93138 [2] https://developer.chrome.com/docs/capabilities/web-apis/reporting-api#use_devtools [3] https://developer.chrome.com/docs/capabilities/web-apis/reporting-api#save_time
#93306) This adds an API endpoint, `api/0/reporting-api-experiment`, to collect deprecation, intervention, and crash reports enabled by the recently added[1] `Reporting-Endpoints` header This will hopefully get us a bit more real-world data to work with when deciding how we want to group/process/etc the reports. Since we don't yet know what kind of volume we're going to see, by default the endpoint is a no-op, and just returns a 404. However, if the new `issues.browser_reporting.collector_endpoint_enabled` option is set to `True` (as we are planning to do in S4S), the endpoint will log the incoming report to GCP and collect a metric on the overall report type. DISCLAIMER: This is proving hell on wheels to test locally. You have to proxy through an https server, it's unclear if the CORS and CSRF set up is correct, Chrome offers almost no data about the requests it's sending (and none at all unless you flip a hidden flag[2]), you have to run Chrome from the command line with a different hidden flag[3] in order to have the reports immediately rather than after a random delay... So thus far this endpoint has only been observed working a small handful of times, under circumstances that now seem unreplicable. However, since the entire thing is experimental and temporary (and by default doesn't do anything), we decided in the interest of time to just give it a shot and see what comes through. If we want to guarantee reports will be sent (to test if it's working at all), adding `navigator.vibrate(2000)` to our FE pageload will generate an intervention report, and adding `new Range().expand("dogs.are.great", 0, 1)` anywhere in our FE will generate a deprecation report. [1] #93138 [2] https://developer.chrome.com/docs/capabilities/web-apis/reporting-api#use_devtools [3] https://developer.chrome.com/docs/capabilities/web-apis/reporting-api#save_time
…s Sentry (#93138) We want to start collecting browser reports on a temporary endpoint in S4S. This will only be enabled for staff members. This is a temporary solution until we can build the proper Relay endpoint. It is intentional that: * It requires no auth since browsers do not send reports using user credentials * It is sent to s4s as we don't want any impact on saas The endpoint will be added in a different pull request. We will have an option to shut down the reporting if needed.
#93306) This adds an API endpoint, `api/0/reporting-api-experiment`, to collect deprecation, intervention, and crash reports enabled by the recently added[1] `Reporting-Endpoints` header This will hopefully get us a bit more real-world data to work with when deciding how we want to group/process/etc the reports. Since we don't yet know what kind of volume we're going to see, by default the endpoint is a no-op, and just returns a 404. However, if the new `issues.browser_reporting.collector_endpoint_enabled` option is set to `True` (as we are planning to do in S4S), the endpoint will log the incoming report to GCP and collect a metric on the overall report type. DISCLAIMER: This is proving hell on wheels to test locally. You have to proxy through an https server, it's unclear if the CORS and CSRF set up is correct, Chrome offers almost no data about the requests it's sending (and none at all unless you flip a hidden flag[2]), you have to run Chrome from the command line with a different hidden flag[3] in order to have the reports immediately rather than after a random delay... So thus far this endpoint has only been observed working a small handful of times, under circumstances that now seem unreplicable. However, since the entire thing is experimental and temporary (and by default doesn't do anything), we decided in the interest of time to just give it a shot and see what comes through. If we want to guarantee reports will be sent (to test if it's working at all), adding `navigator.vibrate(2000)` to our FE pageload will generate an intervention report, and adding `new Range().expand("dogs.are.great", 0, 1)` anywhere in our FE will generate a deprecation report. [1] #93138 [2] https://developer.chrome.com/docs/capabilities/web-apis/reporting-api#use_devtools [3] https://developer.chrome.com/docs/capabilities/web-apis/reporting-api#save_time
We want to start collecting browser reports on a temporary endpoint in S4S. This will only be enabled for staff members.
This is a temporary solution until we can build the proper Relay endpoint.
It is intentional that:
The endpoint will be added in a different pull request. We will have an option to shut down the reporting if needed.