Merge branch 'count-log-bug' into 'main'

also consider LD_BUG logs when counting bug reached

Closes #40924

See merge request tpo/core/tor!805
This commit is contained in:
David Goulet 2024-04-16 15:20:18 +00:00
commit 7ba70eeeea
2 changed files with 5 additions and 1 deletions

View File

@ -707,6 +707,8 @@ log_fn_(int severity, log_domain_mask_t domain, const char *fn,
const char *format, ...)
{
va_list ap;
if (domain & LD_BUG)
tor_bug_increment_count_();
if (severity > log_global_min_severity_)
return;
va_start(ap,format);
@ -719,6 +721,8 @@ log_fn_ratelim_(ratelim_t *ratelim, int severity, log_domain_mask_t domain,
{
va_list ap;
char *m;
if (domain & LD_BUG)
tor_bug_increment_count_();
if (severity > log_global_min_severity_)
return;
m = rate_limit_log(ratelim, approx_time());

View File

@ -41,7 +41,7 @@ logging_metrics_get_stores(void)
metrics_store_entry_t *sentry = metrics_store_add(
the_store,
METRICS_TYPE_COUNTER,
METRICS_NAME(bug_reached),
METRICS_NAME(bug_reached_count),
"Total number of BUG() and similar assertion reached",
0, NULL);
metrics_store_entry_update(sentry, tor_bug_get_count());