Skip to content

Commit fee41ed

Browse files
Code quality
1 parent a9306b1 commit fee41ed

2 files changed

Lines changed: 2 additions & 10 deletions

File tree

src/sap_cloud_sdk/core/telemetry/instrumentation/instrumentors/fastapi.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,9 @@ def _instrument(self, **kwargs) -> None:
2222
from fastapi import FastAPI
2323

2424
app = kwargs.get("app")
25-
if app is None:
25+
if app is None or not isinstance(app, FastAPI):
2626
_instrumentor.instrument()
2727
return
28-
if not isinstance(app, FastAPI):
29-
raise TypeError(
30-
f"FastAPIInstrumentorWrapper expects a FastAPI instance, got {type(app).__name__}"
31-
)
3228
FastAPIInstrumentor.instrument_app(app)
3329

3430
def _uninstrument(self) -> None:

src/sap_cloud_sdk/core/telemetry/instrumentation/instrumentors/starlette.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,9 @@ def _instrument(self, **kwargs) -> None:
2222
from starlette.applications import Starlette
2323

2424
app = kwargs.get("app")
25-
if app is None:
25+
if app is None or not isinstance(app, Starlette):
2626
_instrumentor.instrument()
2727
return
28-
if not isinstance(app, Starlette):
29-
raise TypeError(
30-
f"StarletteInstrumentorWrapper expects a Starlette instance, got {type(app).__name__}"
31-
)
3228
_instrumentor.instrument_app(app)
3329

3430
def _uninstrument(self) -> None:

0 commit comments

Comments
 (0)