Skip to content

Commit

Permalink
Working metrics server
Browse files Browse the repository at this point in the history
  • Loading branch information
AgeManning committed Oct 31, 2024
1 parent 350a4e1 commit da7cba7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion anchor/client/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ pub struct Anchor {
default_value_if("metrics", ArgPredicate::IsPresent, "5164"),
requires = "metrics"
)]
pub metrics_port: u16,
pub metrics_port: Option<u16>,
// TODO: Metrics CORS Origin
#[clap(
long,
Expand Down
4 changes: 3 additions & 1 deletion anchor/client/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ pub fn from_cli(cli_args: &Anchor) -> Result<Config, String> {
config.http_metrics.listen_addr = address;
}

config.http_metrics.listen_port = cli_args.metrics_port;
if let Some(port) = cli_args.metrics_port {
config.http_metrics.listen_port = port;
}

Ok(config)
}
Expand Down
2 changes: 1 addition & 1 deletion anchor/http_metrics/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fn create_router(shared_state: Arc<RwLock<Shared>>) -> Router {
.allow_origin(Any);

Router::new()
.route("metrics", get(metrics_handler))
.route("/metrics", get(metrics_handler))
.with_state(shared_state)
.layer(cors)
}
Expand Down

0 comments on commit da7cba7

Please sign in to comment.