From 331934cfb2311f082e1c3fd2ea6dc058f5732804 Mon Sep 17 00:00:00 2001 From: Robert Fairley Date: Jun 20 2019 16:08:44 +0000 Subject: Update to 0.7.0 (RHBZ#1722428) Signed-off-by: Robert Fairley --- diff --git a/.gitignore b/.gitignore index 2a97575..278349b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /prometheus-0.6.1.crate +/prometheus-0.7.0.crate diff --git a/0001-counter-fix-tests-in-release-mode-246.patch b/0001-counter-fix-tests-in-release-mode-246.patch deleted file mode 100644 index a046021..0000000 --- a/0001-counter-fix-tests-in-release-mode-246.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 356220985d3c0f87b545b3f9f8997833e1e9ada1 Mon Sep 17 00:00:00 2001 -From: Luca Bruno -Date: Thu, 6 Jun 2019 08:11:45 +0000 -Subject: [PATCH 1/2] counter: fix tests in release mode (#246) - -This fixes `should_panic` tests in release mode, as they rely on -debug assertions. ---- - src/counter.rs | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/src/counter.rs b/src/counter.rs -index 2099933..a2b9bdb 100644 ---- a/src/counter.rs -+++ b/src/counter.rs -@@ -511,6 +511,7 @@ mod tests { - assert_eq!(vec.with_label_values(&["v1", "v2"]).get(), 34); - } - -+ #[cfg(debug_assertions)] - #[test] - #[should_panic(expected = "assertion failed")] - fn test_counter_negative_inc() { -@@ -518,6 +519,7 @@ mod tests { - counter.inc_by(-42.0); - } - -+ #[cfg(debug_assertions)] - #[test] - #[should_panic(expected = "assertion failed")] - fn test_local_counter_negative_inc() { -@@ -526,6 +528,7 @@ mod tests { - local.inc_by(-42.0); - } - -+ #[cfg(debug_assertions)] - #[test] - #[should_panic(expected = "assertion failed")] - fn test_int_counter_negative_inc() { -@@ -533,6 +536,7 @@ mod tests { - counter.inc_by(-42); - } - -+ #[cfg(debug_assertions)] - #[test] - #[should_panic(expected = "assertion failed")] - fn test_int_local_counter_negative_inc() { --- -2.22.0 - diff --git a/0002-Update-hyper-example-to-work-with-hyper-0.12-249.patch b/0002-Update-hyper-example-to-work-with-hyper-0.12-249.patch deleted file mode 100644 index 164cc04..0000000 --- a/0002-Update-hyper-example-to-work-with-hyper-0.12-249.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 05e15b526f730b7ee650b9b6e846cadc0ad99ed6 Mon Sep 17 00:00:00 2001 -From: crash-g -Date: Mon, 17 Jun 2019 04:17:00 +0200 -Subject: [PATCH 2/2] Update hyper example to work with hyper 0.12 (#249) - -* Update hyper example to work with hyper 0.12 ---- - examples/example_hyper.rs | 37 +++++++++++++++++++++++-------------- - 1 file changed, 23 insertions(+), 14 deletions(-) - -diff --git a/examples/example_hyper.rs b/examples/example_hyper.rs -index c9d02bc..a6eda1b 100644 ---- a/examples/example_hyper.rs -+++ b/examples/example_hyper.rs -@@ -16,9 +16,7 @@ extern crate lazy_static; - #[macro_use] - extern crate prometheus; - --use hyper::header::ContentType; --use hyper::mime::Mime; --use hyper::server::{Request, Response, Server}; -+use hyper::{header::CONTENT_TYPE, rt::Future, service::service_fn_ok, Body, Response, Server}; - - use prometheus::{Counter, Encoder, Gauge, HistogramVec, TextEncoder}; - -@@ -44,24 +42,35 @@ lazy_static! { - } - - fn main() { -- let encoder = TextEncoder::new(); -- let addr = "127.0.0.1:9898"; -- println!("listening addr {:?}", addr); -- Server::http(addr) -- .unwrap() -- .handle(move |_: Request<'_, '_>, mut res: Response<'_>| { -+ let addr = ([127, 0, 0, 1], 9898).into(); -+ println!("Listening address: {:?}", addr); -+ -+ let new_service = || { -+ let encoder = TextEncoder::new(); -+ service_fn_ok(move |_request| { - HTTP_COUNTER.inc(); - let timer = HTTP_REQ_HISTOGRAM.with_label_values(&["all"]).start_timer(); - - let metric_families = prometheus::gather(); - let mut buffer = vec![]; - encoder.encode(&metric_families, &mut buffer).unwrap(); -- res.headers_mut() -- .set(ContentType(encoder.format_type().parse::().unwrap())); -- res.send(&buffer).unwrap(); -+ HTTP_BODY_GAUGE.set(buffer.len() as f64); -+ -+ let response = Response::builder() -+ .status(200) -+ .header(CONTENT_TYPE, encoder.format_type()) -+ .body(Body::from(buffer)) -+ .unwrap(); - - timer.observe_duration(); -- HTTP_BODY_GAUGE.set(buffer.len() as f64); -+ -+ response - }) -- .unwrap(); -+ }; -+ -+ let server = Server::bind(&addr) -+ .serve(new_service) -+ .map_err(|e| eprintln!("Server error: {}", e)); -+ -+ hyper::rt::run(server); - } --- -2.22.0 - diff --git a/prometheus-fix-metadata.diff b/prometheus-fix-metadata.diff deleted file mode 100644 index f451d0d..0000000 --- a/prometheus-fix-metadata.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- prometheus-0.6.1/Cargo.toml 1970-01-01T00:00:00+00:00 -+++ prometheus-0.6.1/Cargo.toml 2019-06-18T01:41:45.385772+00:00 -@@ -54,8 +54,7 @@ - version = "0.2" - - [dev-dependencies.hyper] --version = "0.9" --default-features = false -+version = "0.12" - [build-dependencies.protobuf-codegen-pure] - version = "2.0" - optional = true diff --git a/rust-prometheus.spec b/rust-prometheus.spec index 1a139d2..3d3b5a3 100644 --- a/rust-prometheus.spec +++ b/rust-prometheus.spec @@ -5,21 +5,14 @@ %global crate prometheus Name: rust-%{crate} -Version: 0.6.1 -Release: 3%{?dist} +Version: 0.7.0 +Release: 1%{?dist} Summary: Prometheus instrumentation library for Rust applications # Upstream license specification: Apache-2.0 License: ASL 2.0 URL: https://crates.io/crates/prometheus Source: %{crates_source} -# Initial patched metadata -# * Update hyper to 0.12, https://github.com/pingcap/rust-prometheus/commit/05e15b526f730b7ee650b9b6e846cadc0ad99ed6 -Patch0: prometheus-fix-metadata.diff -# Fix tests in release mode, https://github.com/pingcap/rust-prometheus/commit/356220985d3c0f87b545b3f9f8997833e1e9ada1 -Patch0001: 0001-counter-fix-tests-in-release-mode-246.patch -# Finish migration to new hyper -Patch0002: 0002-Update-hyper-example-to-work-with-hyper-0.12-249.patch ExclusiveArch: %{rust_arches} %if %{__cargo_skip_build} @@ -186,6 +179,9 @@ which use "reqwest" feature of "%{crate}" crate. %endif %changelog +* Thu Jun 20 11:09:00 UTC 2019 Robert Fairley - 0.7.0-1 +- Update to 0.7.0 (RHBZ#1722428) + * Tue Jun 18 03:41:45 CEST 2019 Igor Gnatenko - 0.6.1-3 - Regenerate diff --git a/sources b/sources index 700432a..8f85656 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (prometheus-0.6.1.crate) = e3b25224b973f08e6399bc41dcc467255b7a9f044364b1e86bd63df274d232ff651595a353a3d61b0e4b569a3f278c31954bf200a1987a96ec8161a930c96f99 +SHA512 (prometheus-0.7.0.crate) = ba5e5421753a8b3542fe53ebf2f54e0801db727d6220c549ae9b5398369b20ff20660072d9749b1320cd14141cff4b088618be0b0709b1651a93a806ebafc067