Flask-MonitoringDashboard icon indicating copy to clipboard operation
Flask-MonitoringDashboard copied to clipboard

Question regarding custom graphs

Open johansettlin opened this issue 4 years ago • 10 comments

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.

johansettlin avatar Apr 26 '20 08:04 johansettlin

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

FlyingBird95 avatar Apr 27 '20 09:04 FlyingBird95

Hi Patric, the database seems to be populated: Screenshot 2020-04-27 at 12 12 53 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') Screenshot 2020-04-27 at 12 13 16

This is all that I can see on the custom graph page: Screenshot 2020-04-27 at 12 17 57

johansettlin avatar Apr 27 '20 10:04 johansettlin

And thank you for your answer!!

johansettlin avatar Apr 27 '20 10:04 johansettlin

@johansettlin : did you try to change the end date for the graph in the UI to tomorrow?

mircealungu avatar Apr 27 '20 10:04 mircealungu

@mircealungu and @FlyingBird95 Changing the end date was the issue, thank you very much for the help! Now I can play on! Cheers!

johansettlin avatar Apr 27 '20 10:04 johansettlin

@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.

mircealungu avatar Apr 27 '20 10:04 mircealungu

@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?

mircealungu avatar Apr 27 '20 10:04 mircealungu

We can close this issue once #326 is merged ;)

FlyingBird95 avatar Apr 27 '20 11:04 FlyingBird95

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 avatar Apr 28 '20 09:04 mpizosdim

@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.

mircealungu avatar Apr 29 '20 08:04 mircealungu