From 893a1a006924c08de7b58c6d039f94cd96e87601 Mon Sep 17 00:00:00 2001
From: David Schmitz <schmitz@lrz.de>
Date: Thu, 26 Oct 2023 13:13:08 +0000
Subject: [PATCH] fix/wrong_ratelimit_stats: update of
 ./doc/development/format_of_snmp_json_db_file.txt to reflect new distinct
 matched and dropped stat values

---
 .../format_of_snmp_json_db_file.txt           | 27 +++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/doc/development/format_of_snmp_json_db_file.txt b/doc/development/format_of_snmp_json_db_file.txt
index e5387ea4..59bb845d 100644
--- a/doc/development/format_of_snmp_json_db_file.txt
+++ b/doc/development/format_of_snmp_json_db_file.txt
@@ -1,5 +1,12 @@
 
-statistics table:
+== format of statistics table 
+
+stored as JSON
+
+configured with key 'SNMP_TEMP_FILE' in ./flowspy/settings.py, e.g., with file name './snmp_temp_data'
+
+
+=== 1. measurement entries per time (per rule id) in general:
 
 a measurement value
 per rule,
@@ -39,7 +46,7 @@ zero measurement: = { bytes=>0, packets=>0, } : at start of measurement = activa
 
 or
 
-real measurement (example): = { bytes=>1414, packets=>5, } : cumulative (=absolue values from start of measurement = from last activation of the rule) bytes/packet counters 
+real measurement (example): = { bytes=>1414, packets=>5, } : cumulative (=absolute values from start of measurement = from last activation of the rule) bytes/packet counters 
 
 or 
 
@@ -50,4 +57,20 @@ null_value: =0 : used when rule is deactivated = measurement should stop on the
 when rule is re-activated again on the router after some duration of having been deactivated it is started again with a zero measurement in the table and absolute values for the future real measurement are starting from zero again
 
 
+=== 2. support of distinct values for matched and dropped bytes/packets per time (in case of rules with rate-limiting):
+
+for rules with rate-limiting now there are 2 distinct kinds of statistics, 
+one for matched bytes/packets and one for dropped bytes/packets
+(for rules with drop action there is essentially only one statistic,
+as matched and dropped values are always the same).
+
+for rate-limiting rule in the statistic entry per time value (see 1.)
+with the array key "value" the matched statistic values (bytes and packets) are available,
+while with the array key "value_dropped" the dropped statistic values (bytes and packets) are available.
+
+For statistic entries created in the past before this distinction of statistic kinds
+was introduced only the "value" part (representing the matched values) will be available,
+only for new, future entries "value_dropped" is available.
+
+
 
-- 
GitLab