Skip to content

Commit

Permalink
go.mod: bump github.com/prometheus/client_golang from 1.16.0 to 1.17.0 (
Browse files Browse the repository at this point in the history
#1226)

* go.mod: bump github.com/prometheus/client_golang from 1.16.0 to 1.17.0

Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.16.0 to 1.17.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/v1.17.0/CHANGELOG.md)
- [Commits](prometheus/client_golang@v1.16.0...v1.17.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* ignore CreatedTimestamp

* linter

* ignore createdtimestamp

* linter

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Haris Osmanagic <[email protected]>
  • Loading branch information
dependabot[bot] and hariso authored Nov 1, 2023
1 parent 6e7a35a commit 4ddb381
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 17 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ require (
github.com/modern-go/reflect2 v1.0.2
github.com/peterbourgon/ff/v3 v3.4.0
github.com/piotrkowalczuk/promgrpc/v4 v4.1.0
github.com/prometheus/client_golang v1.16.0
github.com/prometheus/client_golang v1.17.0
github.com/prometheus/client_model v0.5.0
github.com/prometheus/common v0.44.0
github.com/rs/zerolog v1.31.0
Expand Down Expand Up @@ -154,7 +154,7 @@ require (
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pkg/profile v1.7.0 // indirect
github.com/prometheus/procfs v0.10.1 // indirect
github.com/prometheus/procfs v0.11.1 // indirect
github.com/rs/cors v1.10.1 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/segmentio/kafka-go v0.4.42 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,8 @@ github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0=
github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8=
github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc=
github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q=
github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
Expand All @@ -585,8 +585,8 @@ github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg=
github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM=
github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI=
github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY=
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
Expand Down
14 changes: 12 additions & 2 deletions pkg/foundation/metrics/prometheus/counter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (
"testing"

"github.com/conduitio/conduit/pkg/foundation/metrics"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/matryer/is"
"github.com/prometheus/client_golang/prometheus"
dto "github.com/prometheus/client_model/go"
Expand Down Expand Up @@ -84,7 +86,11 @@ func TestCounter(t *testing.T) {

got, err := promRegistry.Gather()
is.NoErr(err)
is.Equal(want, got)
opts := []cmp.Option{
cmpopts.IgnoreUnexported(dto.Counter{}, dto.MetricFamily{}, dto.Metric{}, dto.LabelPair{}),
cmpopts.IgnoreFields(dto.Counter{}, "CreatedTimestamp"),
}
is.True(cmp.Equal(want, got, opts...))
})
}
}
Expand Down Expand Up @@ -179,7 +185,11 @@ func TestLabeledCounter(t *testing.T) {

got, err := promRegistry.Gather()
is.NoErr(err)
is.Equal(want, got)
opts := []cmp.Option{
cmpopts.IgnoreUnexported(dto.Counter{}, dto.MetricFamily{}, dto.Metric{}, dto.LabelPair{}),
cmpopts.IgnoreFields(dto.Counter{}, "CreatedTimestamp"),
}
is.True(cmp.Equal(want, got, opts...))
})
}
}
20 changes: 18 additions & 2 deletions pkg/foundation/metrics/prometheus/histogram_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (
"testing"

"github.com/conduitio/conduit/pkg/foundation/metrics"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/matryer/is"
"github.com/prometheus/client_golang/prometheus"
dto "github.com/prometheus/client_model/go"
Expand Down Expand Up @@ -93,7 +95,14 @@ func TestHistogram(t *testing.T) {

got, err := promRegistry.Gather()
is.NoErr(err)
is.Equal(want, got)
opts := []cmp.Option{
cmpopts.IgnoreUnexported(dto.MetricFamily{}, dto.Metric{}, dto.Histogram{}, dto.Bucket{}, dto.LabelPair{}),
cmpopts.IgnoreFields(dto.Histogram{}, "CreatedTimestamp"),
}
diff := cmp.Diff(want, got, opts...)
if diff != "" {
t.Errorf("Expected and actual metrics are different:\n%s", diff)
}
})
}
}
Expand Down Expand Up @@ -196,7 +205,14 @@ func TestLabeledHistogram(t *testing.T) {

got, err := promRegistry.Gather()
is.NoErr(err)
is.Equal(want, got)
opts := []cmp.Option{
cmpopts.IgnoreUnexported(dto.MetricFamily{}, dto.Metric{}, dto.Histogram{}, dto.Bucket{}, dto.LabelPair{}),
cmpopts.IgnoreFields(dto.Histogram{}, "CreatedTimestamp"),
}
diff := cmp.Diff(want, got, opts...)
if diff != "" {
t.Errorf("Expected and actual metrics are different:\n%s", diff)
}
})
}
}
Expand Down
41 changes: 34 additions & 7 deletions pkg/foundation/metrics/prometheus/timer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import (
"time"

"github.com/conduitio/conduit/pkg/foundation/metrics"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/matryer/is"
"github.com/prometheus/client_golang/prometheus"
dto "github.com/prometheus/client_model/go"
Expand Down Expand Up @@ -94,7 +96,14 @@ func TestTimer(t *testing.T) {

got, err := promRegistry.Gather()
is.NoErr(err)
is.Equal(want, got)
opts := []cmp.Option{
cmpopts.IgnoreUnexported(dto.MetricFamily{}, dto.Metric{}, dto.Histogram{}, dto.Bucket{}),
cmpopts.IgnoreFields(dto.Histogram{}, "CreatedTimestamp"),
}
diff := cmp.Diff(want, got, opts...)
if diff != "" {
t.Errorf("Expected and actual metrics are different:\n%s", diff)
}
})
}
}
Expand Down Expand Up @@ -130,14 +139,22 @@ func TestTimer_Since(t *testing.T) {
is.NoErr(err)

// first manually check the difference, we can't know the actual sum
diff := *got[0].Metric[0].Histogram.SampleSum - *want[0].Metric[0].Histogram.SampleSum
if diff > 0.01 { // we leave room for 10 milliseconds
t.Errorf("sample sum diff was greater than expected: %v", diff)
sumDiff := *got[0].Metric[0].Histogram.SampleSum - *want[0].Metric[0].Histogram.SampleSum
if sumDiff > 0.01 { // we leave room for 10 milliseconds
t.Errorf("sample sum diff was greater than expected: %v", sumDiff)
}

// add difference to our estimate and make sure everything else matches
*want[0].Metric[0].Histogram.SampleSum += diff
is.Equal(want, got)
*want[0].Metric[0].Histogram.SampleSum += sumDiff

opts := []cmp.Option{
cmpopts.IgnoreUnexported(dto.MetricFamily{}, dto.Metric{}, dto.Histogram{}, dto.Bucket{}),
cmpopts.IgnoreFields(dto.Histogram{}, "CreatedTimestamp"),
}
diff := cmp.Diff(want, got, opts...)
if diff != "" {
t.Errorf("Expected and actual metrics are different:\n%s", diff)
}
}

func TestLabeledTimer(t *testing.T) {
Expand Down Expand Up @@ -238,7 +255,17 @@ func TestLabeledTimer(t *testing.T) {

got, err := promRegistry.Gather()
is.NoErr(err)
is.Equal(want, got)
opts := []cmp.Option{
cmpopts.IgnoreUnexported(
dto.MetricFamily{},
dto.Metric{},
dto.Histogram{},
dto.Bucket{},
dto.LabelPair{},
),
cmpopts.IgnoreFields(dto.Histogram{}, "CreatedTimestamp"),
}
is.True(cmp.Equal(want, got, opts...))
})
}
}

0 comments on commit 4ddb381

Please sign in to comment.