Flask-MonitoringDashboard
Flask-MonitoringDashboard copied to clipboard
Question regarding custom graphs
Hi, I was wondering how to get my custom graphs to show any data?
I was playing around with this function
def every_ten_seconds():
print(int(random() * 100 // 10))
return int(random() * 100 // 10)
every_ten_seconds_schedule = {'seconds': 10}
dashboard.add_graph("Every 10 Seconds", every_ten_seconds, "interval", **every_ten_seconds_schedule)
dashboard.bind(app)
The graph is there but it does not show any data.
Hey Johan,
thanks for your issue. Can you provide me a bit more info? Such as, can you check that the database is populated?
I also noticed a small bug with the visualization. In the graph-options-panel, you can select the end date (which is prefilled with the current day). However it shows the data up to today (and thus not including today). Can you check if this is the case for you as well?
Your code snippet above looks file, so that can't be the issue.
Kind regards,
Patrick
Hi Patric, the database seems to be populated:
and all the endpoints works perfectly
It feels like there could be something wrong with the configuration file:
dashboard.config.init_from(file='config.cfg')
This is all that I can see on the custom graph page:
And thank you for your answer!!
@johansettlin : did you try to change the end date for the graph in the UI to tomorrow?
@mircealungu and @FlyingBird95 Changing the end date was the issue, thank you very much for the help! Now I can play on! Cheers!
@johansettlin Nice :) Would you mind quickly filling our survey? https://forms.gle/EwqkwUtxwwuGCE2L7
It would help us with our research and future improvements.
Thanks, M.
@FlyingBird95 I guess we open a new issue with the problem so we don't forget to fix it? Or we keep this one around?
We can close this issue once #326 is merged ;)
same issue here but customgraphdata
table isnt populated. Also having this log on the console everytime I add dashboard.add_graph(...)
:
No commit has been made, due to the following error: Working outside of application context. This typically means that you attempted to use functionality that needed to interface with the current application object in some way. To solve this, set up an application context with app.app_context(). See the documentation for more information.
Not sure if it related though.
@mpizosdim you're right, it's not the same problem as the original.
It's maybe a problem in the function that you're passing as argument to the add graph (equivalent to every_ten_seconds
in the OPs example.