]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: counters: add sc1_trackers/sc2_trackers
authorWilly Tarreau <w@1wt.eu>
Sun, 9 Dec 2012 11:16:43 +0000 (12:16 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 9 Dec 2012 13:08:47 +0000 (14:08 +0100)
Returns the current amount of concurrent connections tracking the same
tracked counters. This number is automatically incremented when tracking
begins and decremented when tracking stops. It differs from sc1_conn_cur in
that it does not rely on any stored information but on the table's reference
count (the "use" value which is returned by "show table" on the CLI). This
may sometimes be more suited for layer7 tracking.

doc/configuration.txt
src/session.c

index bfd97299512e20d9203f4e99d9070809a659bcce..8128c53f0c4fb86f18ae17ca035dad8a7917c2b0 100644 (file)
@@ -8276,6 +8276,15 @@ sc2_sess_rate
   connection could result in many backend sessions if some HTTP keep-alive is
   performed over the connection with the client. See also src_sess_rate.
 
+sc1_trackers
+sc2_trackers
+  Returns the current amount of concurrent connections tracking the same
+  tracked counters. This number is automatically incremented when tracking
+  begins and decremented when tracking stops. It differs from sc1_conn_cur in
+  that it does not rely on any stored information but on the table's reference
+  count (the "use" value which is returned by "show table" on the CLI). This
+  may sometimes be more suited for layer7 tracking.
+
 so_id <integer>
   Applies to the socket's id. Useful in frontends with many bind keywords.
 
index 0bee9576ee9a32f3b2900a07d75ccb945696c42c..a4c53a16093db9bb0c5286b3e2c1f63bc27e58cc 100644 (file)
@@ -3597,6 +3597,28 @@ acl_fetch_src_bytes_out_rate(struct proxy *px, struct session *l4, void *l7, uns
        return acl_fetch_bytes_out_rate(&px->table, smp, stktable_lookup_key(&px->table, key));
 }
 
+/* set temp integer to the number of active trackers on the SC1 entry */
+static int
+acl_fetch_sc1_trackers(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+                       const struct arg *args, struct sample *smp)
+{
+       if (!l4->stkctr1_entry)
+               return 0;
+
+       return l4->stkctr1_entry->ref_cnt;
+}
+
+/* set temp integer to the number of active trackers on the SC1 entry */
+static int
+acl_fetch_sc2_trackers(struct proxy *px, struct session *l4, void *l7, unsigned int opt,
+                       const struct arg *args, struct sample *smp)
+{
+       if (!l4->stkctr2_entry)
+               return 0;
+
+       return l4->stkctr2_entry->ref_cnt;
+}
+
 /* set temp integer to the number of used entries in the table pointed to by expr.
  * Accepts exactly 1 argument of type table.
  */
@@ -3644,6 +3666,7 @@ static struct acl_kw_list acl_kws = {{ },{
        { "sc1_kbytes_out",     acl_parse_int,   acl_fetch_sc1_kbytes_out,     acl_match_int, ACL_USE_TCP4_VOLATILE, 0 },
        { "sc1_sess_cnt",       acl_parse_int,   acl_fetch_sc1_sess_cnt,       acl_match_int, ACL_USE_NOTHING,       0 },
        { "sc1_sess_rate",      acl_parse_int,   acl_fetch_sc1_sess_rate,      acl_match_int, ACL_USE_NOTHING,       0 },
+       { "sc1_trackers",       acl_parse_int,   acl_fetch_sc1_trackers,       acl_match_int, ACL_USE_NOTHING,       0 },
        { "sc2_bytes_in_rate",  acl_parse_int,   acl_fetch_sc2_bytes_in_rate,  acl_match_int, ACL_USE_NOTHING,       0 },
        { "sc2_bytes_out_rate", acl_parse_int,   acl_fetch_sc2_bytes_out_rate, acl_match_int, ACL_USE_NOTHING,       0 },
        { "sc2_clr_gpc0",       acl_parse_int,   acl_fetch_sc2_clr_gpc0,       acl_match_int, ACL_USE_NOTHING,       0 },
@@ -3660,6 +3683,7 @@ static struct acl_kw_list acl_kws = {{ },{
        { "sc2_kbytes_out",     acl_parse_int,   acl_fetch_sc2_kbytes_out,     acl_match_int, ACL_USE_TCP4_VOLATILE, 0 },
        { "sc2_sess_cnt",       acl_parse_int,   acl_fetch_sc2_sess_cnt,       acl_match_int, ACL_USE_NOTHING,       0 },
        { "sc2_sess_rate",      acl_parse_int,   acl_fetch_sc2_sess_rate,      acl_match_int, ACL_USE_NOTHING,       0 },
+       { "sc2_trackers",       acl_parse_int,   acl_fetch_sc2_trackers,       acl_match_int, ACL_USE_NOTHING,       0 },
        { "src_bytes_in_rate",  acl_parse_int,   acl_fetch_src_bytes_in_rate,  acl_match_int, ACL_USE_TCP4_VOLATILE, ARG1(1,TAB) },
        { "src_bytes_out_rate", acl_parse_int,   acl_fetch_src_bytes_out_rate, acl_match_int, ACL_USE_TCP4_VOLATILE, ARG1(1,TAB) },
        { "src_clr_gpc0",       acl_parse_int,   acl_fetch_src_clr_gpc0,       acl_match_int, ACL_USE_TCP4_VOLATILE, ARG1(1,TAB) },