From 1faf57e2e0ba6dfb5e10bac02ff3458d5dd4151e Mon Sep 17 00:00:00 2001 From: Juan Manuel Perez Date: Wed, 2 Oct 2024 15:40:04 +0200 Subject: [PATCH 1/7] upgrade infra-sdk to a compatible v3 version --- cmd/nri-vsphere/nri-vsphere.go | 2 +- go.mod | 2 +- go.sum | 2 ++ internal/cache/cache.go | 2 +- internal/cache/cache_test.go | 2 +- internal/collect/datacenters.go | 2 +- internal/config/config.go | 4 ++-- internal/process/cluster.go | 2 +- internal/process/datacenter.go | 6 +++--- internal/process/datastores.go | 2 +- internal/process/hosts.go | 2 +- internal/process/process.go | 4 ++-- internal/process/resourcepool.go | 2 +- internal/process/snapshot.go | 4 ++-- internal/process/snapshot_test.go | 2 +- internal/process/vms.go | 2 +- internal/process/vms_test.go | 2 +- 17 files changed, 23 insertions(+), 21 deletions(-) diff --git a/cmd/nri-vsphere/nri-vsphere.go b/cmd/nri-vsphere/nri-vsphere.go index e546ec52..d738900a 100644 --- a/cmd/nri-vsphere/nri-vsphere.go +++ b/cmd/nri-vsphere/nri-vsphere.go @@ -10,7 +10,7 @@ import ( "runtime" "strings" - "github.com/newrelic/infra-integrations-sdk/integration" + "github.com/newrelic/infra-integrations-sdk/v3/integration" "github.com/newrelic/nri-vsphere/internal/client" "github.com/newrelic/nri-vsphere/internal/collect" "github.com/newrelic/nri-vsphere/internal/config" diff --git a/go.mod b/go.mod index 83a277bc..b731e9a1 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/newrelic/nri-vsphere go 1.23.1 require ( - github.com/newrelic/infra-integrations-sdk v3.8.2+incompatible + github.com/newrelic/infra-integrations-sdk/v3 v3.9.1 github.com/sirupsen/logrus v1.9.3 github.com/stretchr/testify v1.9.0 github.com/vmware/govmomi v0.36.3 diff --git a/go.sum b/go.sum index 2b0e9013..361b4a68 100644 --- a/go.sum +++ b/go.sum @@ -8,6 +8,8 @@ github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/newrelic/infra-integrations-sdk v3.8.2+incompatible h1:Ktcm1aPAl7CW3o+FXAIKJ+jygWVXDXaUIWFyf2CXQTk= github.com/newrelic/infra-integrations-sdk v3.8.2+incompatible/go.mod h1:tMUHRMq6mJS0YyBnbWrTXAnREnQqC1AGO6Lu45u5xAM= +github.com/newrelic/infra-integrations-sdk/v3 v3.9.1 h1:dCtVLsYNHWTQ5aAlAaHroomOUlqxlGTrdi6XTlvBDfI= +github.com/newrelic/infra-integrations-sdk/v3 v3.9.1/go.mod h1:yPeidhcq9Cla0QDquGXH0KqvS2k9xtetFOD7aLA0Z8M= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/internal/cache/cache.go b/internal/cache/cache.go index b75a2fc1..7fba464c 100644 --- a/internal/cache/cache.go +++ b/internal/cache/cache.go @@ -4,7 +4,7 @@ import ( "fmt" "time" - "github.com/newrelic/infra-integrations-sdk/persist" + "github.com/newrelic/infra-integrations-sdk/v3/persist" ) type Cache struct { diff --git a/internal/cache/cache_test.go b/internal/cache/cache_test.go index 3725361e..938e6b52 100644 --- a/internal/cache/cache_test.go +++ b/internal/cache/cache_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/newrelic/infra-integrations-sdk/persist" + "github.com/newrelic/infra-integrations-sdk/v3/persist" "github.com/stretchr/testify/assert" ) diff --git a/internal/collect/datacenters.go b/internal/collect/datacenters.go index 9fc31a2c..efa8ef64 100644 --- a/internal/collect/datacenters.go +++ b/internal/collect/datacenters.go @@ -7,7 +7,7 @@ import ( "context" "time" - "github.com/newrelic/infra-integrations-sdk/persist" + "github.com/newrelic/infra-integrations-sdk/v3/persist" "github.com/newrelic/nri-vsphere/internal/cache" "github.com/newrelic/nri-vsphere/internal/config" "github.com/newrelic/nri-vsphere/internal/events" diff --git a/internal/config/config.go b/internal/config/config.go index 743b3a69..e0f6c3fe 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -13,8 +13,8 @@ import ( "github.com/newrelic/nri-vsphere/internal/performance" "github.com/newrelic/nri-vsphere/internal/tag" - sdkArgs "github.com/newrelic/infra-integrations-sdk/args" - "github.com/newrelic/infra-integrations-sdk/integration" + sdkArgs "github.com/newrelic/infra-integrations-sdk/v3/args" + "github.com/newrelic/infra-integrations-sdk/v3/integration" logrus "github.com/sirupsen/logrus" "github.com/vmware/govmomi" "github.com/vmware/govmomi/view" diff --git a/internal/process/cluster.go b/internal/process/cluster.go index cb882db2..fa98362a 100644 --- a/internal/process/cluster.go +++ b/internal/process/cluster.go @@ -9,7 +9,7 @@ import ( "github.com/newrelic/nri-vsphere/internal/config" - "github.com/newrelic/infra-integrations-sdk/data/metric" + "github.com/newrelic/infra-integrations-sdk/v3/data/metric" ) func createClusterSamples(config *config.Config) { diff --git a/internal/process/datacenter.go b/internal/process/datacenter.go index 492792e9..b7d03ff8 100644 --- a/internal/process/datacenter.go +++ b/internal/process/datacenter.go @@ -9,9 +9,9 @@ import ( "github.com/newrelic/nri-vsphere/internal/config" - eventSDK "github.com/newrelic/infra-integrations-sdk/data/event" - "github.com/newrelic/infra-integrations-sdk/data/metric" - "github.com/newrelic/infra-integrations-sdk/integration" + eventSDK "github.com/newrelic/infra-integrations-sdk/v3/data/event" + "github.com/newrelic/infra-integrations-sdk/v3/data/metric" + "github.com/newrelic/infra-integrations-sdk/v3/integration" "github.com/newrelic/nri-vsphere/internal/events" logrus "github.com/sirupsen/logrus" ) diff --git a/internal/process/datastores.go b/internal/process/datastores.go index 7c2a1b30..14511797 100644 --- a/internal/process/datastores.go +++ b/internal/process/datastores.go @@ -8,7 +8,7 @@ import ( "github.com/newrelic/nri-vsphere/internal/config" - "github.com/newrelic/infra-integrations-sdk/data/metric" + "github.com/newrelic/infra-integrations-sdk/v3/data/metric" "github.com/vmware/govmomi/vim25/types" ) diff --git a/internal/process/hosts.go b/internal/process/hosts.go index c12274bc..6ea39d38 100644 --- a/internal/process/hosts.go +++ b/internal/process/hosts.go @@ -9,7 +9,7 @@ import ( "github.com/newrelic/nri-vsphere/internal/config" - "github.com/newrelic/infra-integrations-sdk/data/metric" + "github.com/newrelic/infra-integrations-sdk/v3/data/metric" ) func createHostSamples(config *config.Config) { diff --git a/internal/process/process.go b/internal/process/process.go index dd1878b2..d4894fb0 100644 --- a/internal/process/process.go +++ b/internal/process/process.go @@ -7,8 +7,8 @@ import ( "strings" "sync" - "github.com/newrelic/infra-integrations-sdk/data/metric" - "github.com/newrelic/infra-integrations-sdk/integration" + "github.com/newrelic/infra-integrations-sdk/v3/data/metric" + "github.com/newrelic/infra-integrations-sdk/v3/integration" "github.com/newrelic/nri-vsphere/internal/config" logrus "github.com/sirupsen/logrus" diff --git a/internal/process/resourcepool.go b/internal/process/resourcepool.go index e87bf377..099782b9 100644 --- a/internal/process/resourcepool.go +++ b/internal/process/resourcepool.go @@ -4,7 +4,7 @@ package process import ( - "github.com/newrelic/infra-integrations-sdk/data/metric" + "github.com/newrelic/infra-integrations-sdk/v3/data/metric" "github.com/newrelic/nri-vsphere/internal/config" ) diff --git a/internal/process/snapshot.go b/internal/process/snapshot.go index 9ecc3d5a..520b7552 100644 --- a/internal/process/snapshot.go +++ b/internal/process/snapshot.go @@ -11,8 +11,8 @@ import ( "github.com/vmware/govmomi/vim25/mo" "github.com/vmware/govmomi/vim25/types" - "github.com/newrelic/infra-integrations-sdk/data/metric" - "github.com/newrelic/infra-integrations-sdk/integration" + "github.com/newrelic/infra-integrations-sdk/v3/data/metric" + "github.com/newrelic/infra-integrations-sdk/v3/integration" ) const invalidFile = -1 diff --git a/internal/process/snapshot_test.go b/internal/process/snapshot_test.go index fe962358..a52d082f 100644 --- a/internal/process/snapshot_test.go +++ b/internal/process/snapshot_test.go @@ -11,7 +11,7 @@ import ( "github.com/vmware/govmomi/vim25/mo" "github.com/vmware/govmomi/vim25/types" - "github.com/newrelic/infra-integrations-sdk/integration" + "github.com/newrelic/infra-integrations-sdk/v3/integration" "github.com/newrelic/nri-vsphere/internal/process/testdata" ) diff --git a/internal/process/vms.go b/internal/process/vms.go index 1e07f990..62cf1fb1 100644 --- a/internal/process/vms.go +++ b/internal/process/vms.go @@ -8,7 +8,7 @@ import ( "strconv" "strings" - "github.com/newrelic/infra-integrations-sdk/data/metric" + "github.com/newrelic/infra-integrations-sdk/v3/data/metric" "github.com/newrelic/nri-vsphere/internal/config" ) diff --git a/internal/process/vms_test.go b/internal/process/vms_test.go index 0d6ce2e5..91309c9c 100644 --- a/internal/process/vms_test.go +++ b/internal/process/vms_test.go @@ -2,7 +2,7 @@ package process import ( "context" - "github.com/newrelic/infra-integrations-sdk/integration" + "github.com/newrelic/infra-integrations-sdk/v3/integration" "github.com/newrelic/nri-vsphere/internal/client" "github.com/newrelic/nri-vsphere/internal/collect" "github.com/newrelic/nri-vsphere/internal/config" From 18216f48fc4a8d3b3ffa5a9dce4cea131107fa9a Mon Sep 17 00:00:00 2001 From: Juan Manuel Perez Date: Wed, 2 Oct 2024 16:35:01 +0200 Subject: [PATCH 2/7] add entry to changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4600ca84..7f566533 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ Unreleased section should follow [Release Toolkit](https://github.com/newrelic/r ## Unreleased +### enhancements + +- Upgrade integrations SDK so the interval is variable and allows intervals up to 5 minutes + ## v1.5.4 - 2024-09-12 ### ⛓️ Dependencies From ff9dc89abd408579caebc20d77027eedbbc06852 Mon Sep 17 00:00:00 2001 From: Juan Manuel Perez Date: Wed, 2 Oct 2024 17:08:56 +0200 Subject: [PATCH 3/7] goimports --- internal/process/vms_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/process/vms_test.go b/internal/process/vms_test.go index 91309c9c..097d075f 100644 --- a/internal/process/vms_test.go +++ b/internal/process/vms_test.go @@ -2,6 +2,8 @@ package process import ( "context" + "testing" + "github.com/newrelic/infra-integrations-sdk/v3/integration" "github.com/newrelic/nri-vsphere/internal/client" "github.com/newrelic/nri-vsphere/internal/collect" @@ -13,7 +15,6 @@ import ( "github.com/vmware/govmomi/view" "github.com/vmware/govmomi/vim25" "github.com/vmware/govmomi/vim25/mo" - "testing" ) func Test_createVirtualMachineSamples_HasIpAddresses(t *testing.T) { From 0471716e9ea95e28732372e5327cf9635fc63e4a Mon Sep 17 00:00:00 2001 From: Juan Manuel Perez Date: Wed, 2 Oct 2024 17:18:35 +0200 Subject: [PATCH 4/7] go mod tidy --- go.mod | 1 - go.sum | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index b731e9a1..e7c64822 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,6 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect diff --git a/go.sum b/go.sum index 361b4a68..a426913c 100644 --- a/go.sum +++ b/go.sum @@ -2,16 +2,15 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/newrelic/infra-integrations-sdk v3.8.2+incompatible h1:Ktcm1aPAl7CW3o+FXAIKJ+jygWVXDXaUIWFyf2CXQTk= -github.com/newrelic/infra-integrations-sdk v3.8.2+incompatible/go.mod h1:tMUHRMq6mJS0YyBnbWrTXAnREnQqC1AGO6Lu45u5xAM= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/newrelic/infra-integrations-sdk/v3 v3.9.1 h1:dCtVLsYNHWTQ5aAlAaHroomOUlqxlGTrdi6XTlvBDfI= github.com/newrelic/infra-integrations-sdk/v3 v3.9.1/go.mod h1:yPeidhcq9Cla0QDquGXH0KqvS2k9xtetFOD7aLA0Z8M= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= @@ -36,6 +35,7 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9w golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From 92a51cf4319fb6102ad36225f3aca53f2c321e0f Mon Sep 17 00:00:00 2001 From: Juan Manuel Perez Date: Thu, 3 Oct 2024 09:50:00 +0200 Subject: [PATCH 5/7] go upgrade to 1.23.2 --- build/Dockerfile | 2 +- go.mod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/Dockerfile b/build/Dockerfile index c69161fe..906e0cda 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.23.1-bookworm +FROM golang:1.23.2-bookworm ARG GH_VERSION='2.4.0' diff --git a/go.mod b/go.mod index e7c64822..290d526c 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/newrelic/nri-vsphere -go 1.23.1 +go 1.23.2 require ( github.com/newrelic/infra-integrations-sdk/v3 v3.9.1 From 58886af97897b90bf66bb34b3c194c9575d9d451 Mon Sep 17 00:00:00 2001 From: Juan Manuel Perez Date: Thu, 3 Oct 2024 10:30:14 +0200 Subject: [PATCH 6/7] remove old build comment --- integration-test/integration_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/integration-test/integration_test.go b/integration-test/integration_test.go index 3523a0c0..955f64d8 100644 --- a/integration-test/integration_test.go +++ b/integration-test/integration_test.go @@ -1,4 +1,4 @@ -// +build integration +//go:build integration /* * Copyright 2020 New Relic Corporation. All rights reserved. @@ -27,7 +27,7 @@ import ( "github.com/vmware/govmomi/vim25" ) -//This can set whn running the test as -ldflags "-X github.com/newrelic/nri-winservices/test.integrationPath=" +// This can set when running the test as -ldflags "-X github.com/newrelic/nri-winservices/test.integrationPath=" var ( integrationPath = "../bin/nri-vsphere" ) From e7e1fb3631bf81170907c01e7b26f9bb5b9477f2 Mon Sep 17 00:00:00 2001 From: Juan Manuel Perez Date: Thu, 3 Oct 2024 10:56:43 +0200 Subject: [PATCH 7/7] add entry to changelog for go 1.22.3 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f566533..fa5a02d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ Unreleased section should follow [Release Toolkit](https://github.com/newrelic/r ## Unreleased +### dependency + +- Upgrade go to 1.23.2 + ### enhancements - Upgrade integrations SDK so the interval is variable and allows intervals up to 5 minutes