diff options
author | Tharanga Gamaethige <tgamaethige@netflix.com> | 2019-08-14 13:18:07 -0700 |
---|---|---|
committer | dormando <dormando@rydia.net> | 2019-08-27 17:11:06 -0700 |
commit | 723ca8bc38ea0194605a0b2cb54cd42737c46dc3 (patch) | |
tree | 8163166fb325eeb5c677c45b8e6558af31bbac23 /logger.c | |
parent | dc41d4fa76bc23d81eb81dcad3a12a8e9241dcd2 (diff) | |
download | memcached-723ca8bc38ea0194605a0b2cb54cd42737c46dc3.tar.gz |
log client connection id with fetchers and mutations
you can now monitor fetch and mutations of a given client
Diffstat (limited to 'logger.c')
-rw-r--r-- | logger.c | 21 |
1 files changed, 12 insertions, 9 deletions
@@ -186,9 +186,9 @@ static int _logger_thread_parse_ise(logentry *e, char *scratch) { uriencode(le->key, keybuf, le->nkey, KEY_MAX_URI_ENCODED_LENGTH); total = snprintf(scratch, LOGGER_PARSE_SCRATCH, - "ts=%d.%d gid=%llu type=item_store key=%s status=%s cmd=%s ttl=%u clsid=%u\n", + "ts=%d.%d gid=%llu type=item_store key=%s status=%s cmd=%s ttl=%u clsid=%u cfd=%d\n", (int)e->tv.tv_sec, (int)e->tv.tv_usec, (unsigned long long) e->gid, - keybuf, status_map[le->status], cmd, le->ttl, le->clsid); + keybuf, status_map[le->status], cmd, le->ttl, le->clsid, le->sfd); return total; } @@ -201,9 +201,9 @@ static int _logger_thread_parse_ige(logentry *e, char *scratch) { uriencode(le->key, keybuf, le->nkey, KEY_MAX_URI_ENCODED_LENGTH); total = snprintf(scratch, LOGGER_PARSE_SCRATCH, - "ts=%d.%d gid=%llu type=item_get key=%s status=%s clsid=%u\n", + "ts=%d.%d gid=%llu type=item_get key=%s status=%s clsid=%u cfd=%d\n", (int)e->tv.tv_sec, (int)e->tv.tv_usec, (unsigned long long) e->gid, - keybuf, was_found_map[le->was_found], le->clsid); + keybuf, was_found_map[le->was_found], le->clsid, le->sfd); return total; } @@ -650,20 +650,20 @@ static void _logger_log_ext_write(logentry *e, item *it, uint8_t bucket) { * might be useful to store/print the flags an item has? * could also collapse this and above code into an "item status" struct. wait * for more endpoints to be written before making it generic, though. - * TODO: This and below should track and reprint the client fd. */ static void _logger_log_item_get(logentry *e, const int was_found, const char *key, - const int nkey, const uint8_t clsid) { + const int nkey, const uint8_t clsid, const int sfd) { struct logentry_item_get *le = (struct logentry_item_get *) e->data; le->was_found = was_found; le->nkey = nkey; le->clsid = clsid; memcpy(le->key, key, nkey); + le->sfd = sfd; e->size = sizeof(struct logentry_item_get) + nkey; } static void _logger_log_item_store(logentry *e, const enum store_item_type status, - const int comm, char *key, const int nkey, rel_time_t ttl, const uint8_t clsid) { + const int comm, char *key, const int nkey, rel_time_t ttl, const uint8_t clsid, int sfd) { struct logentry_item_store *le = (struct logentry_item_store *) e->data; le->status = status; le->cmd = comm; @@ -675,6 +675,7 @@ static void _logger_log_item_store(logentry *e, const enum store_item_type statu le->ttl = 0; } memcpy(le->key, key, nkey); + le->sfd = sfd; e->size = sizeof(struct logentry_item_store) + nkey; } @@ -741,7 +742,8 @@ enum logger_ret_type logger_log(logger *l, const enum log_entry_type event, cons char *key = va_arg(ap, char *); size_t nkey = va_arg(ap, size_t); uint8_t gclsid = va_arg(ap, int); - _logger_log_item_get(e, was_found, key, nkey, gclsid); + int gsfd = va_arg(ap, int); + _logger_log_item_get(e, was_found, key, nkey, gclsid, gsfd); va_end(ap); break; case LOGGER_ITEM_STORE_ENTRY: @@ -752,7 +754,8 @@ enum logger_ret_type logger_log(logger *l, const enum log_entry_type event, cons size_t snkey = va_arg(ap, size_t); rel_time_t sttl = va_arg(ap, rel_time_t); uint8_t sclsid = va_arg(ap, int); - _logger_log_item_store(e, status, comm, skey, snkey, sttl, sclsid); + int ssfd = va_arg(ap, int); + _logger_log_item_store(e, status, comm, skey, snkey, sttl, sclsid, ssfd); va_end(ap); break; } |