diff --git a/manifests/nbiservice.yaml b/manifests/nbiservice.yaml index 108195d377d9958203ee36f1fe6e949eda34a197..7725cb5017dee7af7c5261e995723a62774e7d98 100644 --- a/manifests/nbiservice.yaml +++ b/manifests/nbiservice.yaml @@ -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 diff --git a/src/nbi/service/app.py b/src/nbi/service/app.py index b37a90a3cbd5d1d539cc112fc0999082ef53099e..f45b87b2c3baeddc149134c011f9e854d44bbfa3 100644 --- a/src/nbi/service/app.py +++ b/src/nbi/service/app.py @@ -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;