-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Timestamps for logs #6374
Comments
At glance it looks like it will be as easy as modifying this osrm-backend/include/util/log.hpp Line 56 in be35363
We can try https://github.com/fmtlib/fmt to implement timestamp formatting btw. |
Thanks, that was what I hoping for:) |
Here is draft #6375 I still see some logs which have no timestamps though and also not sure we need one more dependency because of it, but fmtlib is nice library(and actually is the same as |
This We use
I.e. if some other logs are happening in the middle(like these warnings in this case) they are "interleave" logs coming from this |
Current log system is prone to race conditions, i.e. if we are doing something like:
we have no guarantee that log will be outputted "atomically", instead we may have it interleaved by some another log happening in another thread. What about refactoring it a bit to something like:
This way we will be able to guarantee that logs are "atomic". @mjjbell @nilsnolde would appreciate your opinion here |
Yeah, I agree, those could easily be refactored to use standard logging. No need for the "ok, after.. " bit if we have timestamps IMO (if it's not ok, it'll throw right). What doesn't take more than a second is not worth measuring time on anyways;)
Thanks a ton for this @SiarheiFedartsou ! I'll immediately try your branch on our PBFs! |
Or we report down to milliseconds? Could do "22-09-23" instead to save some space? |
Not sure I got it, but timestamps I output in this PR are precise up to second. |
Sorry that wasn't too clearly worded.. What I meant: we can get rid of But all the instances where it's printing it's busy with some processing and then later it adds "ok, after .." on the same line and reports the duration down to nanoseconds, they can be removed IMO (esp if they're running in multiple threads). Then, if we add timestamps which go down to milliseconds, I think that's all the resolution one needs (and we can add another line saying What do you think @SiarheiFedartsou ? I'd like to help out, but got a weird error building tbb with
I'm on Arch Linux, EDIT: with
I also have the issue with |
yeah, I would try on Ubuntu. I’ll probably try to build it in some Arch-based docker image one day - may be will find something. And, yeah, agree about your “nanoseconds” point :) |
It's ok for me, there's now and then projects where I have to Ubuntu instead, I have it in dual-boot. But thanks for the offer. I'm really happy to see you pushing things again with @mjjbell ! There weren't many occurrences of Milliseconds is more trouble than it's worth. The C++20 spec says it should print milliseconds when using Regarding this:
The |
Yep, I am a bit wrong here. In case of Line 113 in 660cea8
But |
I checked all usages of UnbufferedLog, it's not used in multi-threaded functions AFAICT. I only changed the one occurrence in traffic signals, where it was mangled with warnings. Others looked fine. If you want you can implement my changes, for me this PR looks good either way:) |
Going to merge #6375 soon.
btw IMO this is the main problem with UnbuferredLog - you never know if methods you are calling will log something or not. That's why I'd propose to get rid of it completely(at least I don't see any benefits of it) |
The benefit AFAICT is to print stuff on the same line, eg when reporting progress in percent, which is arguably nice for UX. It just the logs fairly concise. I’d personally keep it, but have not a very strong opinion about it. |
Closing as #6375 was merged. |
I’d like to add timestamps to the processing logs of the various commands. I didn’t look into the code base yet, not sure if the logging is centralized, so it’d be quick to add, or it needs a logging abstraction.
We had some issues lately where custom PBFs take a whole longer to pass through osrm-contract. Timestamps would help to see in which phase of the pipeline it’s hanging. And it’s general good practice IMO. Shout out if any objections/thoughts.
The text was updated successfully, but these errors were encountered: