mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2025-12-23 22:18:36 -05:00
Add description of sentinel files in README (#2600)
This commit is contained in:
committed by
GitHub
parent
7ec14e9e78
commit
5f4404c48a
10
README.md
10
README.md
@@ -254,6 +254,16 @@ We have a custom set of icons stored as SVG files and compiled into a font. New
|
||||
1. `npm run icons`
|
||||
1. Rebuild the app (you'll have newly-linked assets that won't hot reload)
|
||||
|
||||
## Logging with Sentinel Files
|
||||
|
||||
We're using sentinel files to be able 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:
|
||||
|
||||
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`
|
||||
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.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
1. Run `npx react-native clean-project`. This will give you options to clean caches, clean builds, reinstall pods, and reinstall node_modules. Using this eliminates a lot of hard-to-diagnose build issues.
|
||||
|
||||
Reference in New Issue
Block a user