#1 bump to commit 180b8fd and update to spec 3.0
Merged 5 years ago by jchaloup. Opened 5 years ago by decathorpe.
Unknown source master  into  master

file modified
+1
@@ -1,1 +1,2 @@

  /client_golang-c5b7fcc.tar.gz

+ /client_golang-180b8fdc22b4ea7750bcb43c925277654a1ea2f3.tar.gz

@@ -0,0 +1,201 @@

+ diff --git a/prometheus/promhttp/instrument_client_1_8_test.go b/prometheus/promhttp/instrument_client_1_8_test.go

+ deleted file mode 100644

+ index 7e3f522..0000000

+ --- a/prometheus/promhttp/instrument_client_1_8_test.go

+ +++ /dev/null

+ @@ -1,195 +0,0 @@

+ -// Copyright 2017 The Prometheus Authors

+ -// Licensed under the Apache License, Version 2.0 (the "License");

+ -// you may not use this file except in compliance with the License.

+ -// You may obtain a copy of the License at

+ -//

+ -// http://www.apache.org/licenses/LICENSE-2.0

+ -//

+ -// Unless required by applicable law or agreed to in writing, software

+ -// distributed under the License is distributed on an "AS IS" BASIS,

+ -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+ -// See the License for the specific language governing permissions and

+ -// limitations under the License.

+ -

+ -// +build go1.8

+ -

+ -package promhttp

+ -

+ -import (

+ -	"log"

+ -	"net/http"

+ -	"testing"

+ -	"time"

+ -

+ -	"github.com/prometheus/client_golang/prometheus"

+ -)

+ -

+ -func TestClientMiddlewareAPI(t *testing.T) {

+ -	client := http.DefaultClient

+ -	client.Timeout = 1 * time.Second

+ -

+ -	reg := prometheus.NewRegistry()

+ -

+ -	inFlightGauge := prometheus.NewGauge(prometheus.GaugeOpts{

+ -		Name: "client_in_flight_requests",

+ -		Help: "A gauge of in-flight requests for the wrapped client.",

+ -	})

+ -

+ -	counter := prometheus.NewCounterVec(

+ -		prometheus.CounterOpts{

+ -			Name: "client_api_requests_total",

+ -			Help: "A counter for requests from the wrapped client.",

+ -		},

+ -		[]string{"code", "method"},

+ -	)

+ -

+ -	dnsLatencyVec := prometheus.NewHistogramVec(

+ -		prometheus.HistogramOpts{

+ -			Name:    "dns_duration_seconds",

+ -			Help:    "Trace dns latency histogram.",

+ -			Buckets: []float64{.005, .01, .025, .05},

+ -		},

+ -		[]string{"event"},

+ -	)

+ -

+ -	tlsLatencyVec := prometheus.NewHistogramVec(

+ -		prometheus.HistogramOpts{

+ -			Name:    "tls_duration_seconds",

+ -			Help:    "Trace tls latency histogram.",

+ -			Buckets: []float64{.05, .1, .25, .5},

+ -		},

+ -		[]string{"event"},

+ -	)

+ -

+ -	histVec := prometheus.NewHistogramVec(

+ -		prometheus.HistogramOpts{

+ -			Name:    "request_duration_seconds",

+ -			Help:    "A histogram of request latencies.",

+ -			Buckets: prometheus.DefBuckets,

+ -		},

+ -		[]string{"method"},

+ -	)

+ -

+ -	reg.MustRegister(counter, tlsLatencyVec, dnsLatencyVec, histVec, inFlightGauge)

+ -

+ -	trace := &InstrumentTrace{

+ -		DNSStart: func(t float64) {

+ -			dnsLatencyVec.WithLabelValues("dns_start")

+ -		},

+ -		DNSDone: func(t float64) {

+ -			dnsLatencyVec.WithLabelValues("dns_done")

+ -		},

+ -		TLSHandshakeStart: func(t float64) {

+ -			tlsLatencyVec.WithLabelValues("tls_handshake_start")

+ -		},

+ -		TLSHandshakeDone: func(t float64) {

+ -			tlsLatencyVec.WithLabelValues("tls_handshake_done")

+ -		},

+ -	}

+ -

+ -	client.Transport = InstrumentRoundTripperInFlight(inFlightGauge,

+ -		InstrumentRoundTripperCounter(counter,

+ -			InstrumentRoundTripperTrace(trace,

+ -				InstrumentRoundTripperDuration(histVec, http.DefaultTransport),

+ -			),

+ -		),

+ -	)

+ -

+ -	resp, err := client.Get("http://google.com")

+ -	if err != nil {

+ -		t.Fatalf("%v", err)

+ -	}

+ -	defer resp.Body.Close()

+ -}

