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
Adds Shiny error tracking (#116) #162
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #162 +/- ##
==========================================
- Coverage 30.48% 29.92% -0.57%
==========================================
Files 16 16
Lines 1476 1504 +28
==========================================
Hits 450 450
- Misses 1026 1054 +28 ☔ View full report in Codecov by Sentry. |
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.
The code looks good. Can you detail some examples apps to test it?
Mainly, a way to test it to see limitations before v1.8.1
@@ -125,7 +127,8 @@ Telemetry <- R6::R6Class( # nolint object_name_linter | |||
navigation_input_id = NULL, | |||
session = shiny::getDefaultReactiveDomain(), | |||
username = NULL, | |||
track_anonymous_user = TRUE | |||
track_anonymous_user = TRUE, | |||
track_errors = TRUE |
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.
Should also have an assertion checkmate::assert_flag(track_errors)
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.
Done
R/telemetry.R
Outdated
#' and when a username is not explicitly defined.`TRUE` by default | ||
#' and when a username is not explicitly defined.`TRUE` by default. | ||
#' @param track_errors flag that indicates if the basic telemetry should | ||
#' track the errors. `TRUE` by default |
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.
Please consider adding here a description that there is a limitation on the errors' information on versions before shiny 1.8.1
.
Added in the PR Description |
Closes #116
Changes description
There are two implementations for this issue
1) Supports Newer versions of shiny(>=1.8.1):
This
unhandledError()
will be triggered when an error occurred and before the session end and contains the error object (Making it suitable for logging root cause of the error).2) Supports older versions of shiny(<1.8.1):
Examples:
a) Able to log errors: Will log 'Object x not found error'
b) Unable to log: Not able to log before app stops running
Note1: We also added public method
log_error(output_id, message)
. Such that user can use this method log errors from their 'try-catch' block.Note2: (Will add this after discussion) In Older versions, we can also capture other errors in shiny reactive elements, By using ,
options(shiny.error = function(){.....})
The only drawback is, we won't get the error object to identify the root cause of the issue.