> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/lens/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/lens/_mcp/server.

# lens.contrib.fastapi

FastAPI auto-instrumentation helper.

## Module Contents

### Functions

| Name                                                             | Description                                                |
| ---------------------------------------------------------------- | ---------------------------------------------------------- |
| [`instrument_fastapi`](#lens-contrib-fastapi-instrument_fastapi) | Apply OpenTelemetry auto-instrumentation to a FastAPI app. |

### API

```python
lens.contrib.fastapi.instrument_fastapi(
    app,
    service_name: str = 'nemo-gym'
) -> None
```

Apply OpenTelemetry auto-instrumentation to a FastAPI app.

Requires `opentelemetry-instrumentation-fastapi &gt;= 0.40b0`.

**Parameters:**

**`app`**

The FastAPI application instance.

---

**`service_name`**

Service name for span naming.

---