Skip to content
Open
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
7 changes: 5 additions & 2 deletions collector/perf_schema_replication_group_members.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (ScrapePerfReplicationGroupMembers) Scrape(ctx context.Context, db *sql.DB,
for i := range scanArgs {
scanArgs[i] = &sql.RawBytes{}
}

memberStateValue := float64(0)
for perfReplicationGroupMembersRows.Next() {
if err := perfReplicationGroupMembersRows.Scan(scanArgs...); err != nil {
return err
Expand All @@ -71,6 +71,9 @@ func (ScrapePerfReplicationGroupMembers) Scrape(ctx context.Context, db *sql.DB,
for i, columnName := range columnNames {
labelNames[i] = strings.ToLower(columnName)
values[i] = string(*scanArgs[i].(*sql.RawBytes))
if labelNames[i] == "member_state" && values[i] == "ONLINE" {
memberStateValue = 1
}
}

var performanceSchemaReplicationGroupMembersMemberDesc = prometheus.NewDesc(
Expand All @@ -82,7 +85,7 @@ func (ScrapePerfReplicationGroupMembers) Scrape(ctx context.Context, db *sql.DB,
)

ch <- prometheus.MustNewConstMetric(performanceSchemaReplicationGroupMembersMemberDesc,
prometheus.GaugeValue, 1, values...)
prometheus.GaugeValue, memberStateValue, values...)
}
return nil

Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.