Bug #43897
open
crash module reports UTC timestamps but doesn't format timestamps accordingly
Added by Jan Fajerski over 4 years ago.
Updated 9 days ago.
Backport:
reef quincy squid
Description
This can be confusing:
~ # ceph health detail
HEALTH_WARN 1 daemons have recently crashed
RECENT_CRASH 1 daemons have recently crashed
mon.c1boyd1 crashed on host c1boyd1 at 2020-01-28 01:35:32.305835Z
~ # date
Mon Jan 27 19:05:47 MST 2020
The "Z" suffix on the datestring implies UTC iiuc but a +00 or so would probably be better.
- Tags set to low-hanging-fruit
- Assignee set to Nathan Cutler
I guess "2020-01-28 01:35:32.305835Z" is a variant of
$ date --utc --rfc-3339=seconds
2020-04-02 11:13:42+00:00
and the latter one does indeed look more user-friendly.
So, since the timestamp is guaranteed to be UTC, the solution would be to use the "time_from_string" method to convert it into a Python datetime object, and then re-create the string like so:
>>> print('{}+00:00'.format(datetime.datetime.utcnow().isoformat(' ', timespec='seconds')))
2020-08-16 01:33:27+00:00
NOTE: in this example we are just generating an arbitrary datetime object using "datetime.datetime.utcnow()". The point is to show how to generate the timestamp string in the desired format.
- Backport set to octopus, nautilus
- Status changed from New to In Progress
- Status changed from In Progress to Fix Under Review
- Pull request ID set to 36671
- Status changed from Fix Under Review to New
- Assignee deleted (
Nathan Cutler)
- Pull request ID deleted (
36671)
see https://github.com/ceph/ceph/pull/36671 for one attempt to fix this "low-hanging fruit"
(Maybe "cosmetic issue with heavy test exposure" would be a better description than "low-hanging fruit" in this case?)
- Backport changed from octopus, nautilus to pacific, octopus, nautilus
- Translation missing: en.field_tag_list set to low-hanging-fruit
- Status changed from New to Fix Under Review
- Source set to Community (user)
- Backport changed from pacific, octopus, nautilus to reef quincy squid
- Pull request ID set to 36671
Also available in: Atom
PDF