From 4ddb381ac50572dcaa19b8196f7cf7570be87e2d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Nov 2023 12:33:17 +0000 Subject: [PATCH] go.mod: bump github.com/prometheus/client_golang from 1.16.0 to 1.17.0 (#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](https://github.com/prometheus/client_golang/compare/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] * ignore CreatedTimestamp * linter * ignore createdtimestamp * linter --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Haris Osmanagic --- go.mod | 4 +- go.sum | 8 ++-- .../metrics/prometheus/counter_test.go | 14 ++++++- .../metrics/prometheus/histogram_test.go | 20 ++++++++- .../metrics/prometheus/timer_test.go | 41 +++++++++++++++---- 5 files changed, 70 insertions(+), 17 deletions(-) diff --git a/go.mod b/go.mod index 2408d7f68..f6878a3e8 100644 --- a/go.mod +++ b/go.mod @@ -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 @@ -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 diff --git a/go.sum b/go.sum index 68e741d23..429c30feb 100644 --- a/go.sum +++ b/go.sum @@ -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= @@ -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= diff --git a/pkg/foundation/metrics/prometheus/counter_test.go b/pkg/foundation/metrics/prometheus/counter_test.go index 07f2b46e6..f9429946f 100644 --- a/pkg/foundation/metrics/prometheus/counter_test.go +++ b/pkg/foundation/metrics/prometheus/counter_test.go @@ -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" @@ -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...)) }) } } @@ -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...)) }) } } diff --git a/pkg/foundation/metrics/prometheus/histogram_test.go b/pkg/foundation/metrics/prometheus/histogram_test.go index c9fd00c7a..b4d49aacc 100644 --- a/pkg/foundation/metrics/prometheus/histogram_test.go +++ b/pkg/foundation/metrics/prometheus/histogram_test.go @@ -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" @@ -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) + } }) } } @@ -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) + } }) } } diff --git a/pkg/foundation/metrics/prometheus/timer_test.go b/pkg/foundation/metrics/prometheus/timer_test.go index 1263c3630..22645cb38 100644 --- a/pkg/foundation/metrics/prometheus/timer_test.go +++ b/pkg/foundation/metrics/prometheus/timer_test.go @@ -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" @@ -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) + } }) } } @@ -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) { @@ -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...)) }) } }