Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* [FEATURE] Add `tls.insecure-skip-verify` flag to ignore tls verification errors (PR #417) #348
* [FEATURE] Add new metrics to `replication_group_member_stats` collector to support MySQL 8.x.
* [FEATURE] Add collector for `replication_group_members` (PR #459) #362
* [BUGFIX] Fixed output value of wsrep_cluster_status #473

### BREAKING CHANGES:

Expand Down
5 changes: 3 additions & 2 deletions collector/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"database/sql"
"regexp"
"strconv"
"strings"

"github.com/prometheus/client_golang/prometheus"
)
Expand Down Expand Up @@ -52,11 +53,11 @@ func parseStatus(data sql.RawBytes) (float64, bool) {
if bytes.Equal(data, []byte("Connecting")) {
return 0, true
}
// SHOW GLOBAL STATUS like 'wsrep_cluster_status' can return "Primary" or "Non-Primary"/"Disconnected"
// SHOW GLOBAL STATUS like 'wsrep_cluster_status' can return "Primary" or "non-Primary"/"Disconnected"
if bytes.Equal(data, []byte("Primary")) {
return 1, true
}
if bytes.Equal(data, []byte("Non-Primary")) || bytes.Equal(data, []byte("Disconnected")) {
if strings.EqualFold(string(data), "non-Primary") || bytes.Equal(data, []byte("Disconnected")) {
return 0, true
}
if logNum := logRE.Find(data); logNum != nil {
Expand Down