Skip to content

Commit

Permalink
start integrating a KV store for metrics
Browse files Browse the repository at this point in the history
the local metrics storage was not very satisfying: metrics are pre
aggregated, so requesting them gives the last instant value, they are
deleted regularly to preserve memory so not much data is kept, and
requesting them through the `metrics` command line option gathers all of
the data in one object (which can get large with many applications)
then deletes everything.

This commit introduces the sled key value database to store current and
previous metrics, and to query them in a more flexible way
  • Loading branch information
Geal authored and FlorentinDUBOIS committed Jul 13, 2022
1 parent fce54ca commit b7fa649
Show file tree
Hide file tree
Showing 4 changed files with 230 additions and 253 deletions.
50 changes: 50 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions command/src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ pub struct AppMetricsData {
pub backends: BTreeMap<String, BTreeMap<String, FilteredData>>,
}

impl AppMetricsData {
pub fn new() -> Self {
AppMetricsData {
data: BTreeMap::new(),
backends: BTreeMap::new(),
}
}
}

#[derive(Debug,Clone,PartialEq,Eq,Hash,Serialize,Deserialize)]
#[serde(tag = "type", content = "data", rename_all = "SCREAMING_SNAKE_CASE")]
pub enum FilteredData {
Expand Down
2 changes: 2 additions & 0 deletions lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ hashbrown = "0.9"
regex = "1.1"
cookie-factory = "^0.3"
hpack = "^0.3"
sled = "0.34"
tempfile = "^3"

[dev-dependencies]
tiny_http = "^0.8"
Expand Down

0 comments on commit b7fa649

Please sign in to comment.