Skip to content

Commit

Permalink
Prometheus: Use correct chain id (paritytech#10457)
Browse files Browse the repository at this point in the history
* Prometheus: Use correct chain id

* FMT
  • Loading branch information
bkchr authored and ark0f committed Feb 27, 2023
1 parent 005b242 commit 31fc3fa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 6 additions & 2 deletions client/cli/src/commands/run_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,11 @@ impl CliConfiguration for RunCmd {
Ok(self.shared_params.dev || self.force_authoring)
}

fn prometheus_config(&self, default_listen_port: u16) -> Result<Option<PrometheusConfig>> {
fn prometheus_config(
&self,
default_listen_port: u16,
chain_spec: &Box<dyn ChainSpec>,
) -> Result<Option<PrometheusConfig>> {
Ok(if self.no_prometheus {
None
} else {
Expand All @@ -377,7 +381,7 @@ impl CliConfiguration for RunCmd {
interface.into(),
self.prometheus_port.unwrap_or(default_listen_port),
),
self.shared_params.chain_id(self.shared_params.dev),
chain_spec.id().into(),
))
})
}
Expand Down
9 changes: 7 additions & 2 deletions client/cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,11 @@ pub trait CliConfiguration<DCV: DefaultConfigurationValues = ()>: Sized {
/// Get the prometheus configuration (`None` if disabled)
///
/// By default this is `None`.
fn prometheus_config(&self, _default_listen_port: u16) -> Result<Option<PrometheusConfig>> {
fn prometheus_config(
&self,
_default_listen_port: u16,
_chain_spec: &Box<dyn ChainSpec>,
) -> Result<Option<PrometheusConfig>> {
Ok(None)
}

Expand Down Expand Up @@ -527,7 +531,8 @@ pub trait CliConfiguration<DCV: DefaultConfigurationValues = ()>: Sized {
rpc_cors: self.rpc_cors(is_dev)?,
rpc_max_payload: self.rpc_max_payload()?,
ws_max_out_buffer_capacity: self.ws_max_out_buffer_capacity()?,
prometheus_config: self.prometheus_config(DCV::prometheus_listen_port())?,
prometheus_config: self
.prometheus_config(DCV::prometheus_listen_port(), &chain_spec)?,
telemetry_endpoints,
default_heap_pages: self.default_heap_pages()?,
offchain_worker: self.offchain_worker(&role)?,
Expand Down

0 comments on commit 31fc3fa

Please sign in to comment.