Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding metrics from routers #257

Closed
ibilenko opened this issue Jul 18, 2023 · 2 comments
Closed

Adding metrics from routers #257

ibilenko opened this issue Jul 18, 2023 · 2 comments

Comments

@ibilenko
Copy link

When I include object of APIRouter() to app, I don't see metrics from router endpoints.
In the example below there is no /create_abtest metric in /metrics, only endpoints from app
How can I solve it?

front_routes = APIRouter()
@front_routes.post("/create_abtest/")
async def create_abtest():
...

app = FastAPI(
description=description,
version="0.9",
openapi_url=f"/openapi.json",
docs_url=f"/docs",
redoc_url=f"/redoc",
)

app.include_router(
front_routes,
prefix='/api/v1',
tags=['front_views'],
responses={
404: {"description": "Not Found"}
}
)

instrumentator = Instrumentator()
instrumentator.instrument(app).expose(app)

@ibilenko
Copy link
Author

ibilenko commented Jul 18, 2023

Everything is okey

@bhaktatejas922
Copy link

@ibilenko how did you resolve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants