-
Notifications
You must be signed in to change notification settings - Fork 162
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
The function either returned None or ended without a return statement while using with flask_restful #62
Comments
I am using |
Thanks for the report! I'll have a look, sounds like a bug potentially. |
Thank you for the quick reply 🙂 |
If you switch to |
@rycus86 thank you so much, this does solve the problem. Previously I used to do metrics = PrometheusMetrics.for_app_factory()
# and later
metrics.init_app(app) Any tip on how I can achieve something similar while using |
That might need some changes to support it nicely. 🤔 metrics = RESTfulPrometheusMetrics(app=None, api=api)
# and later
metrics.init_app(app) |
Started building a new metrics = RESTfulPrometheusMetrics.for_app_factory(api)
# and later
metrics.init_app(app) |
This looks great, is it possible we pass metrics = RESTfulPrometheusMetrics.for_app_factory()
# and later
metrics.init_app(app, api) |
Yeah, good point! app = Flask(__name__)
restful_api = Api(app)
metrics = RESTfulPrometheusMetrics.for_app_factory()
# and later
metrics.init_app(app, restful_api) |
You are just awesome. Thank you so much this helps me a lot |
Hi @rycus86 thanks for all your effort, i have one small question about this. Which do i use between GunicornPrometheusMetrics and RESTfulPrometheusMetrics for when I'm using both gunicorn and Flask-restX |
Good question @Curiouspaul1 , not sure if we have an exact test for that yet. |
flask_restful
supports returningNone
from the view function, but I am getting error this error when I usemetrics
for endpoint.e.g
It works fine if I don't use
@by_path_counter
decorator, and returnsnull
in the response.But when I add the decorator, I get this error.
Is there any way, I can work around this? (I have to return
None
)Any kind of help will be highly appreciated, thank you 🙂
Note: It works fine on other view functions where I return not
None
valuesThe text was updated successfully, but these errors were encountered: