jiridanek commented on a change in pull request #696:
URL: https://github.com/apache/qpid-dispatch/pull/696#discussion_r570198833
##########
File path: src/http-libwebsockets.c
##########
@@ -537,7 +650,7 @@ static int callback_metrics(struct lws *wsi, enum
lws_callback_reasons reason,
{
qd_http_server_t *hs = wsi_server(wsi);
stats_t *stats = (stats_t*) user;
- uint8_t buffer[LWS_PRE + 2048];
+ uint8_t buffer[LWS_PRE + 26326];
Review comment:
please explain magic number, consider making it an int constant
##########
File path: src/http-libwebsockets.c
##########
@@ -537,7 +650,7 @@ static int callback_metrics(struct lws *wsi, enum
lws_callback_reasons reason,
{
qd_http_server_t *hs = wsi_server(wsi);
stats_t *stats = (stats_t*) user;
- uint8_t buffer[LWS_PRE + 2048];
+ uint8_t buffer[LWS_PRE + 26326];
Review comment:
please explain magic number in comment, consider making it an int
constant
##########
File path: src/http-libwebsockets.c
##########
@@ -573,11 +694,22 @@ static int callback_metrics(struct lws *wsi, enum
lws_callback_reasons reason,
break;
}
}
- int n = stats->current < metrics_length ? LWS_WRITE_HTTP :
LWS_WRITE_HTTP_FINAL;
+
+ int alloc_cur = 0;
+ while (alloc_cur < allocator_metrics_length) {
+ if (write_allocator_metric(&position, end,
&allocator_metrics[alloc_cur])) {
+ qd_log(hs->log, QD_LOG_DEBUG, "wrote allocator metric %lu of
%lu", alloc_cur, allocator_metrics_length);
+ alloc_cur++;
+ } else {
+ qd_log(hs->log, QD_LOG_DEBUG, "insufficient space in buffer");
Review comment:
I'm wondering about the log levels, `QD_LOG_DEBUG` for success seems
high to me (I'd go with TRACE) and `QD_LOG_DEBUG` for the failure here could be
too low (I'd give it INFO). But I did not examine qdrouterd logging
comprehensively, so maybe I am just no properly attuned.
##########
File path: src/http-libwebsockets.c
##########
@@ -537,7 +657,8 @@ static int callback_metrics(struct lws *wsi, enum
lws_callback_reasons reason,
{
qd_http_server_t *hs = wsi_server(wsi);
stats_t *stats = (stats_t*) user;
- uint8_t buffer[LWS_PRE + 2048];
+ // rationale for buffer size is explained at write_stats and
write_allocator_stats
+ uint8_t buffer[LWS_PRE + 30618];
Review comment:
looks a bit fragile, but ok
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]