Code Monkey home page Code Monkey logo

Comments (9)

motdiem avatar motdiem commented on June 4, 2024 1

FWIW I ran into a similar issue today, and it turned out to be that the "/grouped" url can be a bit long (my wsgi had a limit to 4096 characters) - so setting buffer-size=32768 in wsgi settings solved it

Hope this helps

from flask-profiler.

muatik avatar muatik commented on June 4, 2024

actually you are not supposed to do anything to get summary info. I will check this.

if your database does not contain sensitive data, could you please send it here?

or could you send responses of the ajax request of the summary page?

from flask-profiler.

alejoar avatar alejoar commented on June 4, 2024

I've been running this in a test environment so there's no sensitive data. Here's the DB: https://drive.google.com/file/d/0B-gm7xa66enOWEFEQlJfQ2xDN3M/view?usp=sharing

As an unrelated question: what's the impact of running this on a production server?

from flask-profiler.

muatik avatar muatik commented on June 4, 2024

thanks for the db.

I downloaded and started flask-profiler with it; it works for me. I am able to see the summary info on the dashboard page.

image

Can you check the ajax request using chrome's developer console? And what do you get when make the request below?

http://127.0.0.1:5000/flask-profiler/api/measurements/grouped/?draw=1&sort=count%2Cdesc&skip=0&limit=-1&startedAt=1459501722&endedAt=1460020122&_=1460020122420

Yes you can use this on a production server with securing it using basic authentication. There is not any significant impact. When you are done with it, you can turn it off easily.

app.config["flask_profiler"] = {
    "verbose": True,
    "enabled": app.config["DEBUG"],
    "storage": {
        "engine": "sqlite"
    },
    "basicAuth": {
        "enabled": True,
        "username": "admin",
        "password": "admin"
    }
}

from flask-profiler.

alejoar avatar alejoar commented on June 4, 2024

Ok, I think that's where the problem is.

For some reason, the URL requested in my instance of flask profiler looks like this: grouped?draw=1(...), which returns an empty response. Yours looks like this: ?draw=1(...).

I found that simply adding a slash ( grouped/?draw=1(...)) returns as expected.

Here's a screenshot: http://imgur.com/BSgi6zu

from flask-profiler.

muatik avatar muatik commented on June 4, 2024

Hi @alejoar
I am not able to reproduce the issue so that I cannot come up with a solution.

from flask-profiler.

alejoar avatar alejoar commented on June 4, 2024

@muatik unfortunately I moved on to logstash to get the same kind of stats so I can't give you any more feedback for flask-profiler. I have no idea why the requested url had that difference in my server, I didn't alter the code at all.

The problem I had was that I have several servers running flask and I needed something centralized so I moved my data recollection to the load balancers.

from flask-profiler.

muatik avatar muatik commented on June 4, 2024

ohh ok, thanks anyway.

from flask-profiler.

lee-pai-long avatar lee-pai-long commented on June 4, 2024

I just ran on this issue today and indeed there is a mismatch between the js ajax call to and the route declaration.

From the Werkzeug Rule documentation:

URL rules that end with a slash are branch URLs, others are leaves. If you have strict_slashes enabled (which is the default), all branch URLs that are matched without a trailing slash will trigger a redirect to the same URL with the missing slash appended.

The route declaration has a slash at the end:

@fp.route("/api/measurements/grouped/".format(urlPath))

While the ajax request don't:

192.168.21.1 - - [04/Aug/2017 18:29:31] "GET /flask-profiler/api/measurements/grouped?draw=...

This generate a HTTP 500 error with following traceback:

Traceback (most recent call last):
  File "/opt/app/.pyenv/versions/3.6.2/envs/0.0.0/lib/python3.6/site-packages/flask/app.py", line 1997, in __call__
    return self.wsgi_app(environ, start_response)
  File "/opt/app/.pyenv/versions/3.6.2/envs/0.0.0/lib/python3.6/site-packages/flask/app.py", line 1985, in wsgi_app
    response = self.handle_exception(e)
  File "/opt/app/.pyenv/versions/3.6.2/envs/0.0.0/lib/python3.6/site-packages/flask/app.py", line 1540, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/opt/app/.pyenv/versions/3.6.2/envs/0.0.0/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/opt/app/.pyenv/versions/3.6.2/envs/0.0.0/lib/python3.6/site-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/opt/app/.pyenv/versions/3.6.2/envs/0.0.0/lib/python3.6/site-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/opt/app/.pyenv/versions/3.6.2/envs/0.0.0/lib/python3.6/site-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/opt/app/.pyenv/versions/3.6.2/envs/0.0.0/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/opt/app/.pyenv/versions/3.6.2/envs/0.0.0/lib/python3.6/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/opt/app/.pyenv/versions/3.6.2/envs/0.0.0/lib/python3.6/site-packages/flask/app.py", line 1590, in dispatch_request
    self.raise_routing_exception(req)
  File "/opt/app/.pyenv/versions/3.6.2/envs/0.0.0/lib/python3.6/site-packages/flask/app.py", line 1573, in raise_routing_exception
    raise request.routing_exception
  File "/opt/app/.pyenv/versions/3.6.2/envs/0.0.0/lib/python3.6/site-packages/flask/ctx.py", line 294, in match_request
    self.url_adapter.match(return_rule=True)
  File "/opt/app/.pyenv/versions/3.6.2/envs/0.0.0/lib/python3.6/site-packages/werkzeug/routing.py", line 1534, in match
    safe='/:|+') + '/', query_args))
werkzeug.routing.RequestRedirect: 301 Moved Permanently: None

I manually edited(remove the slash) the flask_profiler.py in the site package and it work as expected.

By removing the trailing slash it will ensure that the route work with either Werkzeug strict_slashes enabled or not (or any other WSGI server in production).

PR #68 should to fix this issue.

from flask-profiler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.