MINOR: tevt/applet: Add limited support for termination event logs for applets

There is no termination events log for applet but events for the SE location
are filled when the endpoint is an applet. Most of them relies on the new
applet API. Only few events are reported for legacy applets.
This commit is contained in:
Christopher Faulet 2025-01-21 07:41:33 +01:00
parent cbd898c42b
commit eb2f1a4ba4
2 changed files with 15 additions and 0 deletions

View File

@ -558,6 +558,11 @@ size_t appctx_rcv_buf(struct stconn *sc, struct buffer *buf, size_t count, unsig
se_fl_set(appctx->sedesc, SE_FL_ERROR);
TRACE_STATE("report ERROR to SE", APPLET_EV_RECV|APPLET_EV_BLK, appctx);
}
if (applet_fl_test(appctx, APPCTX_FL_ERROR))
se_report_term_evt(appctx->sedesc, !applet_fl_test(appctx, APPCTX_FL_EOI) ? se_tevt_type_truncated_rcv_err : se_tevt_type_rcv_err);
else if (applet_fl_test(appctx, APPCTX_FL_EOS))
se_report_term_evt(appctx->sedesc, !applet_fl_test(appctx, APPCTX_FL_EOI) ? se_tevt_type_truncated_eos : se_tevt_type_eos);
}
end:
@ -632,6 +637,9 @@ size_t appctx_snd_buf(struct stconn *sc, struct buffer *buf, size_t count, unsig
ret = appctx->applet->snd_buf(appctx, buf, count, flags);
if (applet_fl_test(appctx, (APPCTX_FL_ERROR|APPCTX_FL_ERR_PENDING)))
se_report_term_evt(appctx->sedesc, se_tevt_type_snd_err);
end:
if (applet_fl_test(appctx, (APPCTX_FL_ERROR|APPCTX_FL_ERR_PENDING))) {
BUG_ON((applet_fl_get(appctx) & (APPCTX_FL_EOS|APPCTX_FL_ERROR|APPCTX_FL_ERR_PENDING)) == (APPCTX_FL_EOS|APPCTX_FL_ERR_PENDING));
@ -712,6 +720,11 @@ int appctx_fastfwd(struct stconn *sc, unsigned int count, unsigned int flags)
/* else */
/* applet_have_more_data(appctx); */
if (applet_fl_test(appctx, APPCTX_FL_ERROR))
se_report_term_evt(appctx->sedesc, !applet_fl_test(appctx, APPCTX_FL_EOI) ? se_tevt_type_truncated_rcv_err : se_tevt_type_rcv_err);
else if (applet_fl_test(appctx, APPCTX_FL_EOS))
se_report_term_evt(appctx->sedesc, !applet_fl_test(appctx, APPCTX_FL_EOI) ? se_tevt_type_truncated_eos : se_tevt_type_eos);
if (se_done_ff(sdo) != 0 || !(sdo->iobuf.flags & (IOBUF_FL_FF_BLOCKED|IOBUF_FL_FF_WANT_ROOM))) {
/* Something was forwarding or the consumer states it is not
* blocked anyore, don't reclaim more room */

View File

@ -969,6 +969,7 @@ static void sc_app_shut_applet(struct stconn *sc)
sc->flags |= SC_FL_SHUT_DONE;
oc->flags |= CF_WRITE_EVENT;
sc_set_hcto(sc);
sc_report_term_evt(sc, strm_tevt_type_shutw);
/* on shutw we always wake the applet up */
appctx_wakeup(__sc_appctx(sc));
@ -1946,6 +1947,7 @@ static void sc_applet_eos(struct stconn *sc)
sc->flags |= SC_FL_EOS;
ic->flags |= CF_READ_EVENT;
sc_ep_report_read_activity(sc);
sc_report_term_evt(sc, (sc->flags & SC_FL_EOI ? strm_tevt_type_eos: strm_tevt_type_truncated_eos));
/* Note: on abort, we don't call the applet */