+ -

+ -func ExampleInstrumentRoundTripperDuration() {

+ -	client := http.DefaultClient

+ -	client.Timeout = 1 * time.Second

+ -

+ -	inFlightGauge := prometheus.NewGauge(prometheus.GaugeOpts{

+ -		Name: "client_in_flight_requests",

+ -		Help: "A gauge of in-flight requests for the wrapped client.",

+ -	})

+ -

+ -	counter := prometheus.NewCounterVec(

+ -		prometheus.CounterOpts{

+ -			Name: "client_api_requests_total",

+ -			Help: "A counter for requests from the wrapped client.",

+ -		},

+ -		[]string{"code", "method"},

+ -	)

+ -

+ -	// dnsLatencyVec uses custom buckets based on expected dns durations.

+ -	// It has an instance label "event", which is set in the

+ -	// DNSStart and DNSDonehook functions defined in the

+ -	// InstrumentTrace struct below.

+ -	dnsLatencyVec := prometheus.NewHistogramVec(

+ -		prometheus.HistogramOpts{

+ -			Name:    "dns_duration_seconds",

+ -			Help:    "Trace dns latency histogram.",

+ -			Buckets: []float64{.005, .01, .025, .05},

+ -		},

+ -		[]string{"event"},

+ -	)

+ -

+ -	// tlsLatencyVec uses custom buckets based on expected tls durations.

+ -	// It has an instance label "event", which is set in the

+ -	// TLSHandshakeStart and TLSHandshakeDone hook functions defined in the

+ -	// InstrumentTrace struct below.

+ -	tlsLatencyVec := prometheus.NewHistogramVec(

+ -		prometheus.HistogramOpts{

+ -			Name:    "tls_duration_seconds",

+ -			Help:    "Trace tls latency histogram.",

+ -			Buckets: []float64{.05, .1, .25, .5},

+ -		},

+ -		[]string{"event"},

+ -	)

+ -

+ -	// histVec has no labels, making it a zero-dimensional ObserverVec.

+ -	histVec := prometheus.NewHistogramVec(

+ -		prometheus.HistogramOpts{

+ -			Name:    "request_duration_seconds",

+ -			Help:    "A histogram of request latencies.",

+ -			Buckets: prometheus.DefBuckets,

+ -		},

+ -		[]string{},

+ -	)

+ -

+ -	// Register all of the metrics in the standard registry.

+ -	prometheus.MustRegister(counter, tlsLatencyVec, dnsLatencyVec, histVec, inFlightGauge)

+ -

+ -	// Define functions for the available httptrace.ClientTrace hook

+ -	// functions that we want to instrument.

+ -	trace := &InstrumentTrace{

+ -		DNSStart: func(t float64) {

+ -			dnsLatencyVec.WithLabelValues("dns_start")

+ -		},

+ -		DNSDone: func(t float64) {

+ -			dnsLatencyVec.WithLabelValues("dns_done")

+ -		},

+ -		TLSHandshakeStart: func(t float64) {

+ -			tlsLatencyVec.WithLabelValues("tls_handshake_start")

+ -		},

+ -		TLSHandshakeDone: func(t float64) {

+ -			tlsLatencyVec.WithLabelValues("tls_handshake_done")

+ -		},

+ -	}

+ -

+ -	// Wrap the default RoundTripper with middleware.

+ -	roundTripper := InstrumentRoundTripperInFlight(inFlightGauge,

+ -		InstrumentRoundTripperCounter(counter,

+ -			InstrumentRoundTripperTrace(trace,

+ -				InstrumentRoundTripperDuration(histVec, http.DefaultTransport),

+ -			),

+ -		),

+ -	)

+ -

+ -	// Set the RoundTripper on our client.

+ -	client.Transport = roundTripper

+ -

+ -	resp, err := client.Get("http://google.com")

+ -	if err != nil {

+ -		log.Printf("error: %v", err)

+ -	}

+ -	defer resp.Body.Close()

+ -}

@@ -1,190 +1,68 @@

- # If any of the following macros should be set otherwise,

- # you can wrap any of them with the following conditions:

- # - %%if 0%%{centos} == 7

- # - %%if 0%%{?rhel} == 7

- # - %%if 0%%{?fedora} == 23

- # Or just test for particular distribution:

- # - %%if 0%%{centos}

- # - %%if 0%%{?rhel}

- # - %%if 0%%{?fedora}

- #

- # Be aware, on centos, both %%rhel and %%centos are set. If you want to test

