Skip to content

Send slow command to statsd. Close #33#70

Merged
maralla merged 7 commits intoeleme:masterfrom
doyoubi:feature/SlowLog
Jun 12, 2016
Merged

Send slow command to statsd. Close #33#70
maralla merged 7 commits intoeleme:masterfrom
doyoubi:feature/SlowLog

Conversation

@doyoubi
Copy link
Copy Markdown
Contributor

@doyoubi doyoubi commented Jun 3, 2016

@doyoubi doyoubi changed the title Send slow command to statsd [WIP] Send slow command to statsd Jun 3, 2016
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}};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This kind of modification is trivial.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this to suppress uninitialized-value errors in valgrind.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the version of your valgrind?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3.10.1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the command you are running?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

valgrind ./corvus corvus.conf

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@doyoubi doyoubi force-pushed the feature/SlowLog branch from 3fdcc51 to f48689c Compare June 6, 2016 10:27
@doyoubi doyoubi changed the title [WIP] Send slow command to statsd Send slow command to statsd Jun 7, 2016
@doyoubi
Copy link
Copy Markdown
Contributor Author

doyoubi commented Jun 7, 2016

@maralla
Changed to save slow log in server connection, and collect them in stats thread.

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)};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@doyoubi doyoubi force-pushed the feature/SlowLog branch 2 times, most recently from 8402c42 to 2d8c852 Compare June 8, 2016 01:37
@doyoubi
Copy link
Copy Markdown
Contributor Author

doyoubi commented Jun 8, 2016

@maralla

src/stats.c Outdated
}

uint32_t counts_sum[CMD_NUM];
memset(counts_sum, 0, CMD_NUM * sizeof(uint32_t));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CMD_NUM * sizeof(uint32_t) == sizeof(counts_sum)

@doyoubi doyoubi force-pushed the feature/SlowLog branch from 2d8c852 to 50e4f96 Compare June 8, 2016 02:54
src/stats.c Outdated

static void stats_send_slow_log()
{
const char *fmt = "nodes.%s.slow_query.%s";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two problems here:

  1. nodes should be changed to redis-node for consistency.
  2. The first %s is 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.

Copy link
Copy Markdown
Contributor Author

@doyoubi doyoubi Jun 8, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@wooparadog wooparadog changed the title Send slow command to statsd Send slow command to statsd. Close #33 Jun 8, 2016
@maralla maralla merged commit 04c55ec into eleme:master Jun 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants