Skip to content
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
6 changes: 4 additions & 2 deletions cmd/configschema/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
// See https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/30187
module github.com/open-telemetry/opentelemetry-collector-contrib/cmd/configschema

go 1.21.0
go 1.21.3

toolchain go1.22.0

require (
github.com/fatih/structtag v1.2.0
Expand Down Expand Up @@ -466,7 +468,7 @@ require (
github.com/mtibben/percent v0.2.1 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
github.com/nginxinc/nginx-prometheus-exporter v0.11.0 // indirect
github.com/nginxinc/nginx-prometheus-exporter v1.0.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/connector/countconnector v0.98.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/connector/datadogconnector v0.98.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/connector/exceptionsconnector v0.98.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions cmd/configschema/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions cmd/otelcontribcol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

module github.com/open-telemetry/opentelemetry-collector-contrib/cmd/otelcontribcol

go 1.21.0
go 1.21.3

toolchain go1.21.9
toolchain go1.22.0

require (
github.com/open-telemetry/opentelemetry-collector-contrib/connector/countconnector v0.98.0
Expand Down Expand Up @@ -528,7 +528,7 @@ require (
github.com/mtibben/percent v0.2.1 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
github.com/nginxinc/nginx-prometheus-exporter v0.11.0 // indirect
github.com/nginxinc/nginx-prometheus-exporter v1.0.0 // indirect
github.com/oklog/ulid/v2 v2.1.0 // indirect
github.com/open-telemetry/opamp-go v0.14.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/extension/encoding v0.98.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions cmd/otelcontribcol/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module github.com/open-telemetry/opentelemetry-collector-contrib

go 1.21.0
go 1.21.3

toolchain go1.22.0

require (
github.com/open-telemetry/opentelemetry-collector-contrib/connector/countconnector v0.98.0
Expand Down Expand Up @@ -488,7 +490,7 @@ require (
github.com/mtibben/percent v0.2.1 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
github.com/nginxinc/nginx-prometheus-exporter v0.11.0 // indirect
github.com/nginxinc/nginx-prometheus-exporter v1.0.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/extension/ackextension v0.98.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/extension/observer v0.98.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/extension/sumologicextension v0.98.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions receiver/nginxreceiver/go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
module github.com/open-telemetry/opentelemetry-collector-contrib/receiver/nginxreceiver

go 1.21.0
go 1.21.3

toolchain go1.22.0

require (
github.com/google/go-cmp v0.6.0
github.com/nginxinc/nginx-prometheus-exporter v0.11.0
github.com/nginxinc/nginx-prometheus-exporter v1.0.0
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.98.0
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden v0.98.0
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest v0.98.0
Expand Down
4 changes: 2 additions & 2 deletions receiver/nginxreceiver/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 2 additions & 16 deletions receiver/nginxreceiver/scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package nginxreceiver // import "github.com/open-telemetry/opentelemetry-collect

import (
"context"
"net/http"
"time"

"github.com/nginxinc/nginx-prometheus-exporter/client"
Expand All @@ -19,9 +18,7 @@ import (
)

type nginxScraper struct {
httpClient *http.Client
client *client.NginxClient

client *client.NginxClient
settings component.TelemetrySettings
cfg *Config
mb *metadata.MetricsBuilder
Expand All @@ -44,22 +41,11 @@ func (r *nginxScraper) start(ctx context.Context, host component.Host) error {
if err != nil {
return err
}
r.httpClient = httpClient

r.client = client.NewNginxClient(httpClient, r.cfg.ClientConfig.Endpoint)
return nil
}

func (r *nginxScraper) scrape(context.Context) (pmetric.Metrics, error) {
// Init client in scrape method in case there are transient errors in the constructor.
if r.client == nil {
var err error
r.client, err = client.NewNginxClient(r.httpClient, r.cfg.ClientConfig.Endpoint)
if err != nil {
r.client = nil
return pmetric.Metrics{}, err
}
}

stats, err := r.client.GetStubStats()
if err != nil {
r.settings.Logger.Error("Failed to fetch nginx stats", zap.Error(err))
Expand Down