Loading src/common/tools/rest_conf/server/restconf_server/app.py +20 −14 Original line number Original line Diff line number Diff line Loading @@ -33,6 +33,7 @@ rcs_app.register_restconf() LOGGER.info('All connectors registered') LOGGER.info('All connectors registered') # Initialize InfluxDB client and register telemetry callbacks # Initialize InfluxDB client and register telemetry callbacks try: LOGGER.info('Initializing InfluxDB client (host=%s, port=%d, db=%s)...', INFLUXDB_HOST, INFLUXDB_PORT, INFLUXDB_DATABASE) LOGGER.info('Initializing InfluxDB client (host=%s, port=%d, db=%s)...', INFLUXDB_HOST, INFLUXDB_PORT, INFLUXDB_DATABASE) influx_client = SimapInfluxDBClient( influx_client = SimapInfluxDBClient( host = INFLUXDB_HOST, host = INFLUXDB_HOST, Loading @@ -40,14 +41,19 @@ influx_client = SimapInfluxDBClient( token = INFLUXDB_TOKEN, token = INFLUXDB_TOKEN, database = INFLUXDB_DATABASE database = INFLUXDB_DATABASE ) ) except Exception as e: LOGGER.error('Failed to initialize InfluxDB client: %s', e) influx_client = None if influx_client.is_connected(): if influx_client is not None and influx_client.is_connected(): LOGGER.info('Registering telemetry callbacks...') try: rcs_app.callback_dispatcher.register(CallbackOnLinkTelemetry(influx_client)) rcs_app.callback_dispatcher.register(CallbackOnLinkTelemetry(influx_client)) rcs_app.callback_dispatcher.register(CallbackOnNodeTelemetry(influx_client)) rcs_app.callback_dispatcher.register(CallbackOnNodeTelemetry(influx_client)) LOGGER.info('Telemetry callbacks registered') LOGGER.info('Telemetry callbacks registered') except Exception as e: LOGGER.error('Failed to register telemetry callbacks: %s', e) else: else: LOGGER.warning('InfluxDB client not connected, telemetry callbacks disabled') LOGGER.warning('InfluxDB client not connected, telemetry callbacks disabled.') rcs_app.dump_configuration() rcs_app.dump_configuration() app = rcs_app.get_flask_app() app = rcs_app.get_flask_app() Loading Loading
src/common/tools/rest_conf/server/restconf_server/app.py +20 −14 Original line number Original line Diff line number Diff line Loading @@ -33,6 +33,7 @@ rcs_app.register_restconf() LOGGER.info('All connectors registered') LOGGER.info('All connectors registered') # Initialize InfluxDB client and register telemetry callbacks # Initialize InfluxDB client and register telemetry callbacks try: LOGGER.info('Initializing InfluxDB client (host=%s, port=%d, db=%s)...', INFLUXDB_HOST, INFLUXDB_PORT, INFLUXDB_DATABASE) LOGGER.info('Initializing InfluxDB client (host=%s, port=%d, db=%s)...', INFLUXDB_HOST, INFLUXDB_PORT, INFLUXDB_DATABASE) influx_client = SimapInfluxDBClient( influx_client = SimapInfluxDBClient( host = INFLUXDB_HOST, host = INFLUXDB_HOST, Loading @@ -40,14 +41,19 @@ influx_client = SimapInfluxDBClient( token = INFLUXDB_TOKEN, token = INFLUXDB_TOKEN, database = INFLUXDB_DATABASE database = INFLUXDB_DATABASE ) ) except Exception as e: LOGGER.error('Failed to initialize InfluxDB client: %s', e) influx_client = None if influx_client.is_connected(): if influx_client is not None and influx_client.is_connected(): LOGGER.info('Registering telemetry callbacks...') try: rcs_app.callback_dispatcher.register(CallbackOnLinkTelemetry(influx_client)) rcs_app.callback_dispatcher.register(CallbackOnLinkTelemetry(influx_client)) rcs_app.callback_dispatcher.register(CallbackOnNodeTelemetry(influx_client)) rcs_app.callback_dispatcher.register(CallbackOnNodeTelemetry(influx_client)) LOGGER.info('Telemetry callbacks registered') LOGGER.info('Telemetry callbacks registered') except Exception as e: LOGGER.error('Failed to register telemetry callbacks: %s', e) else: else: LOGGER.warning('InfluxDB client not connected, telemetry callbacks disabled') LOGGER.warning('InfluxDB client not connected, telemetry callbacks disabled.') rcs_app.dump_configuration() rcs_app.dump_configuration() app = rcs_app.get_flask_app() app = rcs_app.get_flask_app() Loading