Skip to content

Commit

Permalink
{misc,protocols/gossipsub}: Move to prometheus-client (#2442)
Browse files Browse the repository at this point in the history
`open-metrics-client` has been accepted as the official Prometheus Rust
client and thus renamed to `prometheus-client`.

See https://groups.google.com/g/prometheus-developers/c/E67ByGmVQKM
  • Loading branch information
mxinden authored Feb 3, 2022
1 parent fbdd208 commit 3f4dbb1
Show file tree
Hide file tree
Showing 18 changed files with 62 additions and 44 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@

# `libp2p` facade crate

## Version 0.43.0 [unreleased]

- Update individual crates.
- `libp2p-gossipsub`
- `libp2p-metrics`

## Version 0.42.1 [2022-02-02]

- Update individual crates.
Expand Down
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "libp2p"
edition = "2021"
rust-version = "1.56.1"
description = "Peer-to-peer networking library"
version = "0.42.1"
version = "0.43.0"
authors = ["Parity Technologies <admin@parity.io>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
Expand Down Expand Up @@ -79,10 +79,10 @@ lazy_static = "1.2"
libp2p-autonat = { version = "0.1.0", path = "protocols/autonat", optional = true }
libp2p-core = { version = "0.31.0", path = "core", default-features = false }
libp2p-floodsub = { version = "0.33.0", path = "protocols/floodsub", optional = true }
libp2p-gossipsub = { version = "0.35.0", path = "./protocols/gossipsub", optional = true }
libp2p-gossipsub = { version = "0.36.0", path = "./protocols/gossipsub", optional = true }
libp2p-identify = { version = "0.33.0", path = "protocols/identify", optional = true }
libp2p-kad = { version = "0.34.0", path = "protocols/kad", optional = true }
libp2p-metrics = { version = "0.3.0", path = "misc/metrics", optional = true }
libp2p-metrics = { version = "0.4.0", path = "misc/metrics", optional = true }
libp2p-mplex = { version = "0.31.0", path = "muxers/mplex", optional = true }
libp2p-noise = { version = "0.34.0", path = "transports/noise", optional = true }
libp2p-ping = { version = "0.33.0", path = "protocols/ping", optional = true }
Expand Down
6 changes: 6 additions & 0 deletions misc/metrics/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 0.4.0 [unreleased]

- Move from `open-metrics-client` to `prometheus-client` (see [PR 2442]).

[PR 2442]: https://github.com/libp2p/rust-libp2p/pull/2442

# 0.3.0 [2022-01-27]

- Update dependencies.
Expand Down
6 changes: 3 additions & 3 deletions misc/metrics/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "libp2p-metrics"
edition = "2021"
rust-version = "1.56.1"
description = "Metrics for libp2p"
version = "0.3.0"
version = "0.4.0"
authors = ["Max Inden <mail@max-inden.de>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
Expand All @@ -19,13 +19,13 @@ relay = ["libp2p-relay"]

[dependencies]
libp2p-core = { version = "0.31.0", path = "../../core", default-features = false }
libp2p-gossipsub = { version = "0.35.0", path = "../../protocols/gossipsub", optional = true }
libp2p-gossipsub = { version = "0.36.0", path = "../../protocols/gossipsub", optional = true }
libp2p-identify = { version = "0.33.0", path = "../../protocols/identify", optional = true }
libp2p-kad = { version = "0.34.0", path = "../../protocols/kad", optional = true }
libp2p-ping = { version = "0.33.0", path = "../../protocols/ping", optional = true }
libp2p-relay = { version = "0.6.0", path = "../../protocols/relay", optional = true }
libp2p-swarm = { version = "0.33.0", path = "../../swarm" }
open-metrics-client = "0.14.0"
prometheus-client = "0.15.0"

[dev-dependencies]
env_logger = "0.8.1"
Expand Down
4 changes: 2 additions & 2 deletions misc/metrics/examples/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ use libp2p::metrics::{Metrics, Recorder};
use libp2p::ping::{Ping, PingConfig};
use libp2p::swarm::SwarmEvent;
use libp2p::{identity, PeerId, Swarm};
use open_metrics_client::encoding::text::encode;
use open_metrics_client::registry::Registry;
use prometheus_client::encoding::text::encode;
use prometheus_client::registry::Registry;
use std::error::Error;
use std::sync::{Arc, Mutex};
use std::thread;
Expand Down
4 changes: 2 additions & 2 deletions misc/metrics/src/gossipsub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.

use open_metrics_client::metrics::counter::Counter;
use open_metrics_client::registry::Registry;
use prometheus_client::metrics::counter::Counter;
use prometheus_client::registry::Registry;

pub struct Metrics {
messages: Counter,
Expand Down
6 changes: 3 additions & 3 deletions misc/metrics/src/identify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.

use open_metrics_client::metrics::counter::Counter;
use open_metrics_client::metrics::histogram::{exponential_buckets, Histogram};
use open_metrics_client::registry::Registry;
use prometheus_client::metrics::counter::Counter;
use prometheus_client::metrics::histogram::{exponential_buckets, Histogram};
use prometheus_client::registry::Registry;
use std::iter;

pub struct Metrics {
Expand Down
10 changes: 5 additions & 5 deletions misc/metrics/src/kad.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.

use open_metrics_client::encoding::text::Encode;
use open_metrics_client::metrics::counter::Counter;
use open_metrics_client::metrics::family::Family;
use open_metrics_client::metrics::histogram::{exponential_buckets, Histogram};
use open_metrics_client::registry::{Registry, Unit};
use prometheus_client::encoding::text::Encode;
use prometheus_client::metrics::counter::Counter;
use prometheus_client::metrics::family::Family;
use prometheus_client::metrics::histogram::{exponential_buckets, Histogram};
use prometheus_client::registry::{Registry, Unit};

pub struct Metrics {
query_result_get_record_ok: Histogram,
Expand Down
4 changes: 2 additions & 2 deletions misc/metrics/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ mod ping;
mod relay;
mod swarm;

use open_metrics_client::registry::Registry;
use prometheus_client::registry::Registry;

/// Set of Swarm and protocol metrics derived from emitted events.
pub struct Metrics {
Expand All @@ -58,7 +58,7 @@ impl Metrics {
/// Create a new set of Swarm and protocol [`Metrics`].
///
/// ```
/// use open_metrics_client::registry::Registry;
/// use prometheus_client::registry::Registry;
/// use libp2p_metrics::Metrics;
/// let mut registry = Registry::default();
/// let metrics = Metrics::new(&mut registry);
Expand Down
10 changes: 5 additions & 5 deletions misc/metrics/src/ping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.

use open_metrics_client::encoding::text::Encode;
use open_metrics_client::metrics::counter::Counter;
use open_metrics_client::metrics::family::Family;
use open_metrics_client::metrics::histogram::{exponential_buckets, Histogram};
use open_metrics_client::registry::{Registry, Unit};
use prometheus_client::encoding::text::Encode;
use prometheus_client::metrics::counter::Counter;
use prometheus_client::metrics::family::Family;
use prometheus_client::metrics::histogram::{exponential_buckets, Histogram};
use prometheus_client::registry::{Registry, Unit};

#[derive(Clone, Hash, PartialEq, Eq, Encode)]
struct FailureLabels {
Expand Down
8 changes: 4 additions & 4 deletions misc/metrics/src/relay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.

use open_metrics_client::encoding::text::Encode;
use open_metrics_client::metrics::counter::Counter;
use open_metrics_client::metrics::family::Family;
use open_metrics_client::registry::Registry;
use prometheus_client::encoding::text::Encode;
use prometheus_client::metrics::counter::Counter;
use prometheus_client::metrics::family::Family;
use prometheus_client::registry::Registry;

pub struct Metrics {
events: Family<EventLabels, Counter>,
Expand Down
8 changes: 4 additions & 4 deletions misc/metrics/src/swarm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.

use open_metrics_client::encoding::text::Encode;
use open_metrics_client::metrics::counter::Counter;
use open_metrics_client::metrics::family::Family;
use open_metrics_client::registry::Registry;
use prometheus_client::encoding::text::Encode;
use prometheus_client::metrics::counter::Counter;
use prometheus_client::metrics::family::Family;
use prometheus_client::registry::Registry;

pub struct Metrics {
connections_incoming: Counter,
Expand Down
6 changes: 6 additions & 0 deletions protocols/gossipsub/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 0.36.0 [unreleased]

- Move from `open-metrics-client` to `prometheus-client` (see [PR 2442]).

[PR 2442]: https://github.com/libp2p/rust-libp2p/pull/2442

# 0.35.0 [2022-01-27]

- Update dependencies.
Expand Down
4 changes: 2 additions & 2 deletions protocols/gossipsub/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "libp2p-gossipsub"
edition = "2021"
rust-version = "1.56.1"
description = "Gossipsub protocol for libp2p"
version = "0.35.0"
version = "0.36.0"
authors = ["Age Manning <Age@AgeManning.com>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
Expand Down Expand Up @@ -32,7 +32,7 @@ pin-project = "1.0.8"
instant = "0.1.11"
serde = { version = "1", optional = true, features = ["derive"] }
# Metrics dependencies
open-metrics-client = "0.14.0"
prometheus-client = "0.15.0"

[dev-dependencies]
async-std = "1.6.3"
Expand Down
2 changes: 1 addition & 1 deletion protocols/gossipsub/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use std::{

use futures::StreamExt;
use log::{debug, error, trace, warn};
use open_metrics_client::registry::Registry;
use prometheus_client::registry::Registry;
use prost::Message;
use rand::{seq::SliceRandom, thread_rng};

Expand Down
12 changes: 6 additions & 6 deletions protocols/gossipsub/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@

use std::collections::HashMap;

use open_metrics_client::encoding::text::Encode;
use open_metrics_client::metrics::counter::Counter;
use open_metrics_client::metrics::family::{Family, MetricConstructor};
use open_metrics_client::metrics::gauge::Gauge;
use open_metrics_client::metrics::histogram::{linear_buckets, Histogram};
use open_metrics_client::registry::Registry;
use prometheus_client::encoding::text::Encode;
use prometheus_client::metrics::counter::Counter;
use prometheus_client::metrics::family::{Family, MetricConstructor};
use prometheus_client::metrics::gauge::Gauge;
use prometheus_client::metrics::histogram::{linear_buckets, Histogram};
use prometheus_client::registry::Registry;

use crate::topic::TopicHash;
use crate::types::{MessageAcceptance, PeerKind};
Expand Down
2 changes: 1 addition & 1 deletion protocols/gossipsub/src/topic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

use crate::rpc_proto;
use base64::encode;
use open_metrics_client::encoding::text::Encode;
use prometheus_client::encoding::text::Encode;
use prost::Message;
use sha2::{Digest, Sha256};
use std::fmt;
Expand Down
2 changes: 1 addition & 1 deletion protocols/gossipsub/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
use crate::rpc_proto;
use crate::TopicHash;
use libp2p_core::{connection::ConnectionId, PeerId};
use open_metrics_client::encoding::text::Encode;
use prometheus_client::encoding::text::Encode;
use prost::Message;
use std::fmt;
use std::fmt::Debug;
Expand Down

0 comments on commit 3f4dbb1

Please sign in to comment.