Skip to content
Snippets Groups Projects
Commit 359705e3 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Common - Method Wrappers:

- corrected metrics names
parent ed1e9819
No related branches found
No related tags found
2 merge requests!54Release 2.0.0,!34Context Scalability extensions using CockroachDB + Removal of Stateful database inside Device + other
...@@ -100,7 +100,7 @@ class MetricsPool: ...@@ -100,7 +100,7 @@ class MetricsPool:
if field_name == '_bucket': bucket_bounds.add(labels['le']) if field_name == '_bucket': bucket_bounds.add(labels['le'])
if len(labels) > 0: field_name = '{:s}:{:s}'.format(field_name, json.dumps(labels, sort_keys=True)) if len(labels) > 0: field_name = '{:s}:{:s}'.format(field_name, json.dumps(labels, sort_keys=True))
metric_data[field_name] = value metric_data[field_name] = value
print('method_to_metric_fields', method_to_metric_fields) #print('method_to_metric_fields', method_to_metric_fields)
def sort_stats_key(item : List) -> float: def sort_stats_key(item : List) -> float:
str_duration = str(item[0]) str_duration = str(item[0])
...@@ -118,12 +118,12 @@ class MetricsPool: ...@@ -118,12 +118,12 @@ class MetricsPool:
for f in ['Method']: pt_stats.align[f] = 'l' for f in ['Method']: pt_stats.align[f] = 'l'
for method_name,metrics in method_to_metric_fields.items(): for method_name,metrics in method_to_metric_fields.items():
counter_started_value = int(metrics['STARTED']['_total']) counter_started_value = int(metrics['REQUESTS_STARTED']['_total'])
if counter_started_value == 0: if counter_started_value == 0:
#pt_stats.add_row([method_name, '---', '---', '---', '---']) #pt_stats.add_row([method_name, '---', '---', '---', '---'])
continue continue
counter_completed_value = int(metrics['COMPLETED']['_total']) counter_completed_value = int(metrics['REQUESTS_COMPLETED']['_total'])
counter_failed_value = int(metrics['FAILED']['_total']) counter_failed_value = int(metrics['REQUESTS_FAILED']['_total'])
duration_count_value = float(metrics['DURATION']['_count']) duration_count_value = float(metrics['DURATION']['_count'])
duration_sum_value = float(metrics['DURATION']['_sum']) duration_sum_value = float(metrics['DURATION']['_sum'])
duration_avg_value = duration_sum_value/duration_count_value duration_avg_value = duration_sum_value/duration_count_value
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment