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

uwsgi_metrics is not documented and is broken #905

Closed
drummerwolli opened this issue Mar 16, 2019 · 2 comments · Fixed by #972
Closed

uwsgi_metrics is not documented and is broken #905

drummerwolli opened this issue Mar 16, 2019 · 2 comments · Fixed by #972

Comments

@drummerwolli
Copy link
Contributor

drummerwolli commented Mar 16, 2019

Description

It is possible to have a metrics endpoint in combination with uwsgi_metrics.

But:

  1. this is not properly documented. I would argue that just having this in hidden in some GH issues is not the proper way.
  2. the functionality breaks with Connexion 2.1.0 (2.0.0 still works fine for me, upgrading to 2.2.0 does not help).

Expected behaviour

  • Usage of uwsgi_metrics integration is properly documented.
  • The integration is working with the current newest version of Connexion.

Actual behaviour

  • Documentation how to integrate this must be searched by users in GH issues or in the repo.
  • It does not work with Connexion 2.1.0. I get the following error message:
ERROR:flask.app:Exception on / [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.7/dist-packages/flask_cors/extension.py", line 161, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.7/dist-packages/flask/_compat.py", line 35, in reraise
    raise value
  File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.7/dist-packages/flask/app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
   File "/usr/local/lib/python3.7/dist-packages/connexion/decorators/decorator.py", line 48, in wrapper
    response = function(request)
  File "/usr/local/lib/python3.7/dist-packages/connexion/decorators/metrics.py", line 39, in wrapper
   status = response.status_code
AttributeError: 'dict' object has no attribute 'status_code'

Steps to reproduce

  • pip3 install uwsgi_metrics3 on the system running the Connexion App (Python3 example)
  • i think the following steps are optional, because Connexion checks for the module if it is installed. but this is to get the full functionality in Connexion 2.1.0:
    • at the beginning of your code do an uwsgi_metrics.initialize()
    • call any endpoint of your application after adding this to your swagger/OpenAPI file:
  /metrics:
    get:
      operationId: "uwsgi_metrics.view"
      summary: "Get request metrics"
      responses:
        200:
          description: "Dropwizard metrics"

Additional info:

Output of the commands:

  • python --version : Python 3.7.2
  • pip show connexion | grep "^Version\:" : Version: 2.1.0
@drummerwolli
Copy link
Contributor Author

can someone confirm and/or help?

@whiter4bbit
Copy link
Contributor

I can confirm that uwsgi_metrics are broken. The problem was caused by this PR: 9bef8c4#diff-70f11290117043cbea3371afb6b52ea7

9bef8c4#diff-70f11290117043cbea3371afb6b52ea7L353

ConnexionResponse decorator call moved after uwsgi metrics decorator call, when metrics decorator expects ConnexionResponse as return result value from the request handler

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

Successfully merging a pull request may close this issue.

2 participants