Skip to content

Commit

Permalink
[Faucet] Add faucet version metrics for Grafana (#19938)
Browse files Browse the repository at this point in the history
## Description 

This PR adds the faucet version metrics so that it can be displayed in
Grafana.

## Test plan 

How did you test the new or updated feature?

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
- [ ] REST API:
  • Loading branch information
stefan-mysten authored Oct 21, 2024
1 parent b7bc219 commit 84bd893
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions crates/sui-faucet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ publish = false
anyhow.workspace = true
async-trait.workspace = true
axum.workspace = true
bin-version.workspace = true
clap.workspace = true
thiserror.workspace = true
tokio = { workspace = true, features = ["full"] }
Expand Down
7 changes: 7 additions & 0 deletions crates/sui-faucet/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ use tracing::info;
const CONCURRENCY_LIMIT: usize = 30;
const PROM_PORT_ADDR: &str = "0.0.0.0:9184";

// Define the `GIT_REVISION` and `VERSION` consts
bin_version::bin_version!();

#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {
// initialize tracing
Expand All @@ -38,6 +41,10 @@ async fn main() -> Result<(), anyhow::Error> {
info!("Starting Prometheus HTTP endpoint at {}", prom_binding);
let registry_service = mysten_metrics::start_prometheus_server(prom_binding);
let prometheus_registry = registry_service.default_registry();
prometheus_registry
.register(mysten_metrics::uptime_metric("faucet", VERSION, "unknown"))
.unwrap();

let app_state = Arc::new(AppState {
faucet: SimpleFaucet::new(
context,
Expand Down

0 comments on commit 84bd893

Please sign in to comment.