-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
SQL errors with Metrics rendering in Cachet 2.4-dev and Postgres 10. #3254
Comments
👋 Thank you for opening your first issue. I'm just an automated bot that's here to help you get the information you need quicker, so please ignore this message if it doesn't apply to your issue. |
@Pahanda apologies for the delay! Do you have a dump of your |
I could do with some help on the Postgres side of things. |
Experiencing the same issue currently, do you still need that db dump @jbrooksuk ? |
@jbrooksuk - any updates on this? |
Same issue occuring for me as well on a fresh install, ubuntu 16.04 with docker |
an update (if it helps):
final statment i got:
(ofc i changed :metricid to 1 to test the sql) |
Editing app/Repositories/Metric/SqliteRepository.php and editing the sql statment starting on line 35 and adding YYYY-MM-DD to the group_by and wrapping the order_by in a to_char() method solved the issue and metrics are now working! |
@Puyodead1 For those of us not as PHP savvy, could you paste the modified block? :D |
Just wanted to post that I got this working with Cachet 2.4.0 dev and Postgres 12 all in docker containers. See my diff here. Please note I am not a php developer, like at all. I did these changes through trial and error based off @Puyodead1's comment above. I will lastly mention my "Last Hour" graph is delayed by 10 minutes, but that's a separate issue (expected? Idk...). -Joe |
To follow up on my above comment, it looks like my metrics are not showing up in the "Last Hour" graph, but they are in the the "12 hours" one. The graph does still show up (just with default values) so this may be an issue with how I am trying to get around the timezone issue. That issue is uploaded metrics in epoch UTC time are displayed in such a time (as in they Cachet doesn't use the timezone set in the settings to change the metric timezones). To get around that I edit the timezones of the metric to my local timezone before I upload them, that way correctly displaying them in the graph. If Cachet ever changes this in the future I can just change back to uploading in UTC, but for now this does work for at least 12 hour graph. I will let Cachet run to see if I can get metrics to show up in the Last Hour graph. I do see there are some other issues related to timezones or time related metrics, so that may be my current issue. |
Glad you got it working.
I had an issue with the time also. I changed stuff in the code to display the metric time differently, but that didn't go as I had expected. |
Yes I tried to upload my metrics in my current time zone, but that had adverse affects. My Last hour graph displayed nothing, and my 12 hours graph only displayed the most recent 7 hours (though they were correct). This probably has something to do with UTC and my timezone being in PDT (7 hours behind). My current "fix", which isn't really a fix, is to just upload everything in UTC and display in UTC. That seems to work just fine. I will look more into getting the timezone to display correctly and see if I can figure it out. |
We faced the same issue and the following fix worked for us :- https://github.com/CachetHQ/Cachet/pull/3830/files |
sorry to tag onto this but i get this error using postgres 9.5 and the latest docker image |
@si458 If you are asking for a fix in the official docker image (which isn't unreasonable), that I don't know. I'll defer to the Cachet repo members for that one. If you would like something now that somewhat works, the fix I posted above does seem to work for me (see the diff I posted). You can fork Cachet and add it yourself. Then change your Dockerfile to point to your forked repo. One caveat with this is I only got everything working with uploading in my local timezone. I could not get upload in UTC working with displaying in my local timezone. I also ran into a snag with daylight savings during the beginning of November, but that was my fault. I also had to setup my local timezone to work in all my containers. So if you use the fix I posted above you should at least be able to display in whatever timezone you upload. This is currently sufficient for my needs, but does involve a bit of work to get working (namely the fix in my diff and passing through my local timezone) and I understand if you would like to just have it "work". |
any progress on this one? |
Cachet issue: cachethq#3254 Fix from pull request: cachethq#3830
Thank you for your input on Cachet 2.x. We are shifting our attention and resources to Cachet 3.x and will no longer be supporting the 2.x version. If your feedback or issue is relevant to the 3.x series, we encourage you to engage with the new branch. For more information on the Cachet rebuild and our plans for 3.x, you can read the announcement here. We appreciate your understanding and look forward to your contributions to the new version. |
Fresh Cachet 2.4-dev install with PostgreSQL 10 (and a table prefix of
cachet_
). Any attempts to have a Metric item's graph displayed have an image loading placeholder, and the Laravel log fills up with this:There is a full stack trace, but the problem is in the SQL, so I'm omitting it.
There's two separate problems here.
The first is that with recent PostgreSQL versions, it's not quite smart enough to identify the
to_char()
call as a key, so you have to explicitly state it in theGROUP BY
clause, like this:That's an easy fix.
But there's another problem which is preventing it from returning data. This system that I'm running it on is freshly installed, and I only just created data this morning, so the
created_at
values are very recent:created_at
appears stored in UTC andupdated_at
is stored at local time, which makes the<= NOW()
part of theWHERE
clause clobber those data points. This may be because I'm passing in data points with a local epoch time (that's Central, while the server is Mountain)... but I don't think that would (should?) cause issues like that. Either way, the results of my query that I added theGROUP BY
fix to are blank, and that doesn't seem right.Eventually, of course, time will move past that
created_at
value, and it should start returning results, but this seems a bit off to me.The text was updated successfully, but these errors were encountered: