Commit ebfe46cf authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

NBI component:

- Deactivated metrics as no endpoint uses them and they cause "address already in use" when launching multiple `gunicorn` workers.
parent 686b4086
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -33,7 +33,10 @@ spec:
          imagePullPolicy: Always
          ports:
            - containerPort: 8080
            - containerPort: 9192
            # Metrics disabled for now. No NBI endpoint uses it and
            # causes "address already in use" when deploying multiple
            # gunicorn workers.
            #- containerPort: 9192
          env:
            - name: LOG_LEVEL
              value: "INFO"
@@ -78,7 +81,10 @@ spec:
      protocol: TCP
      port: 8080
      targetPort: 8080
    - name: metrics
      protocol: TCP
      port: 9192
      targetPort: 9192
    # Metrics disabled for now. No NBI endpoint uses it and
    # causes "address already in use" when deploying multiple
    # gunicorn workers.
    #- name: metrics
    #  protocol: TCP
    #  port: 9192
    #  targetPort: 9192
+19 −5
Original line number Diff line number Diff line
@@ -14,12 +14,23 @@

import logging
from typing import Optional
from prometheus_client import start_http_server

# NOTE: Metrics disabled for now. No NBI endpoint uses it and
# causes "address already in use" when deploying multiple
# gunicorn workers.
#from prometheus_client import start_http_server

from common.Constants import ServiceNameEnum
from common.Settings import (
    ENVVAR_SUFIX_SERVICE_HOST, ENVVAR_SUFIX_SERVICE_PORT_GRPC,
    get_env_var_name, get_http_bind_address, get_log_level,
    get_metrics_port, get_service_baseurl_http, get_service_port_http,

    # NOTE: Metrics disabled for now. No NBI endpoint uses it and
    # causes "address already in use" when deploying multiple
    # gunicorn workers.
    #get_metrics_port,

    get_service_baseurl_http, get_service_port_http,
    wait_for_environment_variables
)
from .NbiApplication import NbiApplication
@@ -73,8 +84,11 @@ def configure_nbi(
    LOGGER.info('Starting...')

    # Start metrics server
    metrics_port = get_metrics_port()
    start_http_server(metrics_port)
    # NOTE: Metrics disabled for now. No NBI endpoint uses it and
    # causes "address already in use" when deploying multiple
    # gunicorn workers.
    #metrics_port = get_metrics_port()
    #start_http_server(metrics_port)

    nbi_app = NbiApplication(base_url=base_url)

@@ -85,7 +99,7 @@ def configure_nbi(

    return nbi_app

nbi_app = configure_nbi(base_url=BASE_URL)
_nbi_app = configure_nbi(base_url=BASE_URL)

if __name__ == '__main__':
    # Only used to run it locally during development stage;