mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2025-12-23 22:18:36 -05:00
fix: describe how sentinal files work in the README; use correct list intendation
This commit is contained in:
@@ -256,11 +256,11 @@ We have a custom set of icons stored as SVG files and compiled into a font. New
|
||||
|
||||
## Logging with Sentinel Files
|
||||
|
||||
A sentinel file is a file used for the purpose of tracking the status of a system. In iNat Next, we're using sentinel files to track unsuccessful user flows. This is helpful for debugging issues related to cameras freezing, location requests stalling, or other difficult to reproduce hardware issues. Related code is in `sharedHelpers/sentinelFiles.ts`. The first user flow where we implemented this is the Camera, so you can look there for an example. To implement:
|
||||
A sentinel file is a file that is created at the beginning of an interaction flow and deleted when the user successfully completes the flow. If the user does not successfully complete the flow, the file remains until it can be reported to a monitoring system. Details about the flow may be written to the file while the flow is in progress, providing developers with details about what the user did and when they exited the flow. This can be helpful for debugging issues related to cameras freezing, location requests stalling, or other difficult to reproduce hardware issues. Related code is in `sharedHelpers/sentinelFiles.ts`. The first user flow where we implemented this is the Camera, so you can look there for an example. To implement:
|
||||
|
||||
1. At the beginning of a user flow (i.e., opening the Camera), generate a sentinel file using `await createSentinelFile( )` and passing in the name of the user flow.
|
||||
1. Log any subsequent steps in the user flow using `await logStage()` and passing in the sentinel file name, stage name, and any related data. Examples of stages in the Camera include fetching user location, saving photos, and taking a photo.
|
||||
* It's a good practice to keep stage names consistent. Taking the example of saving photos, there are three distinct stages that may be helpful to log: `save_photos_to_photo_library_start`, `save_photos_to_photo_library_complete`, `save_photos_to_photo_library_error`
|
||||
* It's a good practice to keep stage names consistent. Taking the example of saving photos, there are three distinct stages that may be helpful to log: `save_photos_to_photo_library_start`, `save_photos_to_photo_library_complete`, `save_photos_to_photo_library_error`
|
||||
1. When the user completes a user flow successfully, you can delete the sentinel file using `await deleteSentinelFile( )` and passing in the name of the user flow (i.e. when they navigate away from the Camera)
|
||||
1. On app load, we're checking for any sentinel files which have not been deleted using the `findAndLogSentinelFiles` function. If there are any lingering files, the file contents will be logged as errors to Grafana using `logger.error`, so developers on staff can peruse and see which stage a user completed successfully before the flow was abandoned.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user