From 9d49d917f622c441c8adbf5a53cb172a8504b827 Mon Sep 17 00:00:00 2001 From: Max Inden Date: Thu, 27 Feb 2020 17:48:26 +0100 Subject: [PATCH] =?UTF-8?q?*:=20Rename=20prometheus-exporter=20crate=20to?= =?UTF-8?q?=20substrate-prometheus-end=E2=80=A6=20(#5076)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- substrate/Cargo.lock | 30 ++++++++++++------------- substrate/client/cli/Cargo.toml | 2 +- substrate/client/service/Cargo.toml | 2 +- substrate/client/service/src/builder.rs | 6 ++--- substrate/client/service/src/config.rs | 2 +- substrate/client/service/src/error.rs | 4 ++-- substrate/utils/prometheus/Cargo.toml | 4 ++-- substrate/utils/prometheus/src/lib.rs | 2 +- 8 files changed, 26 insertions(+), 26 deletions(-) diff --git a/substrate/Cargo.lock b/substrate/Cargo.lock index 245493986b..14ef98f1c2 100644 --- a/substrate/Cargo.lock +++ b/substrate/Cargo.lock @@ -4988,19 +4988,6 @@ dependencies = [ "spin", ] -[[package]] -name = "prometheus-exporter" -version = "0.8.0-alpha.2" -dependencies = [ - "async-std", - "derive_more", - "futures-util", - "hyper 0.13.2", - "log 0.4.8", - "prometheus", - "tokio 0.2.11", -] - [[package]] name = "prost" version = "0.6.1" @@ -5685,7 +5672,6 @@ dependencies = [ "log 0.4.8", "names", "parity-util-mem", - "prometheus-exporter", "regex", "rpassword", "sc-client-api", @@ -5702,6 +5688,7 @@ dependencies = [ "sp-runtime", "sp-state-machine", "structopt", + "substrate-prometheus-endpoint", "tempfile", "time", "tokio 0.2.11", @@ -6413,7 +6400,6 @@ dependencies = [ "parity-scale-codec", "parity-util-mem", "parking_lot 0.10.0", - "prometheus-exporter", "sc-chain-spec", "sc-client", "sc-client-api", @@ -6442,6 +6428,7 @@ dependencies = [ "sp-runtime", "sp-session", "sp-transaction-pool", + "substrate-prometheus-endpoint", "substrate-test-runtime-client", "sysinfo", "target_info", @@ -7662,6 +7649,19 @@ dependencies = [ "substrate-test-runtime-client", ] +[[package]] +name = "substrate-prometheus-endpoint" +version = "0.8.0-alpha.2" +dependencies = [ + "async-std", + "derive_more", + "futures-util", + "hyper 0.13.2", + "log 0.4.8", + "prometheus", + "tokio 0.2.11", +] + [[package]] name = "substrate-test-client" version = "2.0.0-dev" diff --git a/substrate/client/cli/Cargo.toml b/substrate/client/cli/Cargo.toml index 4066e1136b..e8525644d7 100644 --- a/substrate/client/cli/Cargo.toml +++ b/substrate/client/cli/Cargo.toml @@ -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" diff --git a/substrate/client/service/Cargo.toml b/substrate/client/service/Cargo.toml index 462b77bcb0..d504ab2052 100644 --- a/substrate/client/service/Cargo.toml +++ b/substrate/client/service/Cargo.toml @@ -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"] } diff --git a/substrate/client/service/src/builder.rs b/substrate/client/service/src/builder.rs index 7159e532c4..8c85c38b18 100644 --- a/substrate/client/service/src/builder.rs +++ b/substrate/client/service/src/builder.rs @@ -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, @@ -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, @@ -1030,7 +1030,7 @@ ServiceBuilder< let metrics = ServiceMetrics::register(®istry)?; let future = select( - prometheus_exporter::init_prometheus(port, registry).boxed(), + substrate_prometheus_endpoint::init_prometheus(port, registry).boxed(), exit.clone() ).map(drop); diff --git a/substrate/client/service/src/config.rs b/substrate/client/service/src/config.rs index 002754f11c..974dac588d 100644 --- a/substrate/client/service/src/config.rs +++ b/substrate/client/service/src/config.rs @@ -93,7 +93,7 @@ pub struct Configuration { pub rpc_ws_max_connections: Option, /// CORS settings for HTTP & WS servers. `None` if all origins are allowed. pub rpc_cors: Option>, - /// Prometheus exporter Port. `None` if disabled. + /// Prometheus endpoint Port. `None` if disabled. pub prometheus_port: Option, /// Telemetry service URL. `None` if disabled. pub telemetry_endpoints: Option, diff --git a/substrate/client/service/src/error.rs b/substrate/client/service/src/error.rs index 4d0a2cef94..adf630e44c 100644 --- a/substrate/client/service/src/error.rs +++ b/substrate/client/service/src/error.rs @@ -53,8 +53,8 @@ impl<'a> From<&'a str> for Error { } } -impl From for Error { - fn from(e: prometheus_exporter::PrometheusError) -> Self { +impl From for Error { + fn from(e: substrate_prometheus_endpoint::PrometheusError) -> Self { Error::Other(format!("Prometheus error: {}", e)) } } diff --git a/substrate/utils/prometheus/Cargo.toml b/substrate/utils/prometheus/Cargo.toml index ccbb9bd07f..3944b35368 100644 --- a/substrate/utils/prometheus/Cargo.toml +++ b/substrate/utils/prometheus/Cargo.toml @@ -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 "] diff --git a/substrate/utils/prometheus/src/lib.rs b/substrate/utils/prometheus/src/lib.rs index 1aaeff2a57..54b9183bc6 100644 --- a/substrate/utils/prometheus/src/lib.rs +++ b/substrate/utils/prometheus/src/lib.rs @@ -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) }