Skip to content

Consider fastapi routes as separate operations when logging to App Insights via OpenTelemetry #1783

@claria

Description

@claria

This issue follows up on Azure/azure-sdk-for-python/issues/42453

When using a fastAPI app in Azure Functions like this:

app = func.AsgiFunctionApp(app=fastapi_app,
                           http_auth_level=func.AuthLevel.ANONYMOUS,
                           function_name='fastapi')

This adds one function matching /{*route} which subsequently groups all operations in appinsights unter the operations GET /*{route}, POST /*{route} which does not make sense, e.g. when using the (very helpful) Performance/Failures tabs

It would be much more useful to use the fastapi defined routes as the operationName to have everything grouped according to their actual operation:

GET /items/{item_id}
GET /orders/{order_id}
GET /orders/

instead of grouping everything in one GET /*{route} operation.

More information and sample code can be found in the referenced issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions