Skip to content

Commit

Permalink
*: Rename prometheus-exporter crate to substrate-prometheus-end… (par…
Browse files Browse the repository at this point in the history
…itytech#5076)

This patch renames the crate for the following two reasons:

1. The prometheus-exporter crate introduces native in-process Prometheus
style instrumentation to the Substrate project. Within the Prometheus
ecosystem the term "exporter" is used for external processes exposing
metrics for e.g. the Linux Kernel. In-process exposition would be
described via the term "endpoint".

2. "prometheus-exporter" is generic and ignores the fact that it is only
usable within the context of Substrate. In addition the name
"prometheus-exporter" is already taken on crates.io.
  • Loading branch information
mxinden authored and General-Beck committed Mar 4, 2020
1 parent 393334e commit 2769a9d
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 26 deletions.
30 changes: 15 additions & 15 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion client/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ sp-core = { version = "2.0.0-alpha.2", path = "../../primitives/core" }
sc-service = { version = "0.8.0-alpha.2", default-features = false, path = "../service" }
sp-state-machine = { version = "0.8.0-alpha.2", path = "../../primitives/state-machine" }
sc-telemetry = { version = "2.0.0-alpha.2", path = "../telemetry" }
prometheus-exporter = { path = "../../utils/prometheus" , version = "0.8.0-alpha.2"}
substrate-prometheus-endpoint = { path = "../../utils/prometheus" , version = "0.8.0-alpha.2"}
sp-keyring = { version = "2.0.0-alpha.2", path = "../../primitives/keyring" }
names = "0.11.0"
structopt = "0.3.8"
Expand Down
2 changes: 1 addition & 1 deletion client/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ sc-rpc = { version = "2.0.0-alpha.2", path = "../rpc" }
sc-telemetry = { version = "2.0.0-alpha.2", path = "../telemetry" }
sc-offchain = { version = "2.0.0-alpha.2", path = "../offchain" }
parity-multiaddr = { package = "parity-multiaddr", version = "0.5.0" }
prometheus-exporter = { path = "../../utils/prometheus" , version = "0.8.0-alpha.2"}
substrate-prometheus-endpoint = { path = "../../utils/prometheus" , version = "0.8.0-alpha.2"}
sc-tracing = { version = "2.0.0-alpha.2", path = "../tracing" }
tracing = "0.1.10"
parity-util-mem = { version = "0.5.1", default-features = false, features = ["primitive-types"] }
Expand Down
6 changes: 3 additions & 3 deletions client/service/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ use sysinfo::{get_current_pid, ProcessExt, System, SystemExt};
use sc_telemetry::{telemetry, SUBSTRATE_INFO};
use sp_transaction_pool::{MaintainedTransactionPool, ChainEvent};
use sp_blockchain;
use prometheus_exporter::{register, Gauge, U64, F64, Registry, PrometheusError, Opts, GaugeVec};
use substrate_prometheus_endpoint::{register, Gauge, U64, F64, Registry, PrometheusError, Opts, GaugeVec};

struct ServiceMetrics {
block_height_number: GaugeVec<U64>,
Expand Down Expand Up @@ -1020,7 +1020,7 @@ ServiceBuilder<
));
}

// Prometheus exporter and metrics
// Prometheus endpoint and metrics
let metrics = if let Some(port) = config.prometheus_port {
let registry = match prometheus_registry {
Some(registry) => registry,
Expand All @@ -1030,7 +1030,7 @@ ServiceBuilder<
let metrics = ServiceMetrics::register(&registry)?;

let future = select(
prometheus_exporter::init_prometheus(port, registry).boxed(),
substrate_prometheus_endpoint::init_prometheus(port, registry).boxed(),
exit.clone()
).map(drop);

Expand Down
2 changes: 1 addition & 1 deletion client/service/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pub struct Configuration<G, E = NoExtension> {
pub rpc_ws_max_connections: Option<usize>,
/// CORS settings for HTTP & WS servers. `None` if all origins are allowed.
pub rpc_cors: Option<Vec<String>>,
/// Prometheus exporter Port. `None` if disabled.
/// Prometheus endpoint Port. `None` if disabled.
pub prometheus_port: Option<SocketAddr>,
/// Telemetry service URL. `None` if disabled.
pub telemetry_endpoints: Option<TelemetryEndpoints>,
Expand Down
4 changes: 2 additions & 2 deletions client/service/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ impl<'a> From<&'a str> for Error {
}
}

impl From<prometheus_exporter::PrometheusError> for Error {
fn from(e: prometheus_exporter::PrometheusError) -> Self {
impl From<substrate_prometheus_endpoint::PrometheusError> for Error {
fn from(e: substrate_prometheus_endpoint::PrometheusError) -> Self {
Error::Other(format!("Prometheus error: {}", e))
}
}
Expand Down
4 changes: 2 additions & 2 deletions utils/prometheus/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
description = "Prometheus exporter server"
name = "prometheus-exporter"
description = "Endpoint to expose Prometheus metrics"
name = "substrate-prometheus-endpoint"
version = "0.8.0-alpha.2"
license = "GPL-3.0"
authors = ["Parity Technologies <admin@parity.io>"]
Expand Down
2 changes: 1 addition & 1 deletion utils/prometheus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ mod known_os {
Http(hyper::http::Error),
/// i/o error.
Io(std::io::Error),
#[display(fmt = "Prometheus exporter port {} already in use.", _0)]
#[display(fmt = "Prometheus port {} already in use.", _0)]
PortInUse(SocketAddr)
}

Expand Down

0 comments on commit 2769a9d

Please sign in to comment.