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

Starlette #8

Open
julosaure opened this issue Oct 27, 2024 · 1 comment
Open

Starlette #8

julosaure opened this issue Oct 27, 2024 · 1 comment

Comments

@julosaure
Copy link

Hi,

First thanks for developing this middleware, that looks like exactly what's missing in the ecosystem.

I am not able to make it work though. I keep getting the TypeError at the initialization:
TypeError: One of the targeted functions for key "1main" is not a function

I'm using functions similar to:
"1deps": (fastapi.routing.solve_dependencies,),

or
"1deps": (fastapi.routing.solve_dependencies.qualname,),

What am I missing?
Thank you

@sm-Fifteen
Copy link
Owner

As I recall, the type check for what is and isn't a function is too strict and doesn't let you use compiled Cython or native functions.

if not all(inspect.isfunction(profiled) for profiled in profiled_functions):
raise TypeError('One of the targeted functions for key "{}" is not a function'.format(metric_name))

See #3. It's a fairly simple fix, I just haven't gotten around to 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