@@ -82,6 +82,10 @@ class MethodExceptionsAndLatencies(Enum):
8282 TREATMENTS = 'treatments'
8383 TREATMENT_WITH_CONFIG = 'treatment_with_config'
8484 TREATMENTS_WITH_CONFIG = 'treatments_with_config'
85+ TREATMENTS_BY_FLAG_SET = 'treatments_by_flag_set'
86+ TREATMENTS_BY_FLAG_SETS = 'treatments_by_flag_sets'
87+ TREATMENTS_WITH_CONFIG_BY_FLAG_SET = 'treatments_with_config_by_flag_set'
88+ TREATMENTS_WITH_CONFIG_BY_FLAG_SETS = 'treatments_with_config_by_flag_sets'
8589 TRACK = 'track'
8690
8791class LastSynchronizationConstants (Enum ):
@@ -166,6 +170,10 @@ def _reset_all(self):
166170 self ._treatments = [0 ] * MAX_LATENCY_BUCKET_COUNT
167171 self ._treatment_with_config = [0 ] * MAX_LATENCY_BUCKET_COUNT
168172 self ._treatments_with_config = [0 ] * MAX_LATENCY_BUCKET_COUNT
173+ self ._treatments_by_flag_set = [0 ] * MAX_LATENCY_BUCKET_COUNT
174+ self ._treatments_by_flag_sets = [0 ] * MAX_LATENCY_BUCKET_COUNT
175+ self ._treatments_with_config_by_flag_set = [0 ] * MAX_LATENCY_BUCKET_COUNT
176+ self ._treatments_with_config_by_flag_sets = [0 ] * MAX_LATENCY_BUCKET_COUNT
169177 self ._track = [0 ] * MAX_LATENCY_BUCKET_COUNT
170178
171179 def add_latency (self , method , latency ):
@@ -187,6 +195,14 @@ def add_latency(self, method, latency):
187195 self ._treatment_with_config [latency_bucket ] += 1
188196 elif method == MethodExceptionsAndLatencies .TREATMENTS_WITH_CONFIG :
189197 self ._treatments_with_config [latency_bucket ] += 1
198+ elif method == MethodExceptionsAndLatencies .TREATMENTS_BY_FLAG_SET :
199+ self ._treatments_by_flag_set [latency_bucket ] += 1
200+ elif method == MethodExceptionsAndLatencies .TREATMENTS_BY_FLAG_SETS :
201+ self ._treatments_by_flag_sets [latency_bucket ] += 1
202+ elif method == MethodExceptionsAndLatencies .TREATMENTS_WITH_CONFIG_BY_FLAG_SET :
203+ self ._treatments_with_config_by_flag_set [latency_bucket ] += 1
204+ elif method == MethodExceptionsAndLatencies .TREATMENTS_WITH_CONFIG_BY_FLAG_SETS :
205+ self ._treatments_with_config_by_flag_sets [latency_bucket ] += 1
190206 elif method == MethodExceptionsAndLatencies .TRACK :
191207 self ._track [latency_bucket ] += 1
192208 else :
@@ -200,10 +216,18 @@ def pop_all(self):
200216 :rtype: dict
201217 """
202218 with self ._lock :
203- latencies = {MethodExceptionsAndLatencies .METHOD_LATENCIES .value : {MethodExceptionsAndLatencies .TREATMENT .value : self ._treatment , MethodExceptionsAndLatencies .TREATMENTS .value : self ._treatments ,
204- MethodExceptionsAndLatencies .TREATMENT_WITH_CONFIG .value : self ._treatment_with_config , MethodExceptionsAndLatencies .TREATMENTS_WITH_CONFIG .value : self ._treatments_with_config ,
205- MethodExceptionsAndLatencies .TRACK .value : self ._track }
219+ latencies = {MethodExceptionsAndLatencies .METHOD_LATENCIES .value : {
220+ MethodExceptionsAndLatencies .TREATMENT .value : self ._treatment ,
221+ MethodExceptionsAndLatencies .TREATMENTS .value : self ._treatments ,
222+ MethodExceptionsAndLatencies .TREATMENT_WITH_CONFIG .value : self ._treatment_with_config ,
223+ MethodExceptionsAndLatencies .TREATMENTS_WITH_CONFIG .value : self ._treatments_with_config ,
224+ MethodExceptionsAndLatencies .TREATMENTS_BY_FLAG_SET .value : self ._treatments_by_flag_set ,
225+ MethodExceptionsAndLatencies .TREATMENTS_BY_FLAG_SETS .value : self ._treatments_by_flag_sets ,
226+ MethodExceptionsAndLatencies .TREATMENTS_WITH_CONFIG_BY_FLAG_SET .value : self ._treatments_with_config_by_flag_set ,
227+ MethodExceptionsAndLatencies .TREATMENTS_WITH_CONFIG_BY_FLAG_SETS .value : self ._treatments_with_config_by_flag_sets ,
228+ MethodExceptionsAndLatencies .TRACK .value : self ._track
206229 }
230+ }
207231 self ._reset_all ()
208232 return latencies
209233
@@ -288,6 +312,10 @@ def _reset_all(self):
288312 self ._treatments = 0
289313 self ._treatment_with_config = 0
290314 self ._treatments_with_config = 0
315+ self ._treatments_by_flag_set = 0
316+ self ._treatments_by_flag_sets = 0
317+ self ._treatments_with_config_by_flag_set = 0
318+ self ._treatments_with_config_by_flag_sets = 0
291319 self ._track = 0
292320
293321 def add_exception (self , method ):
@@ -306,6 +334,14 @@ def add_exception(self, method):
306334 self ._treatment_with_config += 1
307335 elif method == MethodExceptionsAndLatencies .TREATMENTS_WITH_CONFIG :
308336 self ._treatments_with_config += 1
337+ elif method == MethodExceptionsAndLatencies .TREATMENTS_BY_FLAG_SET :
338+ self ._treatments_by_flag_set += 1
339+ elif method == MethodExceptionsAndLatencies .TREATMENTS_BY_FLAG_SETS :
340+ self ._treatments_by_flag_sets += 1
341+ elif method == MethodExceptionsAndLatencies .TREATMENTS_WITH_CONFIG_BY_FLAG_SET :
342+ self ._treatments_with_config_by_flag_set += 1
343+ elif method == MethodExceptionsAndLatencies .TREATMENTS_WITH_CONFIG_BY_FLAG_SETS :
344+ self ._treatments_with_config_by_flag_sets += 1
309345 elif method == MethodExceptionsAndLatencies .TRACK :
310346 self ._track += 1
311347 else :
@@ -319,10 +355,18 @@ def pop_all(self):
319355 :rtype: dict
320356 """
321357 with self ._lock :
322- exceptions = {MethodExceptionsAndLatencies .METHOD_EXCEPTIONS .value : {MethodExceptionsAndLatencies .TREATMENT .value : self ._treatment , MethodExceptionsAndLatencies .TREATMENTS .value : self ._treatments ,
323- MethodExceptionsAndLatencies .TREATMENT_WITH_CONFIG .value : self ._treatment_with_config , MethodExceptionsAndLatencies .TREATMENTS_WITH_CONFIG .value : self ._treatments_with_config ,
324- MethodExceptionsAndLatencies .TRACK .value : self ._track }
358+ exceptions = {MethodExceptionsAndLatencies .METHOD_EXCEPTIONS .value : {
359+ MethodExceptionsAndLatencies .TREATMENT .value : self ._treatment ,
360+ MethodExceptionsAndLatencies .TREATMENTS .value : self ._treatments ,
361+ MethodExceptionsAndLatencies .TREATMENT_WITH_CONFIG .value : self ._treatment_with_config ,
362+ MethodExceptionsAndLatencies .TREATMENTS_WITH_CONFIG .value : self ._treatments_with_config ,
363+ MethodExceptionsAndLatencies .TREATMENTS_BY_FLAG_SET .value : self ._treatments_by_flag_set ,
364+ MethodExceptionsAndLatencies .TREATMENTS_BY_FLAG_SETS .value : self ._treatments_by_flag_sets ,
365+ MethodExceptionsAndLatencies .TREATMENTS_WITH_CONFIG_BY_FLAG_SET .value : self ._treatments_with_config_by_flag_set ,
366+ MethodExceptionsAndLatencies .TREATMENTS_WITH_CONFIG_BY_FLAG_SETS .value : self ._treatments_with_config_by_flag_sets ,
367+ MethodExceptionsAndLatencies .TRACK .value : self ._track
325368 }
369+ }
326370 self ._reset_all ()
327371 return exceptions
328372
0 commit comments