Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(metrics) drop 'mid' argument from ngx_wa_metrics_histogram_record #617

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/common/debug/ngx_wasm_debug_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ ngx_wasm_debug_init(ngx_cycle_t *cycle)

ngx_wa_assert(
ngx_wa_metrics_histogram_record(ngx_wasmx_metrics(cycle),
m, 0, 0, 1) == NGX_ERROR
m, 0, 1) == NGX_ERROR
);

ngx_wa_metrics_histogram_get(ngx_wasmx_metrics(cycle), m, 1, h2);
Expand Down
12 changes: 6 additions & 6 deletions src/common/metrics/ngx_wa_histogram.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ histogram_log2_bin(ngx_wa_metrics_t *metrics, ngx_wa_metrics_histogram_t *h,

#if (NGX_DEBUG)
static void
histogram_log(ngx_wa_metrics_t *metrics, ngx_wa_metric_t *m, uint32_t mid)
histogram_log(ngx_wa_metrics_t *metrics, ngx_wa_metric_t *m)
{
size_t i;
u_char *p;
Expand Down Expand Up @@ -172,9 +172,9 @@ histogram_log(ngx_wa_metrics_t *metrics, ngx_wa_metric_t *m, uint32_t mid)

p = ngx_sprintf(p, " SUM: %uD;", h->sum);

ngx_log_debug3(NGX_LOG_DEBUG_WASM, metrics->shm->log, 0,
"histogram \"%uD\": %*s",
mid, p - s_buf - 1, s_buf + 1);
ngx_log_debug2(NGX_LOG_DEBUG_WASM, metrics->shm->log, 0,
"histogram: %*s",
p - s_buf - 1, s_buf + 1);
}
#endif

Expand Down Expand Up @@ -239,7 +239,7 @@ ngx_wa_metrics_histogram_add_locked(ngx_wa_metrics_t *metrics, uint32_t *bins,

ngx_int_t
ngx_wa_metrics_histogram_record(ngx_wa_metrics_t *metrics, ngx_wa_metric_t *m,
ngx_uint_t slot, uint32_t mid, ngx_uint_t n)
ngx_uint_t slot, ngx_uint_t n)
{
ngx_wa_metrics_bin_t *b;
ngx_wa_metrics_histogram_t *h;
Expand All @@ -263,7 +263,7 @@ ngx_wa_metrics_histogram_record(ngx_wa_metrics_t *metrics, ngx_wa_metric_t *m,
b->count += 1;

#if (NGX_DEBUG)
histogram_log(metrics, m, mid);
histogram_log(metrics, m);
#endif

return NGX_OK;
Expand Down
2 changes: 1 addition & 1 deletion src/common/metrics/ngx_wa_metrics.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ ngx_wa_metrics_record(ngx_wa_metrics_t *metrics, uint32_t mid, ngx_int_t n)
break;

case NGX_WA_METRIC_HISTOGRAM:
ngx_wa_metrics_histogram_record(metrics, m, slot, mid, n);
ngx_wa_metrics_histogram_record(metrics, m, slot, n);
break;

default:
Expand Down
2 changes: 1 addition & 1 deletion src/common/metrics/ngx_wa_metrics.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ ngx_int_t ngx_wa_metrics_get(ngx_wa_metrics_t *metrics, uint32_t metric_id,
ngx_int_t ngx_wa_metrics_histogram_add_locked(ngx_wa_metrics_t *metrics,
uint32_t *bins, uint16_t n_bins, ngx_wa_metric_t *m);
ngx_int_t ngx_wa_metrics_histogram_record(ngx_wa_metrics_t *metrics,
ngx_wa_metric_t *m, ngx_uint_t slot, uint32_t mid, ngx_uint_t n);
ngx_wa_metric_t *m, ngx_uint_t slot, ngx_uint_t n);
void ngx_wa_metrics_histogram_get(ngx_wa_metrics_t *metrics, ngx_wa_metric_t *m,
ngx_uint_t slots, ngx_wa_metrics_histogram_t *out);

Expand Down
2 changes: 1 addition & 1 deletion t/03-proxy_wasm/hfuncs/metrics/020-proxy_record_metric.t
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ qq{
--- error_log eval
[
"growing histogram",
qr/histogram "\d+": 1: 1; 2: 1; 4: 1; 8: 1; 16: 1; 32: 1; 64: 1; 128: 1; 256: 1; 512: 1; 1024: 1; 2048: 1; 4096: 1; 8192: 1; 16384: 1; 32768: 1; 65536: 1; 4294967295: 1; SUM: 262143/
qr/histogram: 1: 1; 2: 1; 4: 1; 8: 1; 16: 1; 32: 1; 64: 1; 128: 1; 256: 1; 512: 1; 1024: 1; 2048: 1; 4096: 1; 8192: 1; 16384: 1; 32768: 1; 65536: 1; 4294967295: 1; SUM: 262143/
]
--- no_error_log
[error]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ qq{
--- error_log eval
[
"cannot expand histogram",
qr/histogram \"\d+\": 1: 1; 2: 1; 4: 1; 8: 1; 4294967295: 1; SUM: 31/,
qr/histogram: 1: 1; 2: 1; 4: 1; 8: 1; 4294967295: 1; SUM: 31/,
]
--- no_error_log
[error]
Expand Down
24 changes: 12 additions & 12 deletions t/06-others/021-histograms_sighup.t
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ qq{
echo ok;
}
}
--- grep_error_log eval: qr/histogram "\d+":( \d+: \d+;)+/
--- grep_error_log eval: qr/histogram:( \d+: \d+;)+/
--- grep_error_log_out eval
$::total += $::workers;
qr/histogram "\d+": 1: $::total; 4294967295: 0;/
qr/histogram: 1: $::total; 4294967295: 0;/
--- no_error_log
[error]
[crit]
Expand All @@ -54,10 +54,10 @@ qq{
echo ok;
}
}
--- grep_error_log eval: qr/histogram "\d+":( \d+: \d+;)+/
--- grep_error_log eval: qr/histogram:( \d+: \d+;)+/
--- grep_error_log_out eval
$::total += $::workers;
qr/histogram "\d+": 1: $::total; 4294967295: 0;/
qr/histogram: 1: $::total; 4294967295: 0;/
--- no_error_log
[error]
[crit]
Expand All @@ -77,10 +77,10 @@ qq{
echo ok;
}
}
--- grep_error_log eval: qr/histogram "\d+":( \d+: \d+;)+/
--- grep_error_log eval: qr/histogram:( \d+: \d+;)+/
--- grep_error_log_out eval
$::total += 4;
qr/histogram "\d+": 1: $::total; 4294967295: 0;/
qr/histogram: 1: $::total; 4294967295: 0;/
--- no_error_log
[error]
[crit]
Expand All @@ -100,10 +100,10 @@ qq{
echo ok;
}
}
--- grep_error_log eval: qr/histogram "\d+":( \d+: \d+;)+/
--- grep_error_log eval: qr/histogram:( \d+: \d+;)+/
--- grep_error_log_out eval
$::total += 2;
qr/histogram "\d+": 1: $::total; 4294967295: 0;/
qr/histogram: 1: $::total; 4294967295: 0;/
--- no_error_log
[error]
[crit]
Expand Down Expand Up @@ -133,10 +133,10 @@ qq{
echo ok;
}
}
--- grep_error_log eval: qr/histogram "\d+":( \d+: \d+;)+/
--- grep_error_log eval: qr/histogram:( \d+: \d+;)+/
--- grep_error_log_out eval
$::total += 1;
qr/histogram "\d+": 1: $::total; 4294967295: 0;/
qr/histogram: 1: $::total; 4294967295: 0;/
--- no_error_log
[error]
[crit]
Expand Down Expand Up @@ -166,10 +166,10 @@ qq{
echo ok;
}
}
--- grep_error_log eval: qr/histogram "\d+":( \d+: \d+;)+/
--- grep_error_log eval: qr/histogram:( \d+: \d+;)+/
--- grep_error_log_out eval
$::total += 1;
qr/histogram "\d+": 1: $::total; 4294967295: 0;/
qr/histogram: 1: $::total; 4294967295: 0;/
--- no_error_log
[error]
[crit]
Loading