MINOR: tevt/stream/stconn: Report termination events for stream and sc

In this patch, events for the stream location are reported. These events are
first reported on the corresponding stream-connector. So front events on scf
and back event on scb. Then all events are both merged in the stream. But
only 4 events are saved on the stream.

Several internal events are for now grouped with the type
"tevt_type_intercepted". More events will be added to have a better
resolution. But at least the place to report these events are identified.

For now, when a event is reported on a SC, it is also reported on the stream
and vice versa.
This commit is contained in:
Christopher Faulet
2024-12-23 14:30:33 +01:00
parent 147b6d3d4d
commit 00a07c8b54
8 changed files with 83 additions and 18 deletions

View File

@@ -347,6 +347,7 @@ struct stconn {
unsigned int flags; /* SC_FL_* */
unsigned int ioto; /* I/O activity timeout */
uint32_t term_evts_log; /* termination events log aggregating SE + connection events */
ssize_t room_needed; /* free space in the input buffer required to receive more data.
* -1 : the SC is waiting for room but not on a specific amount of data
* >= 0 : min free space required to progress. 0 means SC must be unblocked ASAP

View File

@@ -565,4 +565,13 @@ static inline size_t se_done_ff(struct sedesc *se)
return ret;
}
static inline void sc_report_term_evt(struct stconn *sc, enum term_event_loc loc, enum term_event_type type)
{
if (sc->flags & SC_FL_ISBACK)
loc += 8;
sc->term_evts_log = tevt_report_event(sc->term_evts_log, loc, type);
if (sc_strm(sc))
__sc_strm(sc)->term_evts_log = tevt_report_event(__sc_strm(sc)->term_evts_log, loc, type);
}
#endif /* _HAPROXY_STCONN_H */

View File

@@ -324,6 +324,7 @@ struct stream {
} waiting_entity; /* The entity waiting to continue its processing and interrupted by an error/timeout */
unsigned int stream_epoch; /* copy of stream_epoch when the stream was created */
uint32_t term_evts_log; /* termination events log */
struct hlua *hlua[2]; /* lua runtime context (0: global, 1: per-thread) */
/* Context */

View File

@@ -418,6 +418,19 @@ static inline unsigned int stream_map_task_state(unsigned int state)
0;
}
static inline void stream_report_term_evt(struct stconn *sc, enum term_event_loc loc, enum term_event_type type)
{
struct stream *s = sc_strm(sc);
if (!s)
return;
if (sc->flags & SC_FL_ISBACK)
loc += 8;
s->term_evts_log = tevt_report_event(s->term_evts_log, loc, type);
sc->term_evts_log = tevt_report_event(sc->term_evts_log, loc, type);
}
int stream_set_timeout(struct stream *s, enum act_timeout_name name, int timeout);
void stream_retnclose(struct stream *s, const struct buffer *msg);