FuelLabs / FuelLabs/fuelup

Create fuel-telemetry library and binary

Open
#690 0 comments 0 reactions 1 assignee Claimed by @alfiedotwtf View on GitHub
code quality fuelup
Dominant language
Rust
Stars
282
Forks
150
Avg merge
2d 17h
Merged PRs (30d)
2

Description

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:

1. A library to be used within all Rust tools
2. 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.` 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-.` 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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.