Skip to content

Commit ac7f667

Browse files
authored
cmd/scollector: fix DisableSelf flag not working for version and post.batchsize metrics (bosun-monitor#1868)
1 parent 7f58630 commit ac7f667

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

cmd/scollector/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ func main() {
220220
if err := collect.InitChan(u, "scollector", cdp); err != nil {
221221
slog.Fatal(err)
222222
}
223-
if version.VersionDate != "" {
223+
if collect.DisableDefaultCollectors == false && version.VersionDate != "" {
224224
v, err := strconv.ParseInt(version.VersionDate, 10, 64)
225225
if err == nil {
226226
go func() {

collect/queue.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ func send() {
7878
slog.Infof("sending: %d, remaining: %d", i, len(queue))
7979
}
8080
qlock.Unlock()
81-
Sample("collect.post.batchsize", Tags, float64(len(sending)))
81+
if DisableDefaultCollectors == false {
82+
Sample("collect.post.batchsize", Tags, float64(len(sending)))
83+
}
8284
sendBatch(sending)
8385
} else {
8486
qlock.Unlock()

0 commit comments

Comments
 (0)