]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: session: Add functions to increase http values of tracked counters
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 6 Oct 2020 12:23:34 +0000 (14:23 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 4 Dec 2020 13:41:49 +0000 (14:41 +0100)
cumulative numbers of http request and http errors of counters tracked at
the session level and their rates can now be updated at the session level
thanks to two new functions. These functions are not used for now, but it
will be called to keep tracked counters up-to-date if an error occurs before
the stream creation.

include/haproxy/session.h

index fa21dda6cc19133ace4569a937441180d5d915a7..205bd82ac35334cb867dbd212ea514d27ac7f57a 100644 (file)
@@ -73,6 +73,30 @@ static inline void session_store_counters(struct session *sess)
        }
 }
 
+/* Increase the number of cumulated HTTP requests in the tracked counters */
+static inline void session_inc_http_req_ctr(struct session *sess)
+{
+       int i;
+
+       for (i = 0; i < MAX_SESS_STKCTR; i++)
+               stkctr_inc_http_req_ctr(&sess->stkctr[i]);
+}
+
+/* Increase the number of cumulated failed HTTP requests in the tracked
+ * counters. Only 4xx requests should be counted here so that we can
+ * distinguish between errors caused by client behaviour and other ones.
+ * Note that even 404 are interesting because they're generally caused by
+ * vulnerability scans.
+ */
+static inline void session_inc_http_err_ctr(struct session *sess)
+{
+       int i;
+
+       for (i = 0; i < MAX_SESS_STKCTR; i++)
+               stkctr_inc_http_err_ctr(&sess->stkctr[i]);
+}
+
+
 /* Remove the connection from the session list, and destroy the srv_list if it's now empty */
 static inline void session_unown_conn(struct session *sess, struct connection *conn)
 {