- # rhel specific macros, you can use %%if 0%%{?rhel} && 0%%{?centos} == 0 condition.

- # (Don't forget to replace double percentage symbol with single one in order to apply a condition)

- 

- # Generate devel rpm

- %global with_devel 1

- # Build project from bundled dependencies

- %global with_bundled 0

- # Build with debug info rpm

- %global with_debug 0

- # Run tests in check section

- # Cyclic deps between common and client again

- %global with_check 0

- # Generate unit-test rpm

- %global with_unit_test 1

- 

- %if 0%{?with_debug}

- %global _dwz_low_mem_die_limit 0

- %else

- %global debug_package   %{nil}

- %endif

- 

- %global provider        github

- %global provider_tld    com

- %global project         prometheus

- %global repo            client_golang

  # https://github.com/prometheus/client_golang

- %global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}

- %global import_path     %{provider_prefix}

- %global commit          c5b7fccd204277076155f10851dad72b76a49317

- %global shortcommit     %(c=%{commit}; echo ${c:0:7})

- 

- Name:           golang-%{provider}-%{project}-%{repo}

- Version:        0.7.0

- Release:        10%{?dist}

+ %global goipath github.com/prometheus/client_golang

+ %global commit  180b8fdc22b4ea7750bcb43c925277654a1ea2f3

+ 

+ %gometa

+ 

+ Name:           golang-github-prometheus-client_golang

+ Version:        0.9.0

+ Release:        0.1%{?dist}

  Summary:        Prometheus instrumentation library for Go applications

  License:        ASL 2.0

- URL:            https://%{provider_prefix}

- Source0:        https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz

  

- # e.g. el6 has ppc64 arch without gcc-go, so EA tag is required

- ExclusiveArch:  %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 %{arm}}

- # If go_compiler is not set to 1, there is no virtual provide. Use golang instead.

- BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}

+ URL:            %{gourl}

+ Source0:        %{gosource}

  

- %description

- %{summary}

+ # Patch to disable tests which require network connection

+ Patch0:         00-disable-networking-tests.patch

  

- %if 0%{?with_devel}

- %package devel

- Summary:       %{summary}

- BuildArch:     noarch

- 

- %if 0%{?with_check}

- BuildRequires: golang(github.com/beorn7/perks/quantile)

- BuildRequires: golang(github.com/golang/protobuf/proto)

- BuildRequires: golang(github.com/prometheus/client_model/go)

- BuildRequires: golang(github.com/prometheus/common/expfmt)

- BuildRequires: golang(github.com/prometheus/common/model)

- BuildRequires: golang(github.com/prometheus/procfs)

- BuildRequires: golang(golang.org/x/net/context)

- BuildRequires: golang(golang.org/x/net/context/ctxhttp)

- %endif

- 

- Requires:      golang(github.com/beorn7/perks/quantile)

- Requires:      golang(github.com/golang/protobuf/proto)

- Requires:      golang(github.com/prometheus/client_model/go)

- Requires:      golang(github.com/prometheus/common/expfmt)

- Requires:      golang(github.com/prometheus/common/model)

- Requires:      golang(github.com/prometheus/procfs)

- Requires:      golang(golang.org/x/net/context)

- Requires:      golang(golang.org/x/net/context/ctxhttp)

- 

- Provides:      golang(%{import_path}/api/prometheus) = %{version}-%{release}

- Provides:      golang(%{import_path}/prometheus) = %{version}-%{release}

- Provides:      golang(%{import_path}/prometheus/promhttp) = %{version}-%{release}

- Provides:      golang(%{import_path}/prometheus/push) = %{version}-%{release}

- 

- %description devel

+ %description

  %{summary}

  

- This package contains library source intended for

- building other packages which use import path with

- %{import_path} prefix.

- %endif

- 

- %if 0%{?with_unit_test}

- %package unit-test

- Summary:         Unit tests for %{name} package

  

- %if 0%{?with_check}

- #Here comes all BuildRequires: PACKAGE the unit tests

- #in %%check section need for running

- %endif

+ %package        devel

+ Summary:        %{summary}

+ BuildArch:      noarch

  

- # test subpackage tests code from devel subpackage

- Requires:        %{name}-devel = %{version}-%{release}

+ BuildRequires:  golang(github.com/beorn7/perks/quantile)

+ BuildRequires:  golang(github.com/golang/protobuf/proto)

+ BuildRequires:  golang(github.com/prometheus/client_model/go)

+ BuildRequires:  golang(github.com/prometheus/common/expfmt)

+ BuildRequires:  golang(github.com/prometheus/common/model)

