Skip to content

Commit

Permalink
Allow app=None in init_telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
Ihor Lahutin committed Feb 14, 2025
1 parent 77398ba commit 55654d8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions aidial_sdk/telemetry/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@


def init_telemetry(
app: FastAPI,
app: FastAPI | None,
config: TelemetryConfig,
):
resource = Resource.create(
Expand Down Expand Up @@ -120,6 +120,6 @@ def init_telemetry(
if config.metrics.prometheus_export:
start_http_server(port=config.metrics.port)

if config.tracing is not None or config.metrics is not None:
if app and (config.tracing is not None or config.metrics is not None):
# FastAPI instrumentor reports both metrics and traces
FastAPIInstrumentor.instrument_app(app)

0 comments on commit 55654d8

Please sign in to comment.