Skip to content

Latest commit

 

History

History
98 lines (83 loc) · 2.39 KB

advanced.mdx

File metadata and controls

98 lines (83 loc) · 2.39 KB
title description
Advanced usage
Go beyond the basics.

Capturing endpoint descriptions

If your application makes its OpenAPI specification (often named openapi.json) available in an endpoint, Apitally can use that to enrich the captured metadata about your endpoints with descriptions. These will then be shown in the modal that appears when you click on an endpoint on the Traffic page in the dashboard.

FastAPI provides this out of the box, and Apitally is already configured to use it. For other frameworks you can explicitly set the openapi_url / openApiUrl argument when adding the middleware to your application:

```python Flask app.wsgi_app = ApitallyMiddleware( app, client_id="your-client-id", env="dev", openapi_url="/openapi.json", # <-- ) ```
APITALLY_MIDDLEWARE = {
    "client_id": "your-client-id",
    "env": "dev",
    "openapi_url": "/api/openapi",  # <--
}
useApitally(app, {
  clientId: "your-client-id",
  env: "dev",
  openApiUrl: "/api-docs", // <--
});
await fastify.register(apitallyPlugin, {
  clientId: "your-client-id",
  env: "dev",
  openApiUrl: "/docs/json", // <--
});

Reporting app versions

Apitally can display the currently deployed version of your app in the tooltip that appears if you hover over the environment pills on the Apps page in the dashboard. This can be useful if you have multiple environments and want to know which version of your app is running in each environment.

To report the app version, set the app_version / appVersion argument when adding the middleware to your application:

```python FastAPI / Starlette app.add_middleware( ApitallyMiddleware, client_id="your-client-id", env="dev", app_version="1.0.0", # <-- ) ```
app.wsgi_app = ApitallyMiddleware(
    app,
    client_id="your-client-id",
    env="dev",
    app_version="1.0.0",  # <--
)
APITALLY_MIDDLEWARE = {
    "client_id": "your-client-id",
    "env": "dev",
    "app_version": "1.0.0",  # <--
}
useApitally(app, {
  clientId: "your-client-id",
  env: "dev",
  appVersion: "1.0.0", // <--
});
await fastify.register(apitallyPlugin, {
  clientId: "your-client-id",
  env: "dev",
  appVersion: "1.0.0", // <--
});