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

Initial setup fails #437

Open
Cornul11 opened this issue Nov 15, 2023 · 10 comments
Open

Initial setup fails #437

Cornul11 opened this issue Nov 15, 2023 · 10 comments

Comments

@Cornul11
Copy link

Cornul11 commented Nov 15, 2023

Firstly, thanks to the maintainers for their great work!

Describe the bug
Installing and setting up the dashboard leads to an Exception after logging in.

Moreover, on the Configuration page, the "First request in the currently deployed version" field shows; aN-aN-NaN aN:aN, which is probably related.

To Reproduce
Steps to reproduce the behaviour:

  1. Install the dashboard
  2. Bind it to the app
  3. Open the dashboard
  4. Log in
  5. See the main overview graph endlessly loading

Expected behaviour
It is quite clear that the expected behaviour is to have the dashboard overview page loading properly.

Screenshots
NA

Desktop (please complete the following information):

  • OS: Microsoft Windows 11
  • Browser chrome
  • FMD Version: 3.1.2

Additional context
Here is the console log when the issue arises:

127.0.0.1 - - [15/Nov/2023 09:40:54] "GET /dashboard/api/deploy_config HTTP/1.1" 200 -
127.0.0.1 - - [15/Nov/2023 09:41:12] "GET /dashboard/api/overview HTTP/1.1" 200 -
[2023-11-15 09:41:13,014] ERROR in app: Exception on /dashboard/api/deploy_details [GET]
Traceback (most recent call last):
  File "\flaskProject\venv\lib\site-packages\flask\app.py", line 2190, in wsgi_app
    response = self.full_dispatch_request()
  File "\flaskProject\venv\lib\site-packages\flask\app.py", line 1486, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "\flaskProject\venv\lib\site-packages\flask_restful\__init__.py", line 298, in error_router
    return original_handler(e)
  File "\flaskProject\venv\lib\site-packages\flask_cors\extension.py", line 176, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "\flaskProject\venv\lib\site-packages\flask\app.py", line 1484, in full_dispatch_request
    rv = self.dispatch_request()
  File "\flaskProject\venv\lib\site-packages\flask\app.py", line 1469, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "\flaskProject\venv\lib\site-packages\flask_monitoringdashboard\core\auth.py", line 39, in wrapper
    return func(*args, **kwargs)
  File "\flaskProject\venv\lib\site-packages\flask_monitoringdashboard\views\deployment.py", line 21, in deploy_details
    datetime.datetime.fromtimestamp(details['first-request'])
OSError: [Errno 22] Invalid argument
127.0.0.1 - - [15/Nov/2023 09:41:13] "GET /dashboard/api/deploy_details HTTP/1.1" 500 -
@cyx200902
Copy link

I also encountered the same problem. Have you solved it?

flask_monitoringdashboard-3.1.2
Windows 10
Python 3.9

When I visit http://127.0.0.1:5000/dashboard/overview, displays have been loaded and error, I have the correct configuration database (although no data in the database, but create a few tables)

[2023-11-24 23:04:07,210] ERROR in app: Exception on /dashboard/api/deploy_details [GET] Traceback (most recent call last): File "D:\anaconda\envs\qqbot\lib\site-packages\flask\app.py", line 2190, in wsgi_app response = self.full_dispatch_request() File "D:\anaconda\envs\qqbot\lib\site-packages\flask\app.py", line 1486, in full_dispatch_request rv = self.handle_user_exception(e) File "D:\anaconda\envs\qqbot\lib\site-packages\flask\app.py", line 1484, in full_dispatch_request rv = self.dispatch_request() File "D:\anaconda\envs\qqbot\lib\site-packages\flask\app.py", line 1469, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) File "D:\anaconda\envs\qqbot\lib\site-packages\flask_monitoringdashboard\core\auth.py", line 39, in wrapper return func(*args, **kwargs) File "D:\anaconda\envs\qqbot\lib\site-packages\flask_monitoringdashboard\views\deployment.py", line 21, in deploy_details datetime.datetime.fromtimestamp(details['first-request']) OSError: [Errno 22] Invalid argument

@Cornul11
Copy link
Author

Hi, @cyx200902. Unofrtunately, I have not solved the issue yet.

@cyx200902
Copy link

Thanks for reply~ I tried to read the code and found that it was possible that my flask app was not properly bound, but there is still no solution.Do you have any good solutions or alternatives to this?

@cyx200902
Copy link

#435

@amirhnir
Copy link
Contributor

amirhnir commented Nov 25, 2023

Hi guys. I had this issue too, first of all, check this topic #435 and make sure you bind the MonitoringDashboard after registering your blueprints (or routes):


import flask_monitoringdashboard as dashboard
from flask import Flask

app = Flask("name")

@app.route("/test", methods = ['GET'])
def kk():
	return {"ok": True}

dashboard.config.enable_logging=True
dashboard.bind(app)

app.run()

after that, the problem is still there but after 1 request it will be solved. actually, this problem is just for when there are no requests on the dashboard.

@mircealungu
Copy link
Member

Thanks for answering the question @amirhnir !

@mircealungu
Copy link
Member

I guess in the future we could try to detect the two situations (bound too late, or no requests yet) programmatically and provide the user with a useful message instead of the crash! I'll makr this issue as helpwanted because I think it should not be too hard to implement for somebody that has a bit of time on their hands.

@Cornul11
Copy link
Author

Can confirm that binding the dashboard after initializing all the routes fixes the issue, as per #435. It would probably be a good idea to mention this detail in the setup section of the README.

@mircealungu
Copy link
Member

Thanks a lot for confirming @Cornul11 . Do you want to add the note to the Readme.md and send a PR with it? I'll be happy to merge it in!

@amirhnir
Copy link
Contributor

Can confirm that binding the dashboard after initializing all the routes fixes the issue, as per #435. It would probably be a good idea to mention this detail in the setup section of the README.

Its a good idea but technically It doesn't solve the problem because even after this, the issue persists until the first request is received

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

No branches or pull requests

4 participants