-
Notifications
You must be signed in to change notification settings - Fork 938
Add sentinel_peer_info metric for Sentinel peer discovery #1097
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
8b17465
9500fe5
b22b114
70e9972
5a30ebc
7c83dcc
e69d576
0d1b9b4
f710954
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -144,6 +144,12 @@ func (e *Exporter) processSentinelSentinels(ch chan<- prometheus.Metric, sentine | |
|
|
||
| // If we are here then this master is in ok state | ||
| masterOkSentinels := 1 | ||
| masterName := "" | ||
| masterAddr := "" | ||
| if len(labels) >= 2 { | ||
|
||
| masterName = labels[0] | ||
| masterAddr = labels[1] | ||
| } | ||
|
|
||
| for _, sentinelDetail := range sentinelDetails { | ||
| sentinelDetailMap, err := redis.StringMap(sentinelDetail, nil) | ||
|
|
@@ -152,6 +158,30 @@ func (e *Exporter) processSentinelSentinels(ch chan<- prometheus.Metric, sentine | |
| continue | ||
| } | ||
|
|
||
| name := "" | ||
| if v, ok := sentinelDetailMap["name"]; ok { | ||
| name = v | ||
| } | ||
| ip := "" | ||
| if v, ok := sentinelDetailMap["ip"]; ok { | ||
| ip = v | ||
| } | ||
| port := "" | ||
| if v, ok := sentinelDetailMap["port"]; ok { | ||
oliver006 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| port = v | ||
| } | ||
| runid := "" | ||
| if v, ok := sentinelDetailMap["runid"]; ok { | ||
| runid = v | ||
| } | ||
| flags := "" | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's use this down in line 175 and onwards instead of extracting it again down there |
||
| if v, ok := sentinelDetailMap["flags"]; ok { | ||
| flags = v | ||
| } | ||
| if e.options.InclSentinelPeerInfo { | ||
| e.registerConstMetricGauge(ch, "sentinel_peer_info", 1, masterName, masterAddr, name, ip, port, runid, flags) | ||
| } | ||
|
|
||
| sentinelFlags, ok := sentinelDetailMap["flags"] | ||
| if !ok { | ||
| continue | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to delete the description (and we don't do it for any other flags), just not emitting the metric should be enough?