diff --git a/CHANGELOG.md b/CHANGELOG.md index f6ae457..25d145b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,14 @@ 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 + ## v3.4.10 - 2024-09-18 ### ⛓️ Dependencies diff --git a/build/Dockerfile b/build/Dockerfile index a1ec8a7..fc3651d 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='1.9.2' diff --git a/go.mod b/go.mod index 3c10c5a..e5ed2d5 100644 --- a/go.mod +++ b/go.mod @@ -1,10 +1,10 @@ module github.com/newrelic/nri-nginx -go 1.23.1 +go 1.23.2 require ( github.com/jeremywohl/flatten v1.0.1 - github.com/newrelic/infra-integrations-sdk v3.8.2+incompatible + github.com/newrelic/infra-integrations-sdk/v3 v3.9.1 github.com/pkg/errors v0.9.1 github.com/stretchr/testify v1.9.0 github.com/xeipuuv/gojsonschema v1.2.0 diff --git a/go.sum b/go.sum index b2ebee9..86bdcde 100644 --- a/go.sum +++ b/go.sum @@ -3,20 +3,14 @@ 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/jeremywohl/flatten v1.0.1 h1:LrsxmB3hfwJuE+ptGOijix1PIfOoKLJ3Uee/mzbgtrs= github.com/jeremywohl/flatten v1.0.1/go.mod h1:4AmD/VxjWcI5SRB0n6szE2A6s2fsNHDLO0nAlMHgfLQ= -github.com/newrelic/infra-integrations-sdk v3.7.3+incompatible h1:+o/MxTzFsC3BRVKpkw1pXer9Nja2mxWNbV9GfH7iKBc= -github.com/newrelic/infra-integrations-sdk v3.7.3+incompatible/go.mod h1:tMUHRMq6mJS0YyBnbWrTXAnREnQqC1AGO6Lu45u5xAM= -github.com/newrelic/infra-integrations-sdk v3.8.0+incompatible h1:QvwHLsgHyGw4ZULOSnnWQnVPE744K1eda+2XLp2eHtg= -github.com/newrelic/infra-integrations-sdk v3.8.0+incompatible/go.mod h1:tMUHRMq6mJS0YyBnbWrTXAnREnQqC1AGO6Lu45u5xAM= -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= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c= @@ -25,16 +19,6 @@ github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHo github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= -golang.org/x/tools v0.9.3 h1:Gn1I8+64MsuTb/HpH+LmQtNas23LhUVr3rYZ0eKuaMM= -golang.org/x/tools v0.9.3/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= -golang.org/x/tools v0.11.0 h1:EMCa6U9S2LtZXLAMoWiR/R8dAQFRqbAitmbJ2UKhoi8= -golang.org/x/tools v0.11.0/go.mod h1:anzJrxPjNtfgiYQYirP2CPGzGLxrH2u2QBhn6Bf3qY8= -golang.org/x/tools v0.11.1 h1:ojD5zOW8+7dOGzdnNgersm8aPfcDjhMp12UfG93NIMc= -golang.org/x/tools v0.11.1/go.mod h1:anzJrxPjNtfgiYQYirP2CPGzGLxrH2u2QBhn6Bf3qY8= -golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= -golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= -golang.org/x/tools v0.21.0 h1:qc0xYgIbsSDt9EyWz05J5wfa7LOVW0YTLOXrqdLAWIw= -golang.org/x/tools v0.21.0/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= diff --git a/src/inventory.go b/src/inventory.go index f7bbc34..82cdc36 100644 --- a/src/inventory.go +++ b/src/inventory.go @@ -7,7 +7,7 @@ import ( "os" "strings" - "github.com/newrelic/infra-integrations-sdk/data/inventory" + "github.com/newrelic/infra-integrations-sdk/v3/data/inventory" "github.com/pkg/errors" ) diff --git a/src/inventory_test.go b/src/inventory_test.go index e1ecf8a..4bc1a3b 100644 --- a/src/inventory_test.go +++ b/src/inventory_test.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - "github.com/newrelic/infra-integrations-sdk/data/inventory" + "github.com/newrelic/infra-integrations-sdk/v3/data/inventory" "github.com/stretchr/testify/require" ) diff --git a/src/metrics.go b/src/metrics.go index 275bde6..54950cc 100644 --- a/src/metrics.go +++ b/src/metrics.go @@ -15,8 +15,8 @@ import ( "time" "github.com/jeremywohl/flatten" - "github.com/newrelic/infra-integrations-sdk/data/metric" - "github.com/newrelic/infra-integrations-sdk/log" + "github.com/newrelic/infra-integrations-sdk/v3/data/metric" + "github.com/newrelic/infra-integrations-sdk/v3/log" "github.com/pkg/errors" ) diff --git a/src/metrics_test.go b/src/metrics_test.go index f9b8012..63b87c8 100644 --- a/src/metrics_test.go +++ b/src/metrics_test.go @@ -3,17 +3,18 @@ package main import ( "bufio" "fmt" - "github.com/newrelic/infra-integrations-sdk/data/attribute" - "github.com/newrelic/infra-integrations-sdk/integration" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "golang.org/x/tools/go/ssa/interp/testdata/src/errors" "io" "net/http" "net/http/httptest" "net/url" "strings" "testing" + + "github.com/newrelic/infra-integrations-sdk/v3/data/attribute" + "github.com/newrelic/infra-integrations-sdk/v3/integration" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "golang.org/x/tools/go/ssa/interp/testdata/src/errors" ) var testNginxStandardStatus = `Active connections: 291 diff --git a/src/nginx.go b/src/nginx.go index 7a4a865..ff4c1b5 100644 --- a/src/nginx.go +++ b/src/nginx.go @@ -7,12 +7,11 @@ import ( "os" "runtime" - sdk_args "github.com/newrelic/infra-integrations-sdk/args" - "github.com/newrelic/infra-integrations-sdk/data/attribute" - "github.com/newrelic/infra-integrations-sdk/data/metric" - "github.com/newrelic/infra-integrations-sdk/integration" - "github.com/newrelic/infra-integrations-sdk/log" - "github.com/newrelic/infra-integrations-sdk/persist" + sdk_args "github.com/newrelic/infra-integrations-sdk/v3/args" + "github.com/newrelic/infra-integrations-sdk/v3/data/attribute" + "github.com/newrelic/infra-integrations-sdk/v3/data/metric" + "github.com/newrelic/infra-integrations-sdk/v3/integration" + "github.com/newrelic/infra-integrations-sdk/v3/log" "github.com/pkg/errors" ) @@ -52,7 +51,7 @@ var ( ) func main() { - i, err := createIntegration() + i, err := integration.New(integrationName, integrationVersion, integration.Args(&args)) fatalIfErr(err) if args.ShowVersion { @@ -112,21 +111,6 @@ func metricSet(e *integration.Entity, eventType string, remote bool) *metric.Set ) } -func createIntegration() (*integration.Integration, error) { - cachePath := os.Getenv("NRIA_CACHE_PATH") - if cachePath == "" { - return integration.New(integrationName, integrationVersion, integration.Args(&args)) - } - - l := log.NewStdErr(args.Verbose) - s, err := persist.NewFileStore(cachePath, l, persist.DefaultTTL) - if err != nil { - return nil, err - } - - return integration.New(integrationName, integrationVersion, integration.Args(&args), integration.Storer(s), integration.Logger(l)) -} - // parseStatusURL will extract the hostname and the port from the nginx status URL. func parseStatusURL(statusURL string) (hostname, port string, err error) { u, err := url.Parse(statusURL) diff --git a/src/nginx_test.go b/src/nginx_test.go index 8f240c3..4aee742 100644 --- a/src/nginx_test.go +++ b/src/nginx_test.go @@ -1,10 +1,11 @@ package main import ( - "github.com/newrelic/infra-integrations-sdk/integration" - "github.com/stretchr/testify/assert" "strings" "testing" + + "github.com/newrelic/infra-integrations-sdk/v3/integration" + "github.com/stretchr/testify/assert" ) func TestEntityLocal(t *testing.T) { diff --git a/tests/integration/Dockerfile b/tests/integration/Dockerfile index 9189f87..40390a8 100644 --- a/tests/integration/Dockerfile +++ b/tests/integration/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.23.1-bookworm as builder +FROM golang:1.23.2-bookworm as builder ARG CGO_ENABLED=0 WORKDIR /go/src/github.com/newrelic/nri-nginx COPY . . diff --git a/tests/integration/helpers/helpers.go b/tests/integration/helpers/helpers.go index 768cd83..1fcc739 100644 --- a/tests/integration/helpers/helpers.go +++ b/tests/integration/helpers/helpers.go @@ -2,9 +2,10 @@ package helpers import ( "bytes" - "github.com/newrelic/infra-integrations-sdk/log" "os/exec" "strings" + + "github.com/newrelic/infra-integrations-sdk/v3/log" ) // ExecInContainer executes the given command inside the specified container. It returns three values: diff --git a/tests/integration/nginx_test.go b/tests/integration/nginx_test.go index 27df4a2..d54f17e 100644 --- a/tests/integration/nginx_test.go +++ b/tests/integration/nginx_test.go @@ -1,19 +1,20 @@ -// +build integration +//go:build integration package integration import ( "flag" "fmt" - "github.com/newrelic/infra-integrations-sdk/log" - "github.com/newrelic/nri-nginx/tests/integration/helpers" - "github.com/newrelic/nri-nginx/tests/integration/jsonschema" - "github.com/stretchr/testify/assert" "os" "path/filepath" "regexp" "strings" "testing" + + "github.com/newrelic/infra-integrations-sdk/v3/log" + "github.com/newrelic/nri-nginx/tests/integration/helpers" + "github.com/newrelic/nri-nginx/tests/integration/jsonschema" + "github.com/stretchr/testify/assert" ) var (