-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Capture and parse the cmdstat timings from INFO ALL
command
#5926
Changes from all commits
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 |
---|---|---|
|
@@ -116,6 +116,22 @@ func TestRedis_ParseMetrics(t *testing.T) { | |
} | ||
acc.AssertContainsTaggedFields(t, "redis", fields, tags) | ||
acc.AssertContainsTaggedFields(t, "redis_keyspace", keyspaceFields, keyspaceTags) | ||
|
||
cmdstatSetTags := map[string]string{"host": "redis.net", "replication_role": "master", "command": "set"} | ||
cmdstatSetFields := map[string]interface{}{ | ||
"calls": int64(261265), | ||
"usec": int64(1634157), | ||
"usec_per_call": float64(6.25), | ||
} | ||
acc.AssertContainsTaggedFields(t, "redis_cmdstat", cmdstatSetFields, cmdstatSetTags) | ||
|
||
cmdstatCommandTags := map[string]string{"host": "redis.net", "replication_role": "master", "command": "command"} | ||
cmdstatCommandFields := map[string]interface{}{ | ||
"calls": int64(1), | ||
"usec": int64(990), | ||
"usec_per_call": float64(990.0), | ||
} | ||
acc.AssertContainsTaggedFields(t, "redis_cmdstat", cmdstatCommandFields, cmdstatCommandTags) | ||
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. Should we needs to add test in case that usec and usec_per_call are not number? 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. If this is something that may be returned, let's test for 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. Is there a pattern from testutil I could use? FWIW, I don't expect the type to change given the age of this commit :) |
||
} | ||
|
||
const testOutput = `# Server | ||
|
@@ -205,6 +221,10 @@ used_cpu_user:0.05 | |
used_cpu_sys_children:0.00 | ||
used_cpu_user_children:0.00 | ||
|
||
# Commandstats | ||
cmdstat_set:calls=261265,usec=1634157,usec_per_call=6.25 | ||
cmdstat_command:calls=1,usec=990,usec_per_call=990.00 | ||
|
||
# Keyspace | ||
db0:keys=2,expires=0,avg_ttl=0 | ||
|
||
|
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.
Nitpick, but I would add an underscore to match the TrimPrefix laster on: