Skip to content

Fix panic when updating NGINX config and fix remotely enabling/disabling the metrics feature #1013

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

Closed
wants to merge 37 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
6e3dc83
fix: fixing panic when updating config concurrently
bejjrajesh Mar 19, 2025
a097938
fix: adding nil check
bejjrajesh Mar 19, 2025
7d743bd
fix: adding nil check
bejjrajesh Mar 20, 2025
cfd35a2
fix: making toggle true once agent connected
bejjrajesh Apr 9, 2025
d455735
fix: adding debug log for metricsSender readyToSend Status
bejjrajesh Apr 9, 2025
c7dbfb5
fix: updating with main
bejjrajesh Apr 11, 2025
4b8fd54
fix: debugging
bejjrajesh Apr 11, 2025
0928fc0
fix: debugging
bejjrajesh Apr 11, 2025
779ef6c
fix: updating config reader features when on disk config changed
bejjrajesh Apr 11, 2025
fd17a92
fix: updating readyToSend when config changed
bejjrajesh Apr 12, 2025
dbee456
fix: updating readyToSend when config changed
bejjrajesh Apr 14, 2025
92f037b
fix: updating readyToSend when config changed
bejjrajesh Apr 15, 2025
f65680f
fix: adding conf to metrics sender
bejjrajesh Apr 16, 2025
5adfeac
fix: removing debug logs
bejjrajesh Apr 17, 2025
9c9f838
fix: fixing import issue
bejjrajesh Apr 17, 2025
a8dcf7b
Add nil pointer check to GenerateMetricsReportBundle (#1047)
dhurley Apr 16, 2025
fcb499e
Update net and nats dependencies (#1070)
dhurley May 1, 2025
1ec3554
fix: updating with main
bejjrajesh May 7, 2025
68eca9f
fix: running go deps
bejjrajesh May 7, 2025
468e6cc
fix: updating go.sum
bejjrajesh May 7, 2025
1dd35f0
fix: fixing test failures
bejjrajesh May 7, 2025
c299b17
fix: updating vendor folders
bejjrajesh May 7, 2025
2b35964
fix: updating go.sum
bejjrajesh May 7, 2025
16bb285
fix: fixing conflict
bejjrajesh May 7, 2025
106bc87
fix: fixing minor bug
bejjrajesh May 8, 2025
a9725c7
fix: fixing imports
bejjrajesh May 8, 2025
7892d7e
fix: updating default features
bejjrajesh May 9, 2025
c922b0f
fix: updating default features
bejjrajesh May 10, 2025
21d2a0c
fix: adding debug log
bejjrajesh May 10, 2025
9a8dfac
fix: removing lock when de-registering
bejjrajesh May 10, 2025
8573d86
fix: removing lock when de-registering
bejjrajesh May 10, 2025
4832ba4
fix: fixing compile issue
bejjrajesh May 10, 2025
49b2173
fix: fixing compile issue
bejjrajesh May 10, 2025
0837ab5
fix: fixing metrics-sender not initializing issue
bejjrajesh May 11, 2025
691d54b
fix: adding debug log
bejjrajesh May 11, 2025
f4fb5d0
fix: adding debug logs
bejjrajesh May 11, 2025
e06e490
fix: adding metrics sender issue
bejjrajesh May 11, 2025
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
Prev Previous commit
Next Next commit
fix: updating with main
  • Loading branch information
bejjrajesh committed May 7, 2025
commit 1ec355483aade29d86d4a17589d478e1c556506c
5 changes: 0 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,11 @@ github.com/maxbrunsfeld/counterfeiter/v6 v6.8.1/go.mod h1:eyp4DdUJAKkr9tvxR3jWhw
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/nginxinc/nginx-go-crossplane v0.4.48 h1:Cf8sn8dTLJevtvNjGsla/wwa+rPTjm8eTfwSMqWisoI=
github.com/nginxinc/nginx-go-crossplane v0.4.48/go.mod h1:fgSibLM12jGRsh7QHpgL8wTKMEbfc594vSLK9ovwM6U=
github.com/nginxinc/nginx-plus-go-client/v2 v2.0.1 h1:5VVK38bnELMDWnwfF6dSv57ResXh9AUzeDa72ENj94o=
github.com/nginxinc/nginx-plus-go-client/v2 v2.0.1/go.mod h1:He+1izxYxVVO5/C9ZTukwOpvkAx5eS19nRQgKXDhX5I=
github.com/nginxinc/nginx-prometheus-exporter v1.2.0 h1:jmu63tEm3hcupIpaIH72NEdwuNgGaQ/9q0IrnNqaPto=
github.com/nginxinc/nginx-prometheus-exporter v1.2.0/go.mod h1:y8KANg4+7e/9HxT3vZDetjETLR5YhU0zv2WhZquo7C0=
github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY=
github.com/nxadm/tail v1.4.11/go.mod h1:OTaG3NK980DZzxbRq6lEuzgU+mug70nY11sMd4JXXHc=
github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk=
Expand All @@ -99,12 +97,9 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH
github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b h1:0LFwY6Q3gMACTjAbMZBjXAqTOzOwFaj2Ld6cjeQ7Rig=
github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE=
github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc=
github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8=
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
Expand Down
2 changes: 0 additions & 2 deletions go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3184,7 +3184,6 @@ github.com/klauspost/compress v1.16.5/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQs
github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
github.com/klauspost/compress v1.17.2/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
github.com/klauspost/cpuid v0.0.0-20180405133222-e7e905edc00e/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
github.com/klauspost/cpuid v1.2.0 h1:NMpwD2G9JSFOE1/TJjGSo5zG7Yb2bTe7eq1jH+irmeE=
github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
Expand Down Expand Up @@ -3427,7 +3426,6 @@ github.com/nats-io/nats.go v1.27.0/go.mod h1:XpbWUlOElGwTYbMR7imivs7jJj9GtK7ypv3
github.com/nats-io/nats.go v1.30.2 h1:aloM0TGpPorZKQhbAkdCzYDj+ZmsJDyeo3Gkbr72NuY=
github.com/nats-io/nats.go v1.30.2/go.mod h1:dcfhUgmQNN4GJEfIb2f9R7Fow+gzBF4emzDHrVBd5qM=
github.com/nats-io/nkeys v0.4.4/go.mod h1:XUkxdLPTufzlihbamfzQ7mw/VGx6ObUs+0bN5sNvt64=
github.com/nats-io/nkeys v0.4.9/go.mod h1:jcMqs+FLG+W5YO36OX6wFIFcmpdAns+w1Wm6D3I/evE=
github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d/go.mod h1:o96djdrsSGy3AWPyBgZMAGfxZNfgntdJG+11KU4QvbU=
github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354/go.mod h1:KSVJerMDfblTH7p5MZaTt+8zaT2iEk3AkVb9PQdZuE8=
github.com/ncw/swift v1.0.47 h1:4DQRPj35Y41WogBxyhOXlrI37nzGlyEcsforeudyYPQ=
Expand Down
5 changes: 3 additions & 2 deletions src/plugins/metrics_sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ package plugins

import (
"context"
"github.com/nginx/agent/sdk/v2"
agent_config "github.com/nginx/agent/sdk/v2/agent/config"
"github.com/nginx/agent/sdk/v2/client"
"github.com/nginx/agent/sdk/v2/proto"
Expand Down Expand Up @@ -83,11 +82,13 @@ func (r *MetricsSender) Process(msg *core.Message) {
return
}
for _, p := range payloads {
r.readyToSendMu.RLock()
if !r.readyToSend.Load() {
log.Debugf("metrics_sender is not ready to send the metrics")
r.readyToSendMu.RUnlock()
continue
}

r.readyToSendMu.Unlock()
switch report := p.(type) {
case *proto.MetricsReport:
message := client.MessageFromMetrics(report)
Expand Down

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

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

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

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

8 changes: 8 additions & 0 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ github.com/nginxinc/nginx-go-crossplane
# github.com/nginxinc/nginx-plus-go-client/v2 v2.0.1
## explicit; go 1.22.6
github.com/nginxinc/nginx-plus-go-client/v2/client
# github.com/nginxinc/nginx-prometheus-exporter v1.1.2
## explicit; go 1.21.3
# github.com/nginxinc/nginx-prometheus-exporter v1.2.0
## explicit; go 1.21.3
github.com/nginxinc/nginx-prometheus-exporter/client
Expand Down Expand Up @@ -295,15 +297,21 @@ github.com/pmezard/go-difflib/difflib
# github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b
## explicit; go 1.14
github.com/power-devops/perfstat
# github.com/prometheus/client_golang v1.19.0
## explicit; go 1.20
# github.com/prometheus/client_golang v1.19.1
## explicit; go 1.20
github.com/prometheus/client_golang/prometheus
github.com/prometheus/client_golang/prometheus/internal
github.com/prometheus/client_golang/prometheus/promauto
github.com/prometheus/client_golang/prometheus/promhttp
# github.com/prometheus/client_model v0.6.0
## explicit; go 1.19
# github.com/prometheus/client_model v0.6.1
## explicit; go 1.19
github.com/prometheus/client_model/go
# github.com/prometheus/common v0.49.0
## explicit; go 1.20
# github.com/prometheus/common v0.55.0
## explicit; go 1.20
github.com/prometheus/common/expfmt
Expand Down