Skip to content
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

Update metrics that missed labels #866

Merged
merged 17 commits into from
Jan 16, 2024
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
140 changes: 70 additions & 70 deletions exporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func NewRedisExporter(redisURI string, opts Options) (*Exporter, error) {
// # Stats
"pubsub_channels": "pubsub_channels",
"pubsub_patterns": "pubsub_patterns",
"pubsubshard_channels": "pubsubshard_channels", // Added in Redis 7.0.3
"pubsubshard_channels": "pubsubshard_channels", // Added in Redis 7.0.3
"latest_fork_usec": "latest_fork_usec",
"tracking_total_keys": "tracking_total_keys",
"tracking_total_items": "tracking_total_items",
Expand Down Expand Up @@ -341,75 +341,75 @@ func NewRedisExporter(redisURI string, opts Options) (*Exporter, error) {
txt string
lbls []string
}{
"commands_duration_seconds_total": {txt: `Total amount of time in seconds spent per command`, lbls: []string{"cmd"}},
"commands_failed_calls_total": {txt: `Total number of errors prior command execution per command`, lbls: []string{"cmd"}},
"commands_rejected_calls_total": {txt: `Total number of errors within command execution per command`, lbls: []string{"cmd"}},
"commands_total": {txt: `Total number of calls per command`, lbls: []string{"cmd"}},
"commands_latencies_usec": {txt: `A histogram of latencies per command`, lbls: []string{"cmd"}},
"latency_percentiles_usec": {txt: `A summary of latency percentile distribution per command`, lbls: []string{"cmd"}},
"config_key_value": {txt: `Config key and value`, lbls: []string{"key", "value"}},
"config_value": {txt: `Config key and value as metric`, lbls: []string{"key"}},
"connected_slave_lag_seconds": {txt: "Lag of connected slave", lbls: []string{"slave_ip", "slave_port", "slave_state"}},
"connected_slave_offset_bytes": {txt: "Offset of connected slave", lbls: []string{"slave_ip", "slave_port", "slave_state"}},
"db_avg_ttl_seconds": {txt: "Avg TTL in seconds", lbls: []string{"db"}},
"db_keys": {txt: "Total number of keys by DB", lbls: []string{"db"}},
"db_keys_expiring": {txt: "Total number of expiring keys by DB", lbls: []string{"db"}},
"db_keys_cached": {txt: "Total number of cached keys by DB", lbls: []string{"db"}},
"errors_total": {txt: `Total number of errors per error type`, lbls: []string{"err"}},
"exporter_last_scrape_error": {txt: "The last scrape error status.", lbls: []string{"err"}},
"instance_info": {txt: "Information about the Redis instance", lbls: []string{"role", "redis_version", "redis_build_id", "redis_mode", "os", "maxmemory_policy", "tcp_port", "run_id", "process_id"}},
"key_group_count": {txt: `Count of keys in key group`, lbls: []string{"db", "key_group"}},
"key_group_memory_usage_bytes": {txt: `Total memory usage of key group in bytes`, lbls: []string{"db", "key_group"}},
"key_size": {txt: `The length or size of "key"`, lbls: []string{"db", "key"}},
"key_value": {txt: `The value of "key"`, lbls: []string{"db", "key"}},
"key_value_as_string": {txt: `The value of "key" as a string`, lbls: []string{"db", "key", "val"}},
"keys_count": {txt: `Count of keys`, lbls: []string{"db", "key"}},
"last_key_groups_scrape_duration_milliseconds": {txt: `Duration of the last key group metrics scrape in milliseconds`},
"last_slow_execution_duration_seconds": {txt: `The amount of time needed for last slow execution, in seconds`},
"latency_spike_duration_seconds": {txt: `Length of the last latency spike in seconds`, lbls: []string{"event_name"}},
"latency_spike_last": {txt: `When the latency spike last occurred`, lbls: []string{"event_name"}},
"master_last_io_seconds_ago": {txt: "Master last io seconds ago", lbls: []string{"master_host", "master_port"}},
"master_link_up": {txt: "Master link status on Redis slave", lbls: []string{"master_host", "master_port"}},
"master_sync_in_progress": {txt: "Master sync in progress", lbls: []string{"master_host", "master_port"}},
"number_of_distinct_key_groups": {txt: `Number of distinct key groups`, lbls: []string{"db"}},
"script_result": {txt: "Result of the collect script evaluation", lbls: []string{"filename"}},
"script_values": {txt: "Values returned by the collect script", lbls: []string{"key", "filename"}},
"sentinel_master_ok_sentinels": {txt: "The number of okay sentinels monitoring this master", lbls: []string{"master_name", "master_address"}},
"sentinel_master_ok_slaves": {txt: "The number of okay slaves of the master", lbls: []string{"master_name", "master_address"}},
"sentinel_master_sentinels": {txt: "The number of sentinels monitoring this master", lbls: []string{"master_name", "master_address"}},
"sentinel_master_slaves": {txt: "The number of slaves of the master", lbls: []string{"master_name", "master_address"}},
"sentinel_master_status": {txt: "Master status on Sentinel", lbls: []string{"master_name", "master_address", "master_status"}},
"sentinel_master_ckquorum_status": {txt: "Master ckquorum status", lbls: []string{"master_name", "message"}},
"sentinel_masters": {txt: "The number of masters this sentinel is watching"},
"sentinel_master_setting_ckquorum": {txt: "Show the current ckquorum config for each master"},
"sentinel_master_setting_failover_timeout": {txt: "Show the current failover-timeout config for each master"},
"sentinel_master_setting_parallel_syncs": {txt: "Show the current parallel-syncs config for each master"},
"sentinel_master_setting_down_after_milliseconds": {txt: "Show the current down-after-milliseconds config for each master"},
"sentinel_running_scripts": {txt: "Number of scripts in execution right now"},
"sentinel_scripts_queue_length": {txt: "Queue of user scripts to execute"},
"sentinel_simulate_failure_flags": {txt: "Failures simulations"},
"sentinel_tilt": {txt: "Sentinel is in TILT mode"},
"slave_info": {txt: "Information about the Redis slave", lbls: []string{"master_host", "master_port", "read_only"}},
"slave_repl_offset": {txt: "Slave replication offset", lbls: []string{"master_host", "master_port"}},
"slowlog_last_id": {txt: `Last id of slowlog`},
"slowlog_length": {txt: `Total slowlog`},
"start_time_seconds": {txt: "Start time of the Redis instance since unix epoch in seconds."},
"stream_group_consumer_idle_seconds": {txt: `Consumer idle time in seconds`, lbls: []string{"db", "stream", "group", "consumer"}},
"stream_group_consumer_messages_pending": {txt: `Pending number of messages for this specific consumer`, lbls: []string{"db", "stream", "group", "consumer"}},
"stream_group_consumers": {txt: `Consumers count of stream group`, lbls: []string{"db", "stream", "group"}},
"stream_group_entries_read": {txt: `Total number of entries read from the stream group`, lbls: []string{"db", "stream", "group"}},
"stream_group_lag": {txt: `The number of messages waiting to be delivered to the stream group's consumers`, lbls: []string{"db", "stream", "group"}},
"stream_group_last_delivered_id": {txt: `The epoch timestamp (ms) of the last delivered message`, lbls: []string{"db", "stream", "group"}},
"stream_group_messages_pending": {txt: `Pending number of messages in that stream group`, lbls: []string{"db", "stream", "group"}},
"stream_groups": {txt: `Groups count of stream`, lbls: []string{"db", "stream"}},
"stream_last_generated_id": {txt: `The epoch timestamp (ms) of the latest message on the stream`, lbls: []string{"db", "stream"}},
"stream_length": {txt: `The number of elements of the stream`, lbls: []string{"db", "stream"}},
"stream_max_deleted_entry_id": {txt: `The epoch timestamp (ms) of last message was deleted from the stream`, lbls: []string{"db", "stream"}},
"stream_first_entry_id": {txt: `The epoch timestamp (ms) of the first message in the stream`, lbls: []string{"db", "stream"}},
"stream_last_entry_id": {txt: `The epoch timestamp (ms) of the last message in the stream`, lbls: []string{"db", "stream"}},
"stream_radix_tree_keys": {txt: `Radix tree keys count"`, lbls: []string{"db", "stream"}},
"stream_radix_tree_nodes": {txt: `Radix tree nodes count`, lbls: []string{"db", "stream"}},
"up": {txt: "Information about the Redis instance"},
"commands_duration_seconds_total": {txt: `Total amount of time in seconds spent per command`, lbls: []string{"cmd"}},
"commands_failed_calls_total": {txt: `Total number of errors prior command execution per command`, lbls: []string{"cmd"}},
"commands_rejected_calls_total": {txt: `Total number of errors within command execution per command`, lbls: []string{"cmd"}},
"commands_total": {txt: `Total number of calls per command`, lbls: []string{"cmd"}},
"commands_latencies_usec": {txt: `A histogram of latencies per command`, lbls: []string{"cmd"}},
"latency_percentiles_usec": {txt: `A summary of latency percentile distribution per command`, lbls: []string{"cmd"}},
"config_key_value": {txt: `Config key and value`, lbls: []string{"key", "value"}},
"config_value": {txt: `Config key and value as metric`, lbls: []string{"key"}},
"connected_slave_lag_seconds": {txt: "Lag of connected slave", lbls: []string{"slave_ip", "slave_port", "slave_state"}},
"connected_slave_offset_bytes": {txt: "Offset of connected slave", lbls: []string{"slave_ip", "slave_port", "slave_state"}},
"db_avg_ttl_seconds": {txt: "Avg TTL in seconds", lbls: []string{"db"}},
"db_keys": {txt: "Total number of keys by DB", lbls: []string{"db"}},
"db_keys_expiring": {txt: "Total number of expiring keys by DB", lbls: []string{"db"}},
"db_keys_cached": {txt: "Total number of cached keys by DB", lbls: []string{"db"}},
"errors_total": {txt: `Total number of errors per error type`, lbls: []string{"err"}},
"exporter_last_scrape_error": {txt: "The last scrape error status.", lbls: []string{"err"}},
"instance_info": {txt: "Information about the Redis instance", lbls: []string{"role", "redis_version", "redis_build_id", "redis_mode", "os", "maxmemory_policy", "tcp_port", "run_id", "process_id"}},
"key_group_count": {txt: `Count of keys in key group`, lbls: []string{"db", "key_group"}},
"key_group_memory_usage_bytes": {txt: `Total memory usage of key group in bytes`, lbls: []string{"db", "key_group"}},
"key_size": {txt: `The length or size of "key"`, lbls: []string{"db", "key"}},
"key_value": {txt: `The value of "key"`, lbls: []string{"db", "key"}},
"key_value_as_string": {txt: `The value of "key" as a string`, lbls: []string{"db", "key", "val"}},
"keys_count": {txt: `Count of keys`, lbls: []string{"db", "key"}},
"last_key_groups_scrape_duration_milliseconds": {txt: `Duration of the last key group metrics scrape in milliseconds`},
"last_slow_execution_duration_seconds": {txt: `The amount of time needed for last slow execution, in seconds`},
"latency_spike_duration_seconds": {txt: `Length of the last latency spike in seconds`, lbls: []string{"event_name"}},
"latency_spike_last": {txt: `When the latency spike last occurred`, lbls: []string{"event_name"}},
"master_last_io_seconds_ago": {txt: "Master last io seconds ago", lbls: []string{"master_host", "master_port"}},
"master_link_up": {txt: "Master link status on Redis slave", lbls: []string{"master_host", "master_port"}},
"master_sync_in_progress": {txt: "Master sync in progress", lbls: []string{"master_host", "master_port"}},
"number_of_distinct_key_groups": {txt: `Number of distinct key groups`, lbls: []string{"db"}},
"script_result": {txt: "Result of the collect script evaluation", lbls: []string{"filename"}},
"script_values": {txt: "Values returned by the collect script", lbls: []string{"key", "filename"}},
"sentinel_master_ok_sentinels": {txt: "The number of okay sentinels monitoring this master", lbls: []string{"master_name", "master_address"}},
"sentinel_master_ok_slaves": {txt: "The number of okay slaves of the master", lbls: []string{"master_name", "master_address"}},
"sentinel_master_sentinels": {txt: "The number of sentinels monitoring this master", lbls: []string{"master_name", "master_address"}},
"sentinel_master_slaves": {txt: "The number of slaves of the master", lbls: []string{"master_name", "master_address"}},
"sentinel_master_status": {txt: "Master status on Sentinel", lbls: []string{"master_name", "master_address", "master_status"}},
"sentinel_master_ckquorum_status": {txt: "Master ckquorum status", lbls: []string{"master_name", "message"}},
"sentinel_masters": {txt: "The number of masters this sentinel is watching"},
"sentinel_master_setting_ckquorum": {txt: "Show the current ckquorum config for each master", lbls: []string{"master_name", "master_address"}},
"sentinel_master_setting_failover_timeout": {txt: "Show the current failover-timeout config for each master", lbls: []string{"master_name", "master_address"}},
"sentinel_master_setting_parallel_syncs": {txt: "Show the current parallel-syncs config for each master", lbls: []string{"master_name", "master_address"}},
"sentinel_master_setting_down_after_milliseconds": {txt: "Show the current down-after-milliseconds config for each master", lbls: []string{"master_name", "master_address"}},
"sentinel_running_scripts": {txt: "Number of scripts in execution right now"},
"sentinel_scripts_queue_length": {txt: "Queue of user scripts to execute"},
"sentinel_simulate_failure_flags": {txt: "Failures simulations"},
"sentinel_tilt": {txt: "Sentinel is in TILT mode"},
"slave_info": {txt: "Information about the Redis slave", lbls: []string{"master_host", "master_port", "read_only"}},
"slave_repl_offset": {txt: "Slave replication offset", lbls: []string{"master_host", "master_port"}},
"slowlog_last_id": {txt: `Last id of slowlog`},
"slowlog_length": {txt: `Total slowlog`},
"start_time_seconds": {txt: "Start time of the Redis instance since unix epoch in seconds."},
"stream_group_consumer_idle_seconds": {txt: `Consumer idle time in seconds`, lbls: []string{"db", "stream", "group", "consumer"}},
"stream_group_consumer_messages_pending": {txt: `Pending number of messages for this specific consumer`, lbls: []string{"db", "stream", "group", "consumer"}},
"stream_group_consumers": {txt: `Consumers count of stream group`, lbls: []string{"db", "stream", "group"}},
"stream_group_entries_read": {txt: `Total number of entries read from the stream group`, lbls: []string{"db", "stream", "group"}},
"stream_group_lag": {txt: `The number of messages waiting to be delivered to the stream group's consumers`, lbls: []string{"db", "stream", "group"}},
"stream_group_last_delivered_id": {txt: `The epoch timestamp (ms) of the last delivered message`, lbls: []string{"db", "stream", "group"}},
"stream_group_messages_pending": {txt: `Pending number of messages in that stream group`, lbls: []string{"db", "stream", "group"}},
"stream_groups": {txt: `Groups count of stream`, lbls: []string{"db", "stream"}},
"stream_last_generated_id": {txt: `The epoch timestamp (ms) of the latest message on the stream`, lbls: []string{"db", "stream"}},
"stream_length": {txt: `The number of elements of the stream`, lbls: []string{"db", "stream"}},
"stream_max_deleted_entry_id": {txt: `The epoch timestamp (ms) of last message was deleted from the stream`, lbls: []string{"db", "stream"}},
"stream_first_entry_id": {txt: `The epoch timestamp (ms) of the first message in the stream`, lbls: []string{"db", "stream"}},
"stream_last_entry_id": {txt: `The epoch timestamp (ms) of the last message in the stream`, lbls: []string{"db", "stream"}},
"stream_radix_tree_keys": {txt: `Radix tree keys count"`, lbls: []string{"db", "stream"}},
"stream_radix_tree_nodes": {txt: `Radix tree nodes count`, lbls: []string{"db", "stream"}},
"up": {txt: "Information about the Redis instance"},
} {
e.metricDescriptions[k] = newMetricDescr(opts.Namespace, k, desc.txt, desc.lbls)
}
Expand Down
10 changes: 7 additions & 3 deletions exporter/sentinels_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,13 @@ func TestExtractSentinelMetricsForSentinel(t *testing.T) {
}

want := map[string]bool{
"sentinel_master_ok_sentinels": false,
"sentinel_master_ok_slaves": false,
"sentinel_master_ckquorum_status": false,
"sentinel_master_ok_sentinels": false,
"sentinel_master_ok_slaves": false,
"sentinel_master_ckquorum_status": false,
"sentinel_master_setting_ckquorum": false,
"sentinel_master_setting_failover_timeout": false,
"sentinel_master_setting_parallel_syncs": false,
"sentinel_master_setting_down_after_milliseconds": false,
}

for m := range chM {
Expand Down
Loading