[PR #578] add --output-metrics format using prometheus-client #558

Open
opened 2026-06-08 11:29:23 +03:00 by zhus · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bootandy/dust/pull/578
Author: @clonejo
Created: 5/28/2026
Status: 🔄 Open

Base: masterHead: openmetrics-collector


📝 Commits (1)

  • 5543033 add --output-metrics format using prometheus-client

📊 Changes

12 files changed (+198 additions, -3 deletions)

View changed files

📝 Cargo.lock (+83 -0)
📝 Cargo.toml (+1 -0)
📝 completions/_dust (+1 -0)
📝 completions/_dust.ps1 (+1 -0)
📝 completions/dust.bash (+1 -1)
📝 completions/dust.elv (+1 -0)
📝 completions/dust.fish (+1 -0)
📝 man-page/dust.1 (+4 -1)
📝 src/cli.rs (+4 -0)
📝 src/config.rs (+4 -0)
📝 src/display_node.rs (+88 -1)
📝 src/main.rs (+9 -0)

📄 Description

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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/bootandy/dust/pull/578 **Author:** [@clonejo](https://github.com/clonejo) **Created:** 5/28/2026 **Status:** 🔄 Open **Base:** `master` ← **Head:** `openmetrics-collector` --- ### 📝 Commits (1) - [`5543033`](https://github.com/bootandy/dust/commit/5543033694e90a3c804dff2235e96ba1ef435fa6) add --output-metrics format using prometheus-client ### 📊 Changes **12 files changed** (+198 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+83 -0) 📝 `Cargo.toml` (+1 -0) 📝 `completions/_dust` (+1 -0) 📝 `completions/_dust.ps1` (+1 -0) 📝 `completions/dust.bash` (+1 -1) 📝 `completions/dust.elv` (+1 -0) 📝 `completions/dust.fish` (+1 -0) 📝 `man-page/dust.1` (+4 -1) 📝 `src/cli.rs` (+4 -0) 📝 `src/config.rs` (+4 -0) 📝 `src/display_node.rs` (+88 -1) 📝 `src/main.rs` (+9 -0) </details> ### 📄 Description I wanted to see over time where my disk space was being lost to, so i now run this a loop. Example output: ```console `--> 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](https://github.com/prometheus/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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
zhus added the pull-request label 2026-06-08 11:29:23 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: bootandy/archived-dust#558