5 stable releases
2.1.0 | Jun 8, 2022 |
---|---|
2.0.0 | Oct 20, 2020 |
1.0.2 | Feb 22, 2020 |
1.0.1 | Apr 13, 2019 |
1.0.0 | Feb 1, 2019 |
#2590 in Command line utilities
14KB
207 lines
Sentry Process
Report failed processes/scripts to Sentry.
⚠️ Main repository is here: https://gitlab.com/dsferruzza/sentry-process ⚠️
Motivation
Sentry is a cool system that helps developers to aggregate, monitor and fix errors/exceptions in their own apps. It has integrations for many technologies so that reported errors can contain relevant informations.
But sometimes it can be desirable to plug Sentry to an arbitrary process. Such process can be a binary that was built without Sentry support, or a Bash script that runs every night on a server, for example.
With Sentry Process it is now easy to launch a process that will send an event to a Sentry instance whenever it fails!
How to use
- compile or install the project
- set the
SENTRY_DSN
environment variable (use the URL given inYour project > Settings > Client Keys (DSN)
in Sentry) - run
sentry-process COMMAND [ARGUMENTS]...
(wrap your process call like you would do withsudo
)
If running COMMAND [ARGUMENTS]...
results in an exit code that is not 0
, Sentry Process considers it as a failure and reports. For example, sentry-process false
will report whereas sentry-process true
will not.
The exit code, standard output and standard error of COMMAND [ARGUMENTS]...
are re-emmited by sentry-process COMMAND [ARGUMENTS]...
, so that it can be piped or used by other programs. In fact, standard output and standard error are streamed so you can run (for example) sentry-process wget https://somebigfileurl
and see the progress just like if you had run wget https://somebigfileurl
.
Rust Version Requirements
Sentry Process needs Rust 1.54+ to be compiled.
Limitations
- The process you want to run must terminate eventually. It may not make sense to use Sentry Process with processes that are designed to never die (like servers).
- You will not get much details on what failed (i.e. no stacktraces). This is the tradeoff here.
- Sentry Process will send to your Sentry instance both standard output (
stdout
) and standard error (stderr
) of the process you want to run (if it fails). Your Sentry instance might reject the report if this data is more than 200 kB (see Sentry's documentation), so Sentry Process uses a circular buffer to ensure that this limit cannot be reached and the most recent outputs are sent with the report.
License
MIT License Copyright (c) 2019 David Sferruzza
Dependencies
~12–25MB
~391K SLoC