AstroHQ / metrics-sqlite

Metrics observer/exporter for SQLite
Apache License 2.0
2 stars 0 forks source link

SQLite Observer & Exporter for SQLite

Rust docs Crates.io

This provides a fairly simple SQLite powered backend for the metrics crate, useful for offline or desktop applications to gather metrics that can be easily queried afterwards.

Version 0.4 Notes

Version 0.3 Notes

Example

    let exporter = SqliteExporter::new(
        Duration::from_secs(30), // flush to sqlite on disk every 30s (or internal buffer limit)
        Some(Duration::from_secs(60 * 60 * 24 * 7)), // 60 sec * 60 min * 24 hours * 7 days
        "metrics.db",
    )
    .expect("Failed to create SqliteExporter");
    exporter
        .install()
        .expect("Failed to install SqliteExporter");

// use metrics macros etc.
metrics::gauge!("mykey", 1.0);