Crates.io | metrics-sqlite |
lib.rs | metrics-sqlite |
version | 0.4.1 |
source | src |
created_at | 2021-03-09 16:22:09.090755 |
updated_at | 2023-06-28 15:16:21.424015 |
description | Library for providing SQLite backend for metrics |
homepage | |
repository | https://github.com/AstroHQ/metrics-sqlite/ |
max_upload_size | |
id | 366384 |
size | 73,711 |
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.
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);