MINOR: stats: report the boot time in "show info"
Just like we have the uptime in "show info", let's add the boot time. It's trivial to collect as it's just the difference between the ready date and the start date, and will allow users to monitor this element in order to take action before it starts becoming problematic. Here the boot time is reported in milliseconds, so this allows to even observe sub-second anomalies in startup delays.
This commit is contained in:
parent
da4aa6905c
commit
5723b382ed
|
@ -345,6 +345,7 @@ enum info_field {
|
||||||
INF_TAINTED,
|
INF_TAINTED,
|
||||||
INF_WARNINGS,
|
INF_WARNINGS,
|
||||||
INF_MAXCONN_REACHED,
|
INF_MAXCONN_REACHED,
|
||||||
|
INF_BOOTTIME_MS,
|
||||||
|
|
||||||
/* must always be the last one */
|
/* must always be the last one */
|
||||||
INF_TOTAL_FIELDS
|
INF_TOTAL_FIELDS
|
||||||
|
|
|
@ -158,6 +158,7 @@ const struct name_desc info_fields[INF_TOTAL_FIELDS] = {
|
||||||
[INF_TAINTED] = { .name = "Tainted", .desc = "Experimental features used" },
|
[INF_TAINTED] = { .name = "Tainted", .desc = "Experimental features used" },
|
||||||
[INF_WARNINGS] = { .name = "TotalWarnings", .desc = "Total warnings issued" },
|
[INF_WARNINGS] = { .name = "TotalWarnings", .desc = "Total warnings issued" },
|
||||||
[INF_MAXCONN_REACHED] = { .name = "MaxconnReached", .desc = "Number of times an accepted connection resulted in Maxconn being reached" },
|
[INF_MAXCONN_REACHED] = { .name = "MaxconnReached", .desc = "Number of times an accepted connection resulted in Maxconn being reached" },
|
||||||
|
[INF_BOOTTIME_MS] = { .name = "BootTime_ms", .desc = "How long ago it took to parse and process the config before being ready (milliseconds)" },
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct name_desc stat_fields[ST_F_TOTAL_FIELDS] = {
|
const struct name_desc stat_fields[ST_F_TOTAL_FIELDS] = {
|
||||||
|
@ -4630,6 +4631,7 @@ int stats_fill_info(struct field *info, int len, uint flags)
|
||||||
uint64_t glob_out_bytes, glob_spl_bytes, glob_out_b32;
|
uint64_t glob_out_bytes, glob_spl_bytes, glob_out_b32;
|
||||||
uint up_sec, up_usec;
|
uint up_sec, up_usec;
|
||||||
ullong up;
|
ullong up;
|
||||||
|
ulong boot;
|
||||||
int thr;
|
int thr;
|
||||||
|
|
||||||
#ifdef USE_OPENSSL
|
#ifdef USE_OPENSSL
|
||||||
|
@ -4654,6 +4656,8 @@ int stats_fill_info(struct field *info, int len, uint flags)
|
||||||
up_sec = ns_to_sec(up);
|
up_sec = ns_to_sec(up);
|
||||||
up_usec = (up / 1000U) % 1000000U;
|
up_usec = (up / 1000U) % 1000000U;
|
||||||
|
|
||||||
|
boot = tv_ms_remain(&start_date, &ready_date);
|
||||||
|
|
||||||
if (len < INF_TOTAL_FIELDS)
|
if (len < INF_TOTAL_FIELDS)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -4748,6 +4752,7 @@ int stats_fill_info(struct field *info, int len, uint flags)
|
||||||
chunk_appendf(out, "%#x", get_tainted());
|
chunk_appendf(out, "%#x", get_tainted());
|
||||||
info[INF_WARNINGS] = mkf_u32(FN_COUNTER, HA_ATOMIC_LOAD(&tot_warnings));
|
info[INF_WARNINGS] = mkf_u32(FN_COUNTER, HA_ATOMIC_LOAD(&tot_warnings));
|
||||||
info[INF_MAXCONN_REACHED] = mkf_u32(FN_COUNTER, HA_ATOMIC_LOAD(&maxconn_reached));
|
info[INF_MAXCONN_REACHED] = mkf_u32(FN_COUNTER, HA_ATOMIC_LOAD(&maxconn_reached));
|
||||||
|
info[INF_BOOTTIME_MS] = mkf_u32(FN_DURATION, boot);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue