We want to start collecting metrics from our user facing tools (fuelup, forc, and forc plugins) to better understand how they are used. This will enable us improve our tooling over time.
This task will create a new Rust crate with the aim to make it easy to capture and push telemetry from all of our Rust tools. This crate has two parts:
- A library to be used within all Rust tools
- A binary that uses this library so it can be run manually
As our tools run on end-user machines, we cannot assume users to have an always-on connection to the internet, so we will need to cache captured metrics, and then only purge these cached metrics after a successful push to our online InfluxDB service.
To do this, we do two things when instantiating a telemetry object:
-
Tool side:
- Open
$FUELUP_DIR/telemetry/metrics.<pid> with an advisory lock (released automatically by the OS on exit)
- Fork off a telemetry daemon
- Append metrics as InfluxDB Line Protocol into
$FUELUP_DIR/telemetry/metrics-<date>.<pid> as needed
-
Daemon side:
- Open an advisory lock on
$FUELUP_DIR/telemetry/sender.lock
- If the lock was obtained:
- For each non-empty, unlocked
$FUELUP_DIR/telemetry/metrics-* file:
- Send the cached metrics upstream
- Purge the metrics file
- Exit if there are no more locked metrics files
As the daemon will only send metrics from (non-empty) unlocked metrics files, long-running tools (such as fuel-core) will need to rotate out their own locked metrics files so that they are flushed regularly (this will be done automatically within this library).
Note: As InfluxDB works in UPSERT-mode, duplicates from stale metrics files should not matter.
Included within this repo is:
- code to display a note or prompt the user on how to opt-out of telemetry
- a directory to store all InfluxDB schema files
We want to start collecting metrics from our user facing tools (fuelup, forc, and forc plugins) to better understand how they are used. This will enable us improve our tooling over time.
This task will create a new Rust crate with the aim to make it easy to capture and push telemetry from all of our Rust tools. This crate has two parts:
As our tools run on end-user machines, we cannot assume users to have an always-on connection to the internet, so we will need to cache captured metrics, and then only purge these cached metrics after a successful push to our online InfluxDB service.
To do this, we do two things when instantiating a telemetry object:
Tool side:
$FUELUP_DIR/telemetry/metrics.<pid>with an advisory lock (released automatically by the OS on exit)$FUELUP_DIR/telemetry/metrics-<date>.<pid>as neededDaemon side:
$FUELUP_DIR/telemetry/sender.lock$FUELUP_DIR/telemetry/metrics-*file:As the daemon will only send metrics from (non-empty) unlocked metrics files, long-running tools (such as
fuel-core) will need to rotate out their own locked metrics files so that they are flushed regularly (this will be done automatically within this library).Note: As InfluxDB works in UPSERT-mode, duplicates from stale metrics files should not matter.
Included within this repo is: