https://github.com/fsaintjacques/survivalkit
A survival kit is a package of basic tools and supplies prepared in advance as an aid to survival in an emergency.
https://github.com/fsaintjacques/survivalkit
c health-check healthcheck logger monitoring sre
Last synced: about 1 year ago
JSON representation
A survival kit is a package of basic tools and supplies prepared in advance as an aid to survival in an emergency.
- Host: GitHub
- URL: https://github.com/fsaintjacques/survivalkit
- Owner: fsaintjacques
- Created: 2017-04-29T02:04:36.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-06-08T11:25:14.000Z (almost 9 years ago)
- Last Synced: 2025-01-26T11:42:04.350Z (about 1 year ago)
- Topics: c, health-check, healthcheck, logger, monitoring, sre
- Language: C
- Size: 49.8 KB
- Stars: 0
- Watchers: 5
- Forks: 1
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Surival Kit
A survival kit is a package of basic tools and supplies prepared in advance as
an aid to survival in an emergency.
This library aims to offer facilities to ease the implementation of production
ready services.
## Goals
* Linux first, readability of code is much more important than portability
* Thread safe, lightweight
* Container friendly, does not depends on local external processes
* Integrate easily with multiple backend
## Facilities
### Lifecycle
Lifecycle is a thread safe state machine representing the operational state
of a component. A lifecycle might serve many purposes:
* Improve auditing via event logs
* Automatically toggles healthcheck in STARTING and STOPPING transitions
* Centralize the exit condition of a main loop
The possibles transitions are given by the following state machine:
```
NEW → STARTING → RUNNING → STOPPING → TERMINATED
└───────┴──────────┴─────────┴─────→ FAILED
```
### Health checks
Registers callbacks that exports health status of components. This allows the
application to easily expose a health endpoint.
### Logs
Log are stored into a ring buffer. Each logger instance has his own
buffer & log level. Loggers are layered in a hierarchy and one can dynamically
manipulate loggers' level with a regex, e.g.
`sk_logger_set_level_match("myapp.db.*", SK_LOG_WARNING);`
### Metrics
Registers metrics that represent statistics of components. Supported counter
types:
* counter
* gauge
* histogram
### Managed components
Add support for managing components that requires to be properly
started/stopped, e.g. disk flush, database connections.
### Watchdog
Add support for automatic process restart, e.g. parent process monitoring.
### Exporter
Export the various utilities mentioned earlier to external sources, e.g.
* health check => nagios
* events => syslog or udp syslog
* metrics => prometheus or graphite