Skip to content

Commit

Permalink
track more per-connection stats
Browse files Browse the repository at this point in the history
  • Loading branch information
alandekok committed Dec 26, 2024
1 parent c51b045 commit 07e6b87
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/lib/server/trunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -1279,6 +1279,9 @@ static void trunk_request_enter_sent(trunk_request_t *treq)
* first time this request is being sent.
*/
if (!treq->sent) {
trunk->pub.last_write_success = fr_time();

tconn->pub.last_write_success = trunk->pub.last_write_success;
tconn->sent_count++;
treq->sent = true;

Expand Down Expand Up @@ -2102,7 +2105,12 @@ void trunk_request_signal_complete(trunk_request_t *treq)
* then we need to add an argument to signal_complete
* to indicate if this is a successful read.
*/
if (IN_REQUEST_DEMUX(trunk)) trunk->pub.last_read_success = fr_time();
if (IN_REQUEST_DEMUX(trunk)) {
trunk_connection_t *tconn = treq->pub.tconn;

trunk->pub.last_read_success = fr_time();
tconn->pub.last_read_success = trunk->pub.last_read_success;
}

switch (treq->pub.state) {
case TRUNK_REQUEST_STATE_SENT:
Expand Down
6 changes: 6 additions & 0 deletions src/lib/server/trunk.h
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,8 @@ struct trunk_pub_s {

fr_time_t _CONST last_failed; //!< Last time a connection failed.

fr_time_t _CONST last_write_success; //!< Last time we wrote to the connection

fr_time_t _CONST last_read_success; //!< Last time we read a response.
/** @} */

Expand Down Expand Up @@ -364,6 +366,10 @@ struct trunk_connection_pub_s {

connection_t * _CONST conn; //!< The underlying connection.

fr_time_t _CONST last_write_success; //!< Last time we wrote to the connection

fr_time_t _CONST last_read_success; //!< Last time we read from the connection

trunk_t * _CONST trunk; //!< Trunk this connection belongs to.
};

Expand Down

0 comments on commit 07e6b87

Please sign in to comment.