Skip to content

Commit

Permalink
Update zdbfs stats to latest version of stat struct
Browse files Browse the repository at this point in the history
Signed-off-by: Lee Smet <[email protected]>
  • Loading branch information
LeeSmet committed Sep 10, 2021
1 parent 0eb89bc commit 11bfaf3
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
7 changes: 7 additions & 0 deletions zstor/include/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@
#include <stdio.h>

typedef struct stats_t {
size_t version;

size_t fuse_reqs;

size_t cache_hit;
size_t cache_miss;
size_t cache_full;
size_t cache_linear_flush;
size_t cache_random_flush;
size_t cache_branches;
size_t cache_branches_allocated;
size_t cache_entries;
size_t cache_blocks;
size_t cache_blocksize;

size_t syscall_getattr;
size_t syscall_setattr;
Expand Down
45 changes: 45 additions & 0 deletions zstor/src/actors/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ struct PromMetrics {
fs_cache_full: IntGauge,
fs_cache_linear_flush: IntGauge,
fs_cache_random_flush: IntGauge,
fs_cache_branches: IntGauge,
fs_cache_branches_allocated: IntGauge,
fs_cache_entries: IntGauge,
fs_cache_blocks: IntGauge,
fs_cache_blocksize: IntGauge,
fs_syscalls: IntGaugeVec,
fs_bytes_read: IntGauge,
fs_bytes_written: IntGauge,
Expand Down Expand Up @@ -241,6 +246,31 @@ impl MetricsActor {
"Total amount of random flushes"
)
.unwrap(),
fs_cache_branches: register_int_gauge!(
"fs_cache_branches",
"Total amount of cache branches"
)
.unwrap(),
fs_cache_branches_allocated: register_int_gauge!(
"fs_cache_branches_allocated",
"Amount of cache branches allocated"
)
.unwrap(),
fs_cache_entries: register_int_gauge!(
"fs_cache_entries",
"Amount of memory cache entries"
)
.unwrap(),
fs_cache_blocks: register_int_gauge!(
"fs_cache_blocks",
"Amount of blocks in the memory cache"
)
.unwrap(),
fs_cache_blocksize: register_int_gauge!(
"fs_cache_blocksize",
"Amount of bytes used by cache blocks"
)
.unwrap(),
fs_syscalls: register_int_gauge_vec!(
"fs_syscalls",
"Total amount of syscalls done on the filesystem",
Expand Down Expand Up @@ -682,6 +712,21 @@ impl Handler<GetPrometheusMetrics> for MetricsActor {
self.prom_metrics
.fs_fuse_errors
.set(self.zdbfs_stats.errors as i64);
self.prom_metrics
.fs_cache_branches
.set(self.zdbfs_stats.cache_branches as i64);
self.prom_metrics
.fs_cache_branches_allocated
.set(self.zdbfs_stats.cache_branches_allocated as i64);
self.prom_metrics
.fs_cache_entries
.set(self.zdbfs_stats.cache_entries as i64);
self.prom_metrics
.fs_cache_blocks
.set(self.zdbfs_stats.cache_blocks as i64);
self.prom_metrics
.fs_cache_blocksize
.set(self.zdbfs_stats.cache_blocksize as i64);
// set syscall info
let mut labels = HashMap::new();
labels.insert("syscall", "getattr");
Expand Down

0 comments on commit 11bfaf3

Please sign in to comment.