1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

ss: metrics: http: just report at wsi close

Defer recording the ss metrics histogram until wsi close, so it has a
chance to collect all the tags that apply.

Defer dumping metrics until the FINALIZE phase of context destroy, so we
had a chance to get any metrics recorded.
This commit is contained in:
Andy Green 2021-04-08 06:36:01 +01:00
parent 2a7ded310f
commit 402e97a679
3 changed files with 5 additions and 13 deletions

View file

@ -1724,10 +1724,6 @@ lws_context_destroy(struct lws_context *context)
#if defined(LWS_WITH_NETWORK)
#if defined(LWS_WITH_SYS_METRICS)
lws_metrics_dump(context);
#endif
/*
* Close any vhost listen wsi
*
@ -2020,6 +2016,10 @@ next:
case LWSCD_FINALIZATION:
#if defined(LWS_WITH_SYS_METRICS)
lws_metrics_dump(context);
#endif
context->evlib_finalize_destroy_after_int_loops_stop = 1;
#if defined(LWS_WITH_NETWORK)

View file

@ -571,7 +571,6 @@ secstream_h1(struct lws *wsi, enum lws_callback_reasons reason, void *user,
lws_sul_cancel(&h->sul);
if (h->prev_ss_state != LWSSSCS_CONNECTED) {
lws_metrics_caliper_report_hist(h->cal_txn, wsi);
r = lws_ss_event_helper(h, LWSSSCS_CONNECTED);
if (r != LWSSSSRET_OK)
return _lws_ss_handle_state_ret_CAN_DESTROY_HANDLE(r, wsi, &h);
@ -742,12 +741,7 @@ malformed:
h->being_serialized && (
!strcmp(h->policy->u.http.method, "PUT") ||
!strcmp(h->policy->u.http.method, "POST"))) {
#if defined(LWS_WITH_SYS_METRICS)
/*
* If any hanging caliper measurement, dump it, and free any tags
*/
lws_metrics_caliper_report_hist(h->cal_txn, (struct lws *)NULL);
#endif
r = lws_ss_event_helper(h, LWSSSCS_CONNECTED);
if (r)
return _lws_ss_handle_state_ret_CAN_DESTROY_HANDLE(r, wsi, &h);

View file

@ -885,7 +885,5 @@ lws_metrics_hist_bump_priv_tagged(lws_metric_pub_t *mt, lws_dll2_owner_t *tow,
lws_metrics_tags_serialize(tow2, qual + p,
sizeof(qual) - p);
lwsl_warn("%s: '%s'\n", __func__, qual);
lws_metrics_hist_bump(mt, qual);
}