Added an unique ID field to every slow log entry.
This commit is contained in:
parent
de32c37c06
commit
2cb6828480
@ -528,6 +528,7 @@ struct redisServer {
|
|||||||
size_t stat_peak_memory; /* max used memory record */
|
size_t stat_peak_memory; /* max used memory record */
|
||||||
long long stat_fork_time; /* time needed to perform latets fork() */
|
long long stat_fork_time; /* time needed to perform latets fork() */
|
||||||
list *slowlog;
|
list *slowlog;
|
||||||
|
long long slowlog_entry_id;
|
||||||
long long slowlog_log_slower_than;
|
long long slowlog_log_slower_than;
|
||||||
unsigned long slowlog_max_len;
|
unsigned long slowlog_max_len;
|
||||||
/* Configuration */
|
/* Configuration */
|
||||||
|
@ -26,6 +26,7 @@ slowlogEntry *slowlogCreateEntry(robj **argv, int argc, long long duration) {
|
|||||||
}
|
}
|
||||||
se->time = time(NULL);
|
se->time = time(NULL);
|
||||||
se->duration = duration;
|
se->duration = duration;
|
||||||
|
se->id = server.slowlog_entry_id++;
|
||||||
return se;
|
return se;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,6 +48,7 @@ void slowlogFreeEntry(void *septr) {
|
|||||||
* at server startup. */
|
* at server startup. */
|
||||||
void slowlogInit(void) {
|
void slowlogInit(void) {
|
||||||
server.slowlog = listCreate();
|
server.slowlog = listCreate();
|
||||||
|
server.slowlog_entry_id = 0;
|
||||||
listSetFreeMethod(server.slowlog,slowlogFreeEntry);
|
listSetFreeMethod(server.slowlog,slowlogFreeEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +98,8 @@ void slowlogCommand(redisClient *c) {
|
|||||||
int j;
|
int j;
|
||||||
|
|
||||||
se = ln->value;
|
se = ln->value;
|
||||||
addReplyMultiBulkLen(c,3);
|
addReplyMultiBulkLen(c,4);
|
||||||
|
addReplyLongLong(c,se->id);
|
||||||
addReplyLongLong(c,se->time);
|
addReplyLongLong(c,se->time);
|
||||||
addReplyLongLong(c,se->duration);
|
addReplyLongLong(c,se->duration);
|
||||||
addReplyMultiBulkLen(c,se->argc);
|
addReplyMultiBulkLen(c,se->argc);
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
typedef struct slowlogEntry {
|
typedef struct slowlogEntry {
|
||||||
robj **argv;
|
robj **argv;
|
||||||
int argc;
|
int argc;
|
||||||
|
long long id; /* Unique entry identifier. */
|
||||||
long long duration; /* Time spent by the query, in nanoseconds. */
|
long long duration; /* Time spent by the query, in nanoseconds. */
|
||||||
time_t time; /* Unix time at which the query was executed. */
|
time_t time; /* Unix time at which the query was executed. */
|
||||||
} slowlogEntry;
|
} slowlogEntry;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user