matomo-org / matomo

Empowering People Ethically with the leading open source alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. Liberating Web Analytics. Star us on Github? +1. And we love Pull Requests!
https://matomo.org/
GNU General Public License v3.0
19.83k stars 2.64k forks source link

VisitsSummary.getVisits not working for specific days #21021

Open doublethink13 opened 1 year ago

doublethink13 commented 1 year ago

Context

I’m querying Matomo using Postman, for example, like:

{{base_url}}/index.php?method=VisitsSummary.getVisits&idSite=21&period=range&date=2023-07-07,2023-07-07&module=API&format=JSON&token_auth={{matomo_token}}

This request is not working. I get a timeout after a while.

However, if I do this request instead:

{{base_url}}/index.php?method=VisitsSummary.getVisits&idSite=21&period=range&date=2023-07-06,2023-07-06&module=API&format=JSON&token_auth={{matomo_token}}

I get an answer like this:

{
    "value": 291
}

What could be the reason for the first request to timeout?

The only thing that changes between requests in the range.

Your Environment

Matomo version: 4.14.1

MySQL version: 10.6.12-MariaDB-0ubuntu0.22.04.1

PHP version: 8.1.18

sgiehl commented 1 year ago

@doublethink13 The first range actually only includes one day. Does the request work if you request it as day period? e.g. &period=day&date=2023-07-07

doublethink13 commented 1 year ago

This fails, period=range&date=2023-07-07,2023-07-07, in the sense that the requests times out.

This works, period=range&date=2023-07-06,2023-07-06, in the sense that I get a response from the server, for example: {"value": 291}.

The behavior is the same if using period=date.

The problem here is that I want to request data from a range. And if some days are included in that range, for example, the 7th, the request timeout.

sgiehl commented 1 year ago

@doublethink13 Maybe try checking your server / php error log. Maybe it exceeds the memory limit or similar?

michalkleiner commented 1 year ago

Also try a day after, e.g. period=range&date=2023-07-08,2023-07-08, or any other day earlier or later than that, to see if it's just about that specific single day or multiple days could have similar issues.

doublethink13 commented 1 year ago

@sgiehl

@doublethink13 Maybe try checking your server / php error log. Maybe it exceeds the memory limit or similar?

Unfortunately I don't have direct access to the server's logs, but I've been told that no meaningful error or information appears when the faulty request is made

@michalkleiner

Also try a day after, e.g. period=range&date=2023-07-08,2023-07-08, or any other day earlier or later than that, to see if it's just about that specific single day or multiple days could have similar issues.

That's exactly what I describe in the first comment :sweat_smile:

Doing a request for any other day, whether it's a single day or multiple days, works, as long as the 07/07/2023is not included

michalkleiner commented 1 year ago

Thanks for the confirmation @doublethink13. I wasn't sure if you managed to find any other day also not working but it seems it's a very specific one day issue for you.

Unless we're able to locate an error or any other reason why it's failing for you it's unlikely we will be able to help you in any way.

As @sgiehl mentioned, it could be a memory exhaustion, server/proxy timeout, a very specific data that would cause an error for that day or anything similar — an issue specific to your data/configuration/setup, which we're not able to troubleshoot here.

doublethink13 commented 1 year ago

Unless we're able to locate an error or any other reason why it's failing for you it's unlikely we will be able to help you in any way.

i understand, and thank you for trying :)

very specific data that would cause an error for that day or anything similar — an issue specific to your data/configuration/setup, which we're not able to troubleshoot here

if you have any suggestion about how to debug, let me know

otherwise, feel free to close the issue

michalkleiner commented 1 year ago

The best bet are the server logs, either the webserver or PHP or both. It's easy to miss an error if there is a large volume of log entries. Could you perhaps run the action again at a specified time and ask the server admin/person with access to logs to give you the logs for 5 minutes around the event and then (if safe to do so) paste them here anonymised, of course if it's not megabytes of data/thousands of entries. And error should be logged somewhere if the action fails (if logging is set up correctly). There's an FAQ around logging that you can check out — https://matomo.org/faq/how-to/faq_20991/