Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Go modules #1270

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2.1
orbs:
go: circleci/go@1.7.1
prometheus: prometheus/prometheus@0.16.0
prometheus: prometheus/prometheus@0.17.1
jobs:
test:
parameters:
Expand Down
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,11 @@ updates:
directory: "/"
schedule:
interval: "monthly"
- package-ecosystem: "gomod"
directory: "/examples/middleware"
schedule:
interval: "monthly"
- package-ecosystem: "gomod"
directory: "/tutorial/whatsup"
schedule:
interval: "monthly"
8 changes: 4 additions & 4 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3
- name: install Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: 1.18.x
go-version: 1.20.x
- name: Install snmp_exporter/generator dependencies
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
if: github.repository == 'prometheus/snmp_exporter'
- name: Lint
uses: golangci/golangci-lint-action@v3.2.0
uses: golangci/golangci-lint-action@v3.4.0
with:
version: v1.45.2
version: v1.51.2
20 changes: 10 additions & 10 deletions examples/middleware/go.mod
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
module github.com/jessicalins/instrumentation-practices-examples/middleware

go 1.17
go 1.18

require github.com/prometheus/client_golang v1.13.1
require github.com/prometheus/client_golang v1.15.1

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
google.golang.org/protobuf v1.28.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
golang.org/x/sys v0.6.0 // indirect
google.golang.org/protobuf v1.30.0 // indirect
)
487 changes: 19 additions & 468 deletions examples/middleware/go.sum

Large diffs are not rendered by default.

13 changes: 6 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module github.com/prometheus/client_golang

go 1.17
go 1.18

require (
github.com/beorn7/perks v1.0.1
github.com/cespare/xxhash/v2 v2.2.0
github.com/davecgh/go-spew v1.1.1
github.com/json-iterator/go v1.1.12
github.com/prometheus/client_model v0.3.0
github.com/prometheus/common v0.42.0
github.com/prometheus/client_model v0.4.0
github.com/prometheus/common v0.43.0
github.com/prometheus/procfs v0.9.0
golang.org/x/sys v0.7.0
google.golang.org/protobuf v1.30.0
Expand All @@ -22,12 +22,11 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/oauth2 v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
golang.org/x/net v0.9.0 // indirect
golang.org/x/oauth2 v0.7.0 // indirect
golang.org/x/text v0.9.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

exclude github.com/prometheus/client_golang v1.12.1
418 changes: 12 additions & 406 deletions go.sum

Large diffs are not rendered by default.

24 changes: 16 additions & 8 deletions prometheus/counter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ func TestCounterAdd(t *testing.T) {
m := &dto.Metric{}
counter.Write(m)

if expected, got := `label:<name:"a" value:"1" > label:<name:"b" value:"2" > counter:<value:67.42 > `, m.String(); expected != got {
t.Errorf("expected %q, got %q", expected, got)
want := `label:{name:"a" value:"1"} label:{name:"b" value:"2"} counter:{value:67.42}`

if err := compareProtoAndMetric(want, m); err != nil {
t.Errorf("Summary didn't match: %s", err)
}
}

Expand Down Expand Up @@ -164,8 +166,10 @@ func TestCounterAddInf(t *testing.T) {
m := &dto.Metric{}
counter.Write(m)

if expected, got := `counter:<value:inf > `, m.String(); expected != got {
t.Errorf("expected %q, got %q", expected, got)
want := `counter:{value:inf}`

if err := compareProtoAndMetric(want, m); err != nil {
t.Errorf("Summary didn't match: %s", err)
}
}

Expand All @@ -188,8 +192,10 @@ func TestCounterAddLarge(t *testing.T) {
m := &dto.Metric{}
counter.Write(m)

if expected, got := fmt.Sprintf("counter:<value:%0.16e > ", large), m.String(); expected != got {
t.Errorf("expected %q, got %q", expected, got)
want := fmt.Sprintf("counter:{value:%0.16e}", large)

if err := compareProtoAndMetric(want, m); err != nil {
t.Errorf("Summary didn't match: %s", err)
}
}

Expand All @@ -210,8 +216,10 @@ func TestCounterAddSmall(t *testing.T) {
m := &dto.Metric{}
counter.Write(m)

if expected, got := fmt.Sprintf("counter:<value:%0.0e > ", small), m.String(); expected != got {
t.Errorf("expected %q, got %q", expected, got)
want := fmt.Sprintf("counter:{value:%0.0e}", small)

if err := compareProtoAndMetric(want, m); err != nil {
t.Errorf("Summary didn't match: %s", err)
}
}

Expand Down
46 changes: 39 additions & 7 deletions prometheus/example_metricvec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
package prometheus_test

import (
"fmt"
"testing"

"google.golang.org/protobuf/proto"

dto "github.com/prometheus/client_model/go"

"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/testutil"
dto "github.com/prometheus/client_model/go"
)

// Info implements an info pseudo-metric, which is modeled as a Gauge that
Expand Down Expand Up @@ -106,7 +106,7 @@ func (v *InfoVec) MustCurryWith(labels prometheus.Labels) *InfoVec {
return vec
}

func ExampleMetricVec() {
func TestExampleMetricVec(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it meant to be Example for a reason (it's nicely highlighted on Go docs) 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, didn't know that.

infoVec := NewInfoVec(
"library_version_info",
"Versions of the libraries used in this binary.",
Expand All @@ -126,8 +126,40 @@ func ExampleMetricVec() {
if err != nil || len(metricFamilies) != 1 {
panic("unexpected behavior of custom test registry")
}
fmt.Println(metricFamilies[0].String())

// Output:
// name:"library_version_info" help:"Versions of the libraries used in this binary." type:GAUGE metric:<label:<name:"library" value:"k8s.io/client-go" > label:<name:"version" value:"0.18.8" > gauge:<value:1 > > metric:<label:<name:"library" value:"prometheus/client_golang" > label:<name:"version" value:"1.7.1" > gauge:<value:1 > >
want := `
name: "library_version_info"
help: "Versions of the libraries used in this binary."
type: GAUGE
metric: {
label: {
name: "library"
value: "k8s.io/client-go"
}
label: {
name: "version"
value: "0.18.8"
}
gauge: {
value: 1
}
}
metric: {
label: {
name: "library"
value: "prometheus/client_golang"
}
label: {
name: "version"
value: "1.7.1"
}
gauge: {
value: 1
}
}
`

if err := testutil.CompareProtoAndMetricFamily(want, metricFamilies[0]); err != nil {
t.Errorf("Summary didn't match: %s", err)
}
}
Loading