fix go.d rspamd unexpected response check (#17974)
Ilya Mashchenko committed
Jun 20, 2024 at 20:14 UTC
88fe280f226d677bb1704a9b701d2ed2f8d358bc
1 file changed
+3
-3
src/go/collectors/go.d.plugin/modules/rspamd/collect.go
+3
-3
@@ -15,8 +15,8 @@ import (
15
type rspamdStats struct {
16
Version string `json:"version"`
17
ConfigId string `json:"config_id"`
18
- Scanned int64 `json:"scanned" stm:"scanned"`
19
- Learned int64 `json:"learned" stm:"learned"`
18
+ Scanned *int64 `json:"scanned" stm:"scanned"`
19
+ Learned *int64 `json:"learned" stm:"learned"`
20
Actions struct {
21
Reject int64 `json:"reject" stm:"reject"`
22
SoftReject int64 `json:"soft reject" stm:"soft_reject"`
@@ -62,7 +62,7 @@ func (r *Rspamd) queryRspamdStats() (*rspamdStats, error) {
62
return nil, err
63
}
64
65
- if stats.Version == "" || stats.ConfigId == "" || len(stats.FuzzyHashes) == 0 {
65
+ if stats.Scanned == nil || stats.Learned == nil {
66
return nil, fmt.Errorf("unexpected response: not rspamd data")
67
}
68