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

Image graph; idSite=all error #7566

Open
crashkonijn opened this issue Mar 28, 2015 · 7 comments
Open

Image graph; idSite=all error #7566

crashkonijn opened this issue Mar 28, 2015 · 7 comments
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.

Comments

@crashkonijn
Copy link

Hello,

I was trying to get an image graph of all my websites at once, and this gave me the following error: (this is from piwik's own demo site)

<b>Fatal error</b>:  Call to undefined method Piwik\DataTable\Map::getMetadata() in <b>/home/piwik-demo/www/demo.piwik.org/plugins/API/ProcessedReport.php</b> on line <b>543</b><br />
<br />
<b>Fatal error</b>:  Uncaught exception 'Exception' with message 'A fatal error occurred.' in /home/piwik-demo/www/demo.piwik.org/plugins/CorePluginsAdmin/Controller.php:371
Stack trace:
#0 [internal function]: Piwik\Plugins\CorePluginsAdmin\Controller-&gt;safemode(Array)
#1 /home/piwik-demo/www/demo.piwik.org/core/FrontController.php(530): call_user_func_array(Array, Array)
#2 /home/piwik-demo/www/demo.piwik.org/core/FrontController.php(96): Piwik\FrontController-&gt;doDispatch('CorePluginsAdmi...', 'safemode', Array)
#3 /home/piwik-demo/www/demo.piwik.org/core/FrontController.php(183): Piwik\FrontController-&gt;dispatch('CorePluginsAdmi...', 'safemode', Array)
#4 [internal function]: Piwik\FrontController::triggerSafeModeWhenError()
#5 {main}
  thrown in <b>/home/piwik-demo/www/demo.piwik.org/plugins/CorePluginsAdmin/Controller.php</b> on line <b>371</b><br />

http://demo.piwik.org/index.php?module=API&method=ImageGraph.get&idSite=all&apiModule=VisitsSummary&apiAction=get&token_auth=anonymous&graphType=evolution&period=day&date=previous30&width=500&height=250

The same happens if I try to set idSite to multiple id's.

Is there another way to achieve this?

Kind regards,

Peter Klooster

@mattab
Copy link
Member

mattab commented Mar 29, 2015

Hi Peter,

Thanks for the suggestion. It's currently not support to draw several websites on the ImageGraph but for sure it would be a nice new feature!

@mattab mattab added the Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. label Mar 29, 2015
@mattab mattab added this to the Mid term milestone Mar 29, 2015
@saleemkce
Copy link
Contributor

@crashkonijn @mattab , I am working in this issue to make sure that the image graph render for multiple sites as comma separated values as well as 'idSite=all'. Please stay tuned for its availability.

@crashkonijn
Copy link
Author

Awesome, thankyou!

The only difference with what I expected to get was that I assumed to get back one image with multiple sites shown on it. (Very handy for an overview of all sites). But this will do for now.

Thanks again!

@saleemkce
Copy link
Contributor

@mattab Generally speaking, image graph generation is a kind of memory and time consuming task and so having the facility to view all idSite's graph in one page is a very nice feature. But the concern may be that if the user manages more than 10 or 20 sites, it will take huge amount of time for graph generation. It may even cause script execution time out. So do we may need to limit the number of image graphs generated even if idSite=all is set? If so, I assume setting the limit to either 10 or 15 consolidated image graphs per user would be reasonable. What do you think? do we need to have limits here?

@crashkonijn
Copy link
Author

@saleemkce I've got no idea how long the generation of such image is, but I'd assume that more then 5-10 in one image wouldn't work anyway. If a person has more then the maximum amount of websites, what would you suggest happens then?

I think you could ether return more images or return just the maximum, however if I send for id=all I'd expect them all to be returned. As well as when I ask for an img that I get one, not a bunch of them. (this would break my code at least)

Is there a way to detect the amount of time a script took and stop it just before the maximum? Because it differs per server how much sites you would be able to handle before going over the limit right?

@saleemkce
Copy link
Contributor

@crashkonijn, @mattab

  • If a person has more than the maximum amount of websites, what would you suggest happens then?
    => In this case, let him change the idSite in (idSite=4,8,9,11,12) in URL and see the desired sites' image graph because we cannot expect to have 5 or more site data in single image because it would be too big to generate or show properly in final rendering.
  • however if I send for id=all, I'd expect them all to be returned.
    => Let's try with some test/big inputs and get suggestions from others before we take decision in this case (idSite=all)
  • Is there a way to detect the amount of time a script took and stop it just before the maximum?
    => This should be quite difficult because a site's data would usually be too dynamic and so computation will take even more time. Consider what happens when all the sites's data are too dynamic, this is not an easy job. Yes, we may detect the time it takes for script execution but it would be too time-consuming.

@crashkonijn
Copy link
Author

@saleemkce @mattab

I would suggest the following:

  • The creating of 2 separate functions, one for returning one image with multiple sites in it and one for returning one image for each site. In my opinion the name that's being used now might lead to misconception (as seen between my interpretation and @saleemkce's, see posts above).

I do agree with testing what the right maximum amount would be. However a huge piwik database on a slow server could also collapse with one server, and a heavy server with a lot of smaller piwik databases might just do just fine generating an image (I suppose). Would it be possible to create a setting for this and create an error log message if the requested image is probably taking to much time? This could warn a developer to change his or her code to request only a couple sites at the time. Leave the developers that use this option with some responsibility :)

@mattab mattab modified the milestones: Long term, Mid term Dec 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
Projects
None yet
Development

No branches or pull requests

3 participants