[
https://issues.apache.org/jira/browse/DISPATCH-1586?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17279529#comment-17279529
]
ASF GitHub Bot commented on DISPATCH-1586:
------------------------------------------
fgiorgetti commented on a change in pull request #696:
URL: https://github.com/apache/qpid-dispatch/pull/696#discussion_r570189303
##########
File path: src/http-libwebsockets.c
##########
@@ -522,11 +611,35 @@ static bool write_stats(uint8_t **position, const uint8_t
* const end, const cha
}
}
+static bool write_allocator_stats(uint8_t **position, const uint8_t * const
end, const char* name, allocator_field field)
+{
+ //18 chars + 2*name + 2*(field+6) + 20 chars for int
+ size_t length = 18 + strlen(name)*2 + strlen(field.name)*2 + 20;
+ if (end - *position >= length) {
+ *position += lws_snprintf((char*) *position, end - *position, "# TYPE
%s:%s_bytes gauge\n", name, field.name);
+ *position += lws_snprintf((char*) *position, end - *position,
"%s:%s_bytes %lu\n", name, field.name, field.value);
Review comment:
Ok!
##########
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:
@jiridanek finally updated as suggested. Please feel free to review.
##########
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:
Makes sense to me as well.
##########
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:
Makes sense to me as well (the failure path). For success, I would keep
it as DEBUG.
----------------------------------------------------------------
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]
> Add allocator stats to the set of exported prometheus metrics
> -------------------------------------------------------------
>
> Key: DISPATCH-1586
> URL: https://issues.apache.org/jira/browse/DISPATCH-1586
> Project: Qpid Dispatch
> Issue Type: Improvement
> Reporter: Gordon Sim
> Priority: Major
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]