Commit d101ce05 authored by Sergio Gonzalez Diaz's avatar Sergio Gonzalez Diaz
Browse files

Update monitoring service with logging

parent f5f3aeee
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -30,8 +30,8 @@ kubernetes test:
    # - kubectl get all
    # - kubectl delete -f "manifests/monitoring.yaml"
    # - sleep 15
    # - kubectl apply -f "manifests/monitoring.yaml"
    # - sleep 30
    - kubectl apply -f "manifests/monitoring.yaml"
    - sleep 30
    # - kubectl get all
    - kubectl --namespace gitlab-ci describe pod monitoring-595c885c6c-fmb7b
    - kubectl --namespace gitlab-ci logs monitoring-595c885c6c-fmb7b influxdb
+3 −1
Original line number Diff line number Diff line
@@ -25,7 +25,9 @@ class MonitoringServiceServicerImpl(monitoring_pb2_grpc.MonitoringServiceService
        LOGGER.info('Init monitoringService')
        # Init sqlite monitoring db
        self.sql_db = sqlite_tools.SQLite('monitoring.db')

        LOGGER.info(INFLUXDB_USER)
        LOGGER.info(INFLUXDB_PASS)
        LOGGER.info(INFLUXDB_DB)
        # Create influx_db client
        self.influx_db = influx_tools.Influx("localhost","8086",INFLUXDB_USER,INFLUXDB_PASS,INFLUXDB_DB)

+3 −2
Original line number Diff line number Diff line
@@ -35,11 +35,12 @@ def main():
    signal.signal(signal.SIGTERM, signal_handler)

    logger.info('Starting...')

    logger.info(GRPC_SERVICE_PORT)
    logger.info(service_port)
    # Start metrics server
    start_http_server(metrics_port)

    # Starting device service
    # Starting monitoring service
    grpc_service = MonitoringService(port=service_port, max_workers=max_workers, grace_period=grace_period)
    grpc_service.start()

+0 −18
Original line number Diff line number Diff line
@@ -12,24 +12,6 @@ RUN GRPC_HEALTH_PROBE_VERSION=v0.2.0 && \
    wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \
    chmod +x /bin/grpc_health_probe

# # get packages
# WORKDIR /var/monitoring
# RUN python3 -m pip install --upgrade pip setuptools wheel pip-tools
# COPY monitoring/requirements.in requirements.in
# RUN pip-compile --output-file=requirements.txt requirements.in
# RUN python3 -m pip install -r requirements.txt

# # add files into working directory
# COPY monitoring/. .
# COPY common/logger.py .

# # set listen port
# ENV PORT=7070
# EXPOSE 7070

# #RUN pytest --junitxml=report.xml
# ENTRYPOINT ["pytest", "--junitxml=/opt/results/report.xml"]

# Get generic Python packages
RUN python3 -m pip install --upgrade pip setuptools wheel pip-tools

+3 −3
Original line number Diff line number Diff line
@@ -23,9 +23,9 @@ PORT = 7070
def monitoring_service():
    LOGGER.warning('monitoring_service begin')

    service_port = os.environ.get('DEVICESERVICE_SERVICE_PORT_GRPC', GRPC_SERVICE_PORT)
    max_workers = os.environ.get('MAX_WORKERS', GRPC_MAX_WORKERS)
    grace_period = os.environ.get('GRACE_PERIOD', GRPC_GRACE_PERIOD)
    service_port = GRPC_SERVICE_PORT
    max_workers = GRPC_MAX_WORKERS
    grace_period = GRPC_GRACE_PERIOD

    LOGGER.info('Initializing MonitoringService...')
    grpc_service = MonitoringService(port=service_port, max_workers=max_workers, grace_period=grace_period)