Send slow command to statsd. Close #33#70
Conversation
src/event.c
Outdated
| int event_register(struct event_loop *loop, struct connection *c, int mask) | ||
| { | ||
| struct epoll_event event; | ||
| struct epoll_event event = {0, {0}}; |
There was a problem hiding this comment.
This kind of modification is trivial.
There was a problem hiding this comment.
I added this to suppress uninitialized-value errors in valgrind.
There was a problem hiding this comment.
What's the version of your valgrind?
There was a problem hiding this comment.
What's the command you are running?
There was a problem hiding this comment.
valgrind ./corvus corvus.conf
There was a problem hiding this comment.
Wired. valgrind in travis ci is also 3.10.1 and it has no uninitialized errors. https://travis-ci.org/eleme/corvus/builds/129413867#L356
|
@maralla |
src/stats.c
Outdated
|
|
||
| // log slow command | ||
| #define BUILD_CMD_ITEM(cmd, type, access) #cmd, | ||
| static const char * cmd_table[] = {CMD_DO(BUILD_CMD_ITEM)}; |
There was a problem hiding this comment.
8402c42 to
2d8c852
Compare
src/stats.c
Outdated
| } | ||
|
|
||
| uint32_t counts_sum[CMD_NUM]; | ||
| memset(counts_sum, 0, CMD_NUM * sizeof(uint32_t)); |
There was a problem hiding this comment.
CMD_NUM * sizeof(uint32_t) == sizeof(counts_sum)
src/stats.c
Outdated
|
|
||
| static void stats_send_slow_log() | ||
| { | ||
| const char *fmt = "nodes.%s.slow_query.%s"; |
There was a problem hiding this comment.
Two problems here:
nodesshould be changed toredis-nodefor consistency.- The first
%sis the combination of ip and port, so the dot in ip should be changed to-. L155-L160
Maybe we can reuse the function stats_node_info_agg and add the slow_counts field to the bytes struct.
There was a problem hiding this comment.
Since CMD_NUM is not a compile time constant, slow_counts can't be added to struct bytes simply as an array. Besides, suppose we can added it as an array field and the size of struct bytes is about 400 bytes, the total size of the local array is about 6400KB, which may result in stack overflow.
Or we can limit the max number of instance to 1000.
#33
@maralla @wooparadog