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

Bump prometheus dependency to v2.21.0 #8795

Merged

Conversation

pmalek-sumo
Copy link
Contributor

Bump Prometeus dependency to v2.21.0.

In order to achieve this the following go get was performed:

go get github.com/prometheus/prometheus@e83ef207b6c2398919b69cd87d2693cfc2fb4127

The reason for this is that Prometheus doesn't follow Go module semver conventions (its module should have a /v2 suffix but there's no intention in doing this - prometheus/prometheus#7991 (comment)).

The remaining changes are coming from a change in PB files from github.com/prometheus/prometheus/prompb from 1 to 2 via PR

Motivation

Apart from being up to date the motivation it will allow other projects to use telegraf package's e.g. github.com/influxdata/telegraf/agent.

The use case where I hit this was when I was trying to import github.com/influxdata/telegraf/agent from within https://github.com/open-telemetry/opentelemetry-collector-contrib which gave me the following errors:

GO111MODULE=on CGO_ENABLED=0 go build -o ./bin/otelcontribcol_unstable_darwin_amd64 \
                -ldflags "-X github.com/open-telemetry/opentelemetry-collector-contrib/internal/version.GitHash=63b2f339 -X github.com/open-telemetry/opentelemetry-collector-contrib/internal/version.Version=v0.19.0 -X go.opentelemetry.io/collector/internal/version.BuildType=release" -tags enable_unstable ./cmd/otelcontribcol
go: finding module for package github.com/prometheus/prometheus/discovery/install
go: finding module for package github.com/Azure/azure-sdk-for-go/arm/compute
go: finding module for package github.com/Azure/azure-sdk-for-go/arm/network
../../../.gvm/pkgsets/go1.15.7/global/pkg/mod/github.com/prometheus/prometheus@v2.5.0+incompatible/discovery/azure/azure.go:24:2: module github.com/Azure/azure-sdk-for-go@latest found (v51.0.0+incompatible), but does not contain package github.com/Azure/azure-sdk-for-go/arm/compute
../../../.gvm/pkgsets/go1.15.7/global/pkg/mod/github.com/prometheus/prometheus@v2.5.0+incompatible/discovery/azure/azure.go:25:2: module github.com/Azure/azure-sdk-for-go@latest found (v51.0.0+incompatible), but does not contain package github.com/Azure/azure-sdk-for-go/arm/network
../../../.gvm/pkgsets/go1.15.7/global/pkg/mod/github.com/prometheus/prometheus@v2.5.0+incompatible/discovery/consul/consul.go:27:2: ambiguous import: found package github.com/hashicorp/consul/api in multiple modules:
        github.com/hashicorp/consul v1.2.1 (/Users/DUMMY/.gvm/pkgsets/go1.15.7/global/pkg/mod/github.com/hashicorp/consul@v1.2.1/api)
        github.com/hashicorp/consul/api v1.7.0 (/Users/DUMMY/.gvm/pkgsets/go1.15.7/global/pkg/mod/github.com/hashicorp/consul/api@v1.7.0)
../../../.gvm/pkgsets/go1.15.7/global/pkg/mod/go.opentelemetry.io/collector@v0.19.0/receiver/prometheusreceiver/factory.go:22:2: module github.com/prometheus/prometheus@latest found (v2.5.0+incompatible), but does not contain package github.com/prometheus/prometheus/discovery/install

Please note the v2.5.0+incompatible that is required as of now (which doesn't understand Go modules hence most of the problems listed above).

Copy link
Contributor

@telegraf-tiger telegraf-tiger bot left a comment

Choose a reason for hiding this comment

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

🤝 ✅ CLA has been signed. Thank you!

@pmalek-sumo pmalek-sumo force-pushed the pmalek-bump-prometheus-dependency branch from ac613e8 to 32cbc18 Compare February 3, 2021 15:51
@pmalek-sumo
Copy link
Contributor Author

Ok so unfortunately this makes the tests to fail because of an assertion in google.golang.org/protobuf@v1.24.0

https://github.com/protocolbuffers/protobuf-go/blob/v1.24.0/internal/impl/legacy_message.go#L136

panic: mismatching message name: got k8s.io.kubernetes.pkg.watch.versioned.Event, want github.com/ericchiang.k8s.watch.versioned.Event

goroutine 1 [running]:
google.golang.org/protobuf/internal/impl.legacyLoadMessageDesc(0x11cec20, 0x1043b60, 0x10ae672, 0x2f, 0x0, 0xa2b100)
	/go/pkg/mod/google.golang.org/protobuf@v1.24.0/internal/impl/legacy_message.go:136 +0xa38
google.golang.org/protobuf/internal/impl.legacyLoadMessageInfo(0x11cec20, 0x1043b60, 0x10ae672, 0x2f, 0xc0001b1e60)
	/go/pkg/mod/google.golang.org/protobuf@v1.24.0/internal/impl/legacy_message.go:48 +0xf3
google.golang.org/protobuf/internal/impl.Export.LegacyMessageTypeOf(0x11bbf40, 0x0, 0x10ae672, 0x2f, 0xc000224410, 0xc0002ac000)
	/go/pkg/mod/google.golang.org/protobuf@v1.24.0/internal/impl/legacy_export.go:33 +0xd6
github.com/golang/protobuf/proto.RegisterType(0x11bbf40, 0x0, 0x10ae672, 0x2f)
	/go/pkg/mod/github.com/golang/protobuf@v1.4.2/proto/registry.go:186 +0x6a
github.com/ericchiang/k8s/watch/versioned.init.0()
	/go/pkg/mod/github.com/ericchiang/k8s@v1.2.0/watch/versioned/generated.pb.go:70 +0x59
FAIL	github.com/influxdata/telegraf/plugins/inputs/prometheus	0.037s

@sspaink
Copy link
Contributor

sspaink commented Mar 24, 2021

@pmalek-sumo Thank you for this pr, I've updated the Kubernetes go client in this pr #8937 so the failure in the tests you were getting should be resolvable now.

@pmalek-sumo pmalek-sumo force-pushed the pmalek-bump-prometheus-dependency branch from 32cbc18 to cc6e116 Compare March 25, 2021 14:24
@pmalek-sumo pmalek-sumo force-pushed the pmalek-bump-prometheus-dependency branch from cc6e116 to a5671fd Compare March 25, 2021 14:40
Copy link
Contributor

@telegraf-tiger telegraf-tiger bot left a comment

Choose a reason for hiding this comment

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

@pmalek-sumo
Copy link
Contributor Author

Thanks @sspaink ! It seems the patch is now clean to apply.

Copy link
Contributor

@sspaink sspaink left a comment

Choose a reason for hiding this comment

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

Looks good!

@sspaink sspaink merged commit e96955d into influxdata:master Mar 25, 2021
@pmalek-sumo pmalek-sumo deleted the pmalek-bump-prometheus-dependency branch April 12, 2021 11:02
jblesener pushed a commit to jblesener/telegraf that referenced this pull request Apr 18, 2021
* Bump prometheus dependency to v2.21.0

* Make golangci-lint happy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants