[MINOR] stats: add global event ID and count
This counter will help quickly spot whether there are new errors or not.
It is also assigned to each capture so that a script can keep trace of
which capture was taken when.
diff --git a/src/dumpstats.c b/src/dumpstats.c
index da29809..a45d40a 100644
--- a/src/dumpstats.c
+++ b/src/dumpstats.c
@@ -3426,6 +3426,19 @@
/* the function had not been called yet, let's prepare the
* buffer for a response.
*/
+ struct tm tm;
+
+ get_localtime(date.tv_sec, &tm);
+ chunk_printf(&msg, "Total events captured on [%02d/%s/%04d:%02d:%02d:%02d.%03d] : %u\n",
+ tm.tm_mday, monthname[tm.tm_mon], tm.tm_year+1900,
+ tm.tm_hour, tm.tm_min, tm.tm_sec, (int)(date.tv_usec/1000),
+ error_snapshot_id);
+
+ if (buffer_feed_chunk(rep, &msg) >= 0) {
+ /* Socket buffer full. Let's try again later from the same point */
+ return 0;
+ }
+
s->data_ctx.errors.px = proxy;
s->data_ctx.errors.buf = 0;
s->data_ctx.errors.bol = 0;
@@ -3477,27 +3490,27 @@
chunk_printf(&msg,
" frontend %s (#%d): invalid request\n"
" src %s, session #%d, backend %s (#%d), server %s (#%d)\n"
- " HTTP internal state %d, buffer flags 0x%08x\n"
+ " HTTP internal state %d, buffer flags 0x%08x, event #%u\n"
" request length %d bytes, error at position %d:\n \n",
s->data_ctx.errors.px->id, s->data_ctx.errors.px->uuid,
pn, es->sid, (es->oe->cap & PR_CAP_BE) ? es->oe->id : "<NONE>",
(es->oe->cap & PR_CAP_BE) ? es->oe->uuid : -1,
es->srv ? es->srv->id : "<NONE>",
es->srv ? es->srv->puid : -1,
- es->state, es->flags,
+ es->state, es->flags, es->ev_id,
es->len, es->pos);
break;
case 1:
chunk_printf(&msg,
" backend %s (#%d) : invalid response\n"
" src %s, session #%d, frontend %s (#%d), server %s (#%d)\n"
- " HTTP internal state %d, buffer flags 0x%08x\n"
+ " HTTP internal state %d, buffer flags 0x%08x, event #%u\n"
" response length %d bytes, error at position %d:\n \n",
s->data_ctx.errors.px->id, s->data_ctx.errors.px->uuid,
pn, es->sid, es->oe->id, es->oe->uuid,
es->srv ? es->srv->id : "<NONE>",
es->srv ? es->srv->puid : -1,
- es->state, es->flags,
+ es->state, es->flags, es->ev_id,
es->len, es->pos);
break;
}