-
-
Notifications
You must be signed in to change notification settings - Fork 114
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
Add setting to send diagnostics back to SN #463
Conversation
47b551f
to
81dc90c
Compare
81dc90c
to
a8d17de
Compare
7a85474
to
a56516f
Compare
Asked for feedback here: https://stacker.news/items/248388 |
components/logger.js
Outdated
|
||
function detectOS () { | ||
const userAgent = window.navigator.userAgent | ||
const platform = window.navigator?.userAgentData?.platform || window.navigator.platform |
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.
Here you check for navigator but you don't the line before. I think I recall navigator not being defined in some browsers. It might be best to bail out of os detection if navigator isn't defined.
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.
Copied that code from SO. Not sure why there is this inconsistency.
Also, navigator
should be supported by every browser. We may had this error because of SSR?
But I'll use window.navigator?
anyway. Better be safe than sorry :)
a56516f
to
dd2eb1c
Compare
Since we discussed hiding the setting and only enabling it for us manually ... should we just hide the setting? The advantage would be that we don't need to explain what it does. The disadvantage would be that it's less transparent that this exists and some stackers may actually want to help us. I'll also try to fix the error boundary in this PR. So we'll get more useful information out of these changes already. |
Nah let's keep it there. I'll do a pass on the copy before/after merging. |
Stackers can now help us to identify and fix bugs by enabling diagnostics. This will send anonymized data to us. For now, this is only used to send events around push notifications.
It's only pseudonymous since with additional knowledge (which stacker uses which fancy name), we could trace the events back to individual stackers. Data is only anonymous if this is not possible - it must be irreversible.
dd2eb1c
to
0b4e285
Compare
Using the Slack SDK now. The only (minor, imo) issue is that messages from a client arrive out of order in slack since we don't wait until the previous slack requests are done before submitting new slack requests. Doing this would require a mutex in the server or client afaict. We can't just use But I think this fine for the first iteration. I also looked into the error boundary. I noticed that So I think it's also not worth it to dig into that further - at least for now. We can use this as-is and see if that even works well. If too many people start using it, the messages being out of order may become more important so that should be fixed in that case first before anything else. |
Overall it looks good. The only real concern I have with this is storing the log messages in the application db when this may be kind of noisy/a lot to store. It might be worth removing the db storage until we have somewhere less permanent to store them. idk I need to think about this a little more. |
Going to merge (and possibly comment out the db storage) |
This should help to investigate #411.
This adds a new opt-in setting
allow diagnostics
:I added a new endpoint
/api/log
where diagnostics data from devices of stackers which have this setting enabled are sent. This endpoint is unauthenticated for privacy reasons.To know which events belong to the same client, a fancy random name is generated which is only known to the client. Hence if a stacker uses two different devices, it will show up with two different names. This should make sending these events pseudonymous since we could trace back to the individual stacker if the stacker tells us their fancy name. It would only be anonymous if this step is not reversible.
Additionally, anything sent to that endpoint is also sent into a Slack channel:
sample log in slack:
Since the endpoint is unauthenticated, you don't even need an account to send something to it. This may be a problem but if we require authentication, this seems antithetical to
-- #411 (comment)
Additionally, I think using authentication doesn't even really help against potential spam since anyone can easily create an account.