Commit 72afa877 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Slice component:

- added workaround for multi-instance deployments
parent 19328bbc
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ class SliceGrouper:
    def __init__(self) -> None:
        self._lock = threading.Lock()
        self._is_enabled = is_slice_grouping_enabled()
        LOGGER.info('Slice Grouping: {:s}'.format('ENABLED' if self._is_enabled else 'DISABLED'))
        if not self._is_enabled: return

        metrics_exporter = MetricsExporter()
+8 −0
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import logging
from typing import Dict, List, Optional, Set, Tuple
from common.Constants import DEFAULT_CONTEXT_NAME
from common.Settings import get_setting
@@ -27,7 +28,14 @@ TRUE_VALUES = {'Y', 'YES', 'TRUE', 'T', 'E', 'ENABLE', 'ENABLED'}

NO_ISOLATION = IsolationLevelEnum.NO_ISOLATION

LOGGER = logging.getLogger(__name__)

def is_slice_grouping_enabled() -> bool:
    # Temporal hack for OFC'23 multi-demo:
    metricsdb_hostname = get_setting('METRICSDB_HOSTNAME', default='')
    LOGGER.warning('metricsdb_hostname={:s}'.format(str(metricsdb_hostname)))
    if '.qdb-sligrp.' in metricsdb_hostname: return True
    # end hack
    is_enabled = get_setting(SETTING_NAME_SLICE_GROUPING, default=None)
    if is_enabled is None: return False
    str_is_enabled = str(is_enabled).upper()