Skip to content

Commit 7ebdaac

Browse files
User guide
1 parent ea07ddd commit 7ebdaac

2 files changed

Lines changed: 38 additions & 0 deletions

File tree

src/sap_cloud_sdk/core/runtime_context/user-guide.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,8 @@ from sap_cloud_sdk.core.runtime_context import (
210210

211211

212212
class FlaskContextAdapter(FrameworkAdapter):
213+
name = "flask"
214+
213215
def _matches(self, app) -> bool:
214216
from flask import Flask
215217

@@ -226,6 +228,30 @@ register(FlaskContextAdapter())
226228

227229
---
228230

231+
## Introspection
232+
233+
Use `get_framework_adapters()` to check which framework adapters have been attached at runtime:
234+
235+
```python
236+
from sap_cloud_sdk import get_framework_adapters
237+
238+
get_framework_adapters() # -> ["starlette"] after bootstrap(app), [] before
239+
```
240+
241+
This is useful for modules that need to fail fast if their required framework was never bootstrapped:
242+
243+
```python
244+
if "starlette" not in get_framework_adapters():
245+
raise RuntimeError(
246+
"This client requires Starlette to be bootstrapped. "
247+
"Call bootstrap(app) with your Starlette/FastAPI app."
248+
)
249+
```
250+
251+
Returns an empty list if `bootstrap()` has not been called yet. Each entry corresponds to one successful `bootstrap(app)` call.
252+
253+
---
254+
229255
## Running the tests
230256

231257
```bash

src/sap_cloud_sdk/core/telemetry/user-guide.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,18 @@ Instrumentation activates based on what is installed in the service, not on what
7878

7979
The SDK ships `opentelemetry-instrumentation-*` packages for all of the above as hard dependencies. The target frameworks themselves are optional — install them via your service's own requirements or via the SDK's convenience extras (e.g. `sap-cloud-sdk[django]`).
8080

81+
### Introspection
82+
83+
Use `get_instrumented_libraries()` to query which libraries were actually patched at runtime:
84+
85+
```python
86+
from sap_cloud_sdk import get_instrumented_libraries
87+
88+
get_instrumented_libraries() # -> ["httpx", "sqlalchemy", ...] after auto_instrument(), [] before
89+
```
90+
91+
Only libraries that were installed **and** successfully instrumented appear in the list. Libraries skipped because they are not installed do not appear. Returns an empty list if `auto_instrument()` has not been called yet.
92+
8193
---
8294

8395
## Span functions

0 commit comments

Comments
 (0)