-
Notifications
You must be signed in to change notification settings - Fork 446
Open
Description
Describe the bug
In 4.0.6 and earlier, you could use $not operator with regular expression objects (i.e. /pattern/) but not with $regex operator expressions.
https://www.mongodb.com/docs/v6.0/reference/operator/query/regex/
To Reproduce
Steps to reproduce the behavior:
- ./mongodb_exporter --collector.currentopmetrics-slow-time
curl ip:port/metrics
- watch the console logs
Expected behavior
no error outputs
Logs
time=2025-08-04T07:40:30.170Z level=ERROR source=currentop_collector.go:94 msg="Failed to decode currentOp response" collector=currentop error="(BadValue) $not cannot have a regex"
2025/08/04 15:40:30 http: panic serving 1.1.1.1:36335: descriptor Desc{fqName: "", help: "", constLabels: {}, variableLabels: {}} is invalid: (BadValue) $not cannot have a regex
goroutine 32 [running]:
net/http.(*conn).serve.func1()
/usr/local/go/src/net/http/server.go:1947 +0xbe
panic({0xdfaa80?, 0xc00058e080?})
/usr/local/go/src/runtime/panic.go:792 +0x132
github.com/prometheus/client_golang/prometheus.(*Registry).MustRegister(...)
/Users/zhangruizhi/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:406
github.com/percona/mongodb_exporter/exporter.(*Exporter).makeRegistry(0xc00021ef60, {0x1171530, 0xc0004302a0}, 0xc00071c0f0, {0x116d568, 0xc00052aa20}, {0x1, 0x1, 0x1388, 0x0, ...})
/Users/zhangruizhi/Github/mongodb_exporter/exporter/exporter.go:224 +0xfce
github.com/percona/mongodb_exporter/exporter.RunWebServer.(*Exporter).Handler.func2({0x11708b0, 0xc0007180e0}, 0xc0001de000)
/Users/zhangruizhi/Github/mongodb_exporter/exporter/exporter.go:363 +0x4e9
net/http.HandlerFunc.ServeHTTP(0xc0000fc180?, {0x11708b0?, 0xc0007180e0?}, 0x822d16?)
/usr/local/go/src/net/http/server.go:2294 +0x29
net/http.(*ServeMux).ServeHTTP(0x475a59?, {0x11708b0, 0xc0007180e0}, 0xc0001de000)
/usr/local/go/src/net/http/server.go:2822 +0x1c4
net/http.serverHandler.ServeHTTP({0xc0004be660?}, {0x11708b0?, 0xc0007180e0?}, 0x1?)
/usr/local/go/src/net/http/server.go:3301 +0x8e
net/http.(*conn).serve(0xc00053e090, {0x1171488, 0xc00021f350})
/usr/local/go/src/net/http/server.go:2102 +0x625
created by net/http.(*Server).Serve in goroutine 71
/usr/local/go/src/net/http/server.go:3454 +0x485
Environment
- OS, debian11
- environment metal server
- MongoDB version v3.6.9
Additional context
Add any other context about the problem here.