Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to 2021 edition #65

Merged
merged 4 commits into from
Jun 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.17.0] - unreleased

### Changed

- Updates to Rust 2021 Edition. See [PR 65].

[PR 65]: https://github.com/prometheus/client_rust/pull/65

## [0.16.0]

### Changed
Expand Down
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "prometheus-client"
version = "0.16.0"
version = "0.17.0"
authors = ["Max Inden <mail@max-inden.de>"]
edition = "2018"
edition = "2021"
description = "Open Metrics client library allowing users to natively instrument applications."
license = "Apache-2.0 OR MIT"
keywords = ["openmetrics", "prometheus", "metrics", "instrumentation", "monitoring"]
Expand All @@ -17,7 +17,7 @@ members = ["derive-text-encode"]
dtoa = "1.0"
itoa = "1.0"
owning_ref = "0.4"
prometheus-client-derive-text-encode = { version = "0.2.0", path = "derive-text-encode" }
prometheus-client-derive-text-encode = { version = "0.3.0", path = "derive-text-encode" }

[dev-dependencies]
async-std = { version = "1", features = ["attributes"] }
Expand Down
4 changes: 2 additions & 2 deletions derive-text-encode/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "prometheus-client-derive-text-encode"
version = "0.2.0"
version = "0.3.0"
authors = ["Max Inden <mail@max-inden.de>"]
edition = "2018"
edition = "2021"
description = "Auxiliary crate to derive text Encode trait from prometheus-client."
license = "Apache-2.0 OR MIT"
repository = "https://github.com/prometheus/client_rust"
Expand Down
4 changes: 2 additions & 2 deletions src/metrics/family.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ pub trait MetricConstructor<M> {
/// ```
/// # use prometheus_client::metrics::family::{Family};
/// # use prometheus_client::metrics::histogram::Histogram;
/// let custom_buckets = vec![0.0, 10.0, 100.0];
/// let custom_buckets = [0.0, 10.0, 100.0];
/// let metric = Family::<(), Histogram, _>::new_with_constructor(|| {
/// Histogram::new(custom_buckets.clone().into_iter())
/// Histogram::new(custom_buckets.into_iter())
/// });
/// # metric.get_or_create(&());
/// ```
Expand Down
5 changes: 3 additions & 2 deletions src/metrics/histogram.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ use std::sync::{Arc, Mutex, MutexGuard};
/// ```
/// # use prometheus_client::metrics::histogram::Histogram;
/// // Default values from go client(https://github.com/prometheus/client_golang/blob/5d584e2717ef525673736d72cd1d12e304f243d7/prometheus/histogram.go#L68)
/// let histogram = Histogram::new(IntoIterator::into_iter([
/// let custom_buckets = [
/// 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1.0, 2.5, 5.0, 10.0,
/// ]));
/// ];
/// let histogram = Histogram::new(custom_buckets.into_iter());
/// histogram.observe(4.2);
/// ```
// TODO: Consider using atomics. See
Expand Down