+ BuildRequires:  golang(github.com/prometheus/procfs)

+ BuildRequires:  golang(golang.org/x/net/context)

  

- %description unit-test

+ %description    devel

  %{summary}

  

- This package contains unit tests for project

- providing packages with %{import_path} prefix.

- %endif

+ This package contains library source intended for

+ building other packages which use import path with

+ %{goipath} prefix.

+ 

  

  %prep

- %setup -q -n %{repo}-%{commit}

+ %gosetup -q

+ %patch0 -p1

  

- %build

  

  %install

- # source codes for building projects

- %if 0%{?with_devel}

- install -d -p %{buildroot}/%{gopath}/src/%{import_path}/

- echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list

- # find all *.go but no *_test.go files and generate devel.file-list

- for file in $(find . -iname "*.go" \! -iname "*_test.go") ; do

-     install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)

-     cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file

-     echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list

- done

- %endif

- 

- # testing files for this project

- %if 0%{?with_unit_test}

- install -d -p %{buildroot}/%{gopath}/src/%{import_path}/

- # find all *_test.go files and generate unit-test.file-list

- for file in $(find . -iname "*_test.go"); do

-     install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)

-     cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file

-     echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test.file-list

- done

- for file in $(find ./extraction/ -iname "*.json"); do

-     install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)

-     cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file

-     echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test.file-list

- done

- %endif

+ %goinstall

+ 

  

  %check

- %if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}

- %if ! 0%{?with_bundled}

- export GOPATH=%{buildroot}/%{gopath}:%{gopath}

- %else

- export GOPATH=%{buildroot}/%{gopath}:$(pwd)/Godeps/_workspace:%{gopath}

- %endif

- 

- %if ! 0%{?gotest:1}

- %global gotest go test

- %endif

- 

- # Test failed on x86_64: signature_test.go:265: expected LabelsToSignature with

- # empty labels not to perform allocations

- #gotest %{import_path}/model

- # Test failed on i686: go_collector_test.go:108: want 1 new garbage collection

- # run, got 2

- #gotest %{import_path}/prometheus

- %gotest %{import_path}/api/prometheus

- %endif

- 

- #define license tag if not already defined

- %{!?_licensedir:%global license %doc}

- 

- %if 0%{?with_devel}

+ %gochecks

+ 

+ 

  %files devel -f devel.file-list

  %license LICENSE

- %doc README.md CONTRIBUTING.md AUTHORS.md CHANGELOG.md

- %dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}

- %endif

+ %doc README.md MAINTAINERS.md CONTRIBUTING.md CHANGELOG.md

  

- %if 0%{?with_unit_test}

- %files unit-test -f unit-test.file-list

- %license LICENSE

- %doc README.md CONTRIBUTING.md AUTHORS.md CHANGELOG.md

- %endif

  

  %changelog

+ * Tue May 08 2018 Fabio Valentini <decathorpe@gmail.com> - 0.9.0-0.1.20180526git180b8fd

+ - Update to 0.9.0 pre snapshot to fix syncthing builds.

+ - Update to spec 3.0.

+ 

  * Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.0-10

  - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

  

file modified
+1 -1
@@ -1,1 +1,1 @@

- SHA512 (client_golang-c5b7fcc.tar.gz) = 5fe34c1cbd9aee1d1e50424aec83a1e72d834b25208e35c1af8b30519f6db26a6d54adeacf40006f4d04539c1d2e8f577641c8d796314cd71e9b87b20847b2d7

+ SHA512 (client_golang-180b8fdc22b4ea7750bcb43c925277654a1ea2f3.tar.gz) = 51ea1aeb587490ef29a1fb0063d44f3ccf7702cf400a5c4578762b3cda83544899f3fd46b05adaf78431f39f8cedb484a8f4236eaa081d957bcb26d530b79aa1

I have test-rebuilt all dependent packages (etcd, syncthing, golang-opencensus) against this new version in a COPR repository. All of them were built successfully and had only passing tests, where available. 0

The new source file has already been uploaded to the lookaside cache.

Please also merge/cherry-pick this commit into the f28 and f27 branches and submit builds and updates (I can do the buildroot overrides myself). If you don't want to "backport" the changes yourself, I can provide pull requests for the f28 and f27 branches, too. I need this newer version for a minor new stable release of syncthing (0.14.46 -> 0.14.47).

Fixes: RHBZ#1573542
Blocks: RHBZ#1565870

Ping, can somebody look at this?

syncthing is now not only one, but two versions behind upstream because the updates are being held back by this outdated package.

Pull-Request has been merged by jchaloup

5 years ago