Skip to content

add --output-metrics format using prometheus-client#578

Open
clonejo wants to merge 1 commit into
bootandy:masterfrom
clonejo:openmetrics-collector
Open

add --output-metrics format using prometheus-client#578
clonejo wants to merge 1 commit into
bootandy:masterfrom
clonejo:openmetrics-collector

Conversation

@clonejo
Copy link
Copy Markdown

@clonejo clonejo commented May 27, 2026

I wanted to see over time where my disk space was being lost to, so i now run this a loop. Example output:

`--> cargo run -- --output-metrics src target -n 10
   Compiling du-dust v1.2.4 (/var/home/clonejo/code/dust)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.48s
     Running `target/debug/dust --output-metrics src target -n 10`
# HELP dust_file_size_bytes Total size of files in this folder / size of this file.
# TYPE dust_file_size_bytes gauge
# UNIT dust_file_size_bytes bytes
dust_file_size_bytes{paths="src target",path="(total)"} 1004326912
dust_file_size_bytes{paths="src target",path="target"} 1004191744
dust_file_size_bytes{paths="src target",path="target/debug"} 1003950080
dust_file_size_bytes{paths="src target",path="target/debug/deps"} 622583808
dust_file_size_bytes{paths="src target",path="target/debug/deps/dust-f39119bf77cf848e"} 48771072
dust_file_size_bytes{paths="src target",path="target/debug/deps/dust-1ba6c2ffc2c7adf6"} 48517120
dust_file_size_bytes{paths="src target",path="target/debug/deps/dust-513f5be0821b1cdc"} 47734784
dust_file_size_bytes{paths="src target",path="target/debug/incremental"} 277671936
dust_file_size_bytes{paths="src target",path="target/debug/incremental/dust-2ede6adlvlb1p"} 50765824
dust_file_size_bytes{paths="src target",path="target/debug/incremental/dust-117p7tduc8h0u"} 50200576
dust_file_size_bytes{paths="src target",path="target/debug/build"} 99995648
# EOF

This can then be consumed by node-exporter's textfile collector.

I had originally hand-rolled the prometheus text format, but by adding a dependency generating the format correctly is already solved.

What is your opinion on adding such a feature?

Obvs this still needs tests, and the added code in display_node.rs is probably big enough to move into a separate module.

@clonejo clonejo force-pushed the openmetrics-collector branch from 6e9fc6b to 5543033 Compare May 27, 2026 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant