You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When Exporter works with mongodb + Authentication, when Unauthorizes, it dose not renew session to mongodb and keep error about authentcation
This issue happens sometime - not always - timing issue
When exporter is running before the mongodb
See many Unauthorized errors like: level=error msg="cannot decode getCmdLineOtpions: cannot execute getCmdLineOpts command: (Unauthorized) Command getCmdLineOpts requires authentication"
Expected behavior
When exporter is run with wrong credential is exited
I expect that the exporter will initiate it's session to mongo in case one of it's collector error with authentication
or at least exit
Additional context
I would offer to add some logic at each collector something like
res := client.Database("admin").RunCommand(d.ctx, cmd)
var r primitive.M
if err := res.Decode(&r); err != nil {
if e, ok := err.(mongo.CommandError); ok {
if e.Code == Unauthorized { // Unauthorized = 13
logger.Errorf("unauthorized to run currtop: %s", err)
os.Exit(1)
// Can handle with reinitiate the connection as well
}
}
}
The text was updated successfully, but these errors were encountered:
Describe the bug
When Exporter works with mongodb + Authentication, when Unauthorizes, it dose not renew session to mongodb and keep error about authentcation
To Reproduce
Steps to reproduce the behavior:
When exporter is running before the mongodb
See many Unauthorized errors like:
level=error msg="cannot decode getCmdLineOtpions: cannot execute getCmdLineOpts command: (Unauthorized) Command getCmdLineOpts requires authentication"
Expected behavior
When exporter is run with wrong credential is exited
I expect that the exporter will initiate it's session to mongo in case one of it's collector error with authentication
or at least exit
Logs
level=error msg="cannot decode getCmdLineOtpions: cannot execute getCmdLineOpts command: (Unauthorized) Command getCmdLineOpts requires authentication"
Environment
Additional context
I would offer to add some logic at each collector something like
The text was updated successfully, but these errors were encountered: