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

Analytics are not updated #26

Open
skota opened this issue Oct 19, 2024 · 7 comments
Open

Analytics are not updated #26

skota opened this issue Oct 19, 2024 · 7 comments
Assignees
Labels
discussion Potential feature request / change

Comments

@skota
Copy link

skota commented Oct 19, 2024

I have deployed a phoenix app with phoenix anaytics. However the analytics are not updating. I had 3 persons from diff geographic locations access the site. The analytics are not updating.

I can see analytics.dukdb in the deployment folder. How do i troubleshoot this?

thanks.

@lalabuy948
Copy link
Owner

lalabuy948 commented Oct 23, 2024

Hi @skota, easiest way if you install duckdb client locally and copy production analytics.duckdb file locally:

duckdb analytics.duckdb 
 SELECT * FROM requests;

Could you please tell which version of PA you are using?

@lalabuy948 lalabuy948 self-assigned this Oct 23, 2024
@lalabuy948 lalabuy948 added the discussion Potential feature request / change label Oct 23, 2024
@skota
Copy link
Author

skota commented Oct 23, 2024

I am on
{:phoenix, "> 1.7.14"},
{:phoenix_analytics, "
> 0.2"},

I copied the analytics.duckdb to my desktop and can confirm requests has only 1 row.

It works fine locally though. Have an issue on prod.

Prod server is a ubuntu box if that matters.

@lalabuy948
Copy link
Owner

Interesting. Do you have any special configuration for prod environment?

@MoonsilverTV
Copy link

I am encountering the same issue:
version 0.2
application is released as a mix release inside a docker container with MIX_ENV="prod"
it will seem to track a single write and display it correctly in the analytics live view
however, no subsequent interactions are displayed
the duckdb file is put onto a docker compose volume

i too could only see a single row in my duck db when i manually opened it at runtime

however: when i shut down my docker image and restarted it, it then went on to show everything it had been tracking in the past 2 days - though it appears to not be updating the view again

i just went to double check if the behaviour is the same outside a docker container, and it does seem like i'm getting inconsistent update timing with a simple development environment and mix phx.server as well

VPS is running Ubuntu 24.04.1 LTS (GNU/Linux 6.8.0-47-generic x86_64)
dev environment is running NixOS 24.11.20240923.30439d9 (Vicuna) x86_64 (Kernel: 6.6.52)

i'll report if I find anything solid, but my suspicion is that the data might not get flushed to the database as often as it should which would be a plausible bug in the batcher. i'll report back if i find anything more concrete.

@MoonsilverTV
Copy link

just did some printf debugging, the batcher is doing something every second like it should
it hits the if branch that sends the batch update when i would expect it to
it batches reasonable RequestLog structs
stuff gets correctly forwarded to Repo.insert_many

here i have the following things happen, which also all seems reasonable to me:

insert_many
connection ok
not in postgres mode
connection:
#Reference<0.1471136449.775553092.21491>
prepared:
[
  ["dfa324a7-4769-4ae4-86fb-adf339657668", "GET", "/phoenix/live_reload/frame",
   200, 0,
   "Mozilla/5.0 (X11; Linux x86_64; rv:130.0) Gecko/20100101 Firefox/130.0",
   "127.0.0.1", "http://localhost:4000/dev/analytics", "desktop",
   "063c2772-9a55-4aa1-af75-8525c0b8706d", 134, "2024-10-24 20:31:24.514"],
  ["d9cebb47-c374-43d7-9edc-99c29fbf9584", "GET", "/dev/analytics", 200, 7,
   "Mozilla/5.0 (X11; Linux x86_64; rv:130.0) Gecko/20100101 Firefox/130.0",
   "127.0.0.1", "Direct", "desktop", "063c2772-9a55-4aa1-af75-8525c0b8706d",
   133, "2024-10-24 20:31:24.411"]
]
appender:
#Reference<0.1471136449.775553097.21746>
result:
:ok

@MoonsilverTV
Copy link

However, these requests above were apparently not persisted in the .duckdb file
I then restarted the server (double ctrl c cancel -> mix phx.server) and navigated around some more, saw similar logs, and that time they were persisted in the duckdb file
That's a rough one...

I'm out of time for the day, if I find time on the weekend, i'll try and check if this also happens with Postgres

@skota
Copy link
Author

skota commented Oct 24, 2024

No i don't have any special config. I just deploy a release. I will try to dig through the code and see if i can set up logging to see where the problem could be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Potential feature request / change
Projects
None yet
Development

No branches or pull requests

3 participants