#3 Update to 0.7.0 (RHBZ#1722428)
Merged 2 months ago by ignatenkobrain. Opened 2 months ago by rfairley.
rpms/ rfairley/rust-prometheus rfairley-update-0.7.0  into  master

file modified
+1

@@ -1,1 +1,2 @@ 

  /prometheus-0.6.1.crate

+ /prometheus-0.7.0.crate

@@ -1,50 +0,0 @@ 

- From 356220985d3c0f87b545b3f9f8997833e1e9ada1 Mon Sep 17 00:00:00 2001

- From: Luca Bruno <luca.bruno@coreos.com>

- 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

- 

@@ -1,75 +0,0 @@ 

- From 05e15b526f730b7ee650b9b6e846cadc0ad99ed6 Mon Sep 17 00:00:00 2001

- From: crash-g <crash@inventati.org>

- 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::<Mime>().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

- 

@@ -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

file modified
+5 -9

@@ -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 @@ 

  %endif

  

  %changelog

+ * Thu Jun 20 11:09:00 UTC 2019 Robert Fairley <rfairley@redhat.com> - 0.7.0-1

+ - Update to 0.7.0 (RHBZ#1722428)

+ 

  * Tue Jun 18 03:41:45 CEST 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.6.1-3

  - Regenerate

  

file modified
+1 -1

@@ -1,1 +1,1 @@ 

- SHA512 (prometheus-0.6.1.crate) = e3b25224b973f08e6399bc41dcc467255b7a9f044364b1e86bd63df274d232ff651595a353a3d61b0e4b569a3f278c31954bf200a1987a96ec8161a930c96f99

+ SHA512 (prometheus-0.7.0.crate) = ba5e5421753a8b3542fe53ebf2f54e0801db727d6220c549ae9b5398369b20ff20660072d9749b1320cd14141cff4b088618be0b0709b1651a93a806ebafc067

Signed-off-by: Robert Fairley rfairley@redhat.com


Currently still getting this to build on Rawhide locally: https://gist.github.com/rfairley/f4972f450748eb6330ef3e6c103d903b

@rfairley you need to install those dependencies :)

Since simple-koji-ci doesn't work at all, let's just merge and assume it will build.

Pull-Request has been merged by ignatenkobrain

2 months ago

Build worked locally - I needed to run dnf builddep on the generated rust-prometheus-0.7.0-1.fc31.buildreqs.nosrc.rpm to install the needed crates. Thanks @ignatenkobrain for the help in IRC! Also just realized now this was noted here too https://fedoraproject.org/wiki/Changes/DynamicBuildRequires#User_Experience.

error: /workDir/workspace/fedora-rawhide-pr-pipeline/rust-prometheus/rust-prometheus.spec:18: bad %if condition

I have seen this error before - updating rust-srpm-macros to the latest in Rawhide should solve this.

Koji scratch build: https://koji.fedoraproject.org/koji/taskinfo?taskID=35659928

If the scratch build passes, then this update is OK to merge.

Since simple-koji-ci doesn't work at all, let's just merge and assume it will build.

Sorry just saw this - +1 from me on merging, thanks.