From 9f803a63d4f058997221e8dc96c96335a456dadf Mon Sep 17 00:00:00 2001
From: gifrerenom <lluis.gifre@cttc.es>
Date: Thu, 20 Apr 2023 13:10:04 +0000
Subject: [PATCH] Service component - P4 ServiceHandler:

- Removed hardcoded histogram buckets
---
 .../service_handlers/p4/p4_service_handler.py   | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

diff --git a/src/service/service/service_handlers/p4/p4_service_handler.py b/src/service/service/service_handlers/p4/p4_service_handler.py
index 8d609c11c..41cfcc595 100644
--- a/src/service/service/service_handlers/p4/p4_service_handler.py
+++ b/src/service/service/service_handlers/p4/p4_service_handler.py
@@ -18,7 +18,7 @@ P4 service handler for the TeraFlowSDN controller.
 
 import logging
 from typing import Any, List, Optional, Tuple, Union
-from common.method_wrappers.Decorator import MetricTypeEnum, MetricsPool, metered_subclass_method, INF
+from common.method_wrappers.Decorator import MetricsPool, metered_subclass_method
 from common.proto.context_pb2 import ConfigRule, DeviceId, Service
 from common.tools.object_factory.ConfigRule import json_config_rule_delete, json_config_rule_set
 from common.tools.object_factory.Device import json_device_id
@@ -28,22 +28,7 @@ from service.service.task_scheduler.TaskExecutor import TaskExecutor
 
 LOGGER = logging.getLogger(__name__)
 
-HISTOGRAM_BUCKETS = (
-    # .005, .01, .025, .05, .075, .1, .25, .5, .75, 1.0, INF
-    0.0010, 0.0025, 0.0050, 0.0075,
-    0.0100, 0.0250, 0.0500, 0.0750,
-    0.1000, 0.2500, 0.5000, 0.7500,
-    1.0000, 2.5000, 5.0000, 7.5000,
-    10.0000, 25.000, 50.0000, 75.000,
-    100.0, INF
-)
 METRICS_POOL = MetricsPool('Service', 'Handler', labels={'handler': 'p4'})
-METRICS_POOL.get_or_create('SetEndpoint',      MetricTypeEnum.HISTOGRAM_DURATION, buckets=HISTOGRAM_BUCKETS)
-METRICS_POOL.get_or_create('DeleteEndpoint',   MetricTypeEnum.HISTOGRAM_DURATION, buckets=HISTOGRAM_BUCKETS)
-METRICS_POOL.get_or_create('SetConstraint',    MetricTypeEnum.HISTOGRAM_DURATION, buckets=HISTOGRAM_BUCKETS)
-METRICS_POOL.get_or_create('DeleteConstraint', MetricTypeEnum.HISTOGRAM_DURATION, buckets=HISTOGRAM_BUCKETS)
-METRICS_POOL.get_or_create('SetConfig',        MetricTypeEnum.HISTOGRAM_DURATION, buckets=HISTOGRAM_BUCKETS)
-METRICS_POOL.get_or_create('DeleteConfig',     MetricTypeEnum.HISTOGRAM_DURATION, buckets=HISTOGRAM_BUCKETS)
 
 def create_rule_set(endpoint_a, endpoint_b):
     return json_config_rule_set(
-- 
GitLab