You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Taking inspiration from the way Strawberry handles integrations with common frameworks.
For instance, they have a package called strawberry-graphql[fastapi], which allows you to import a GraphQLRouter, which you can then use directly with FastAPI as follows (docs here):
I could imagine something similar for autometrics-py, which allows you to do the following
importstrawberryfromfastapiimportFastAPI# NOTE - you'll need to `pip install 'autometrics[fastapi]` to use `MetricsRouter`fromautometrics.fastapiimportMetricsRoutermetrics_app=MetricsRouter()
app=FastAPI()
app.include_router(metrics_app, prefix="/metrics")
Effectively, this MetricsRouter would be sugar for
fromprometheus_clientimportgenerate_latest# Set up a metrics endpoint for Prometheus to scrape# `generate_latest` returns metrics data in the Prometheus text format@app.get("/metrics")defmetrics():
returnResponse(generate_latest())
The text was updated successfully, but these errors were encountered:
Taking inspiration from the way Strawberry handles integrations with common frameworks.
For instance, they have a package called
strawberry-graphql[fastapi]
, which allows you to import aGraphQLRouter
, which you can then use directly with FastAPI as follows (docs here):I could imagine something similar for autometrics-py, which allows you to do the following
Effectively, this
MetricsRouter
would be sugar forThe text was updated successfully, but these errors were encountered: