Opened 16 years ago
Closed 15 years ago
#100 closed defect (fixed)
timestamps: use fully qualified, unambiguous, standard format
Reported by: | Zooko | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 0.5.0 |
Component: | logging | Version: | 0.3.0 |
Keywords: | Cc: | Zooko, zooko@… |
Description (last modified by )
Please use ISO-8601, except with "_" instead of "T" for the separating character for all timestamps. Please include the ISO-8601 unambiguous timezone indicator (which is either "Z" or a number of hours offset from UTC).
Here is Markus Kuhn's advocacy and summary of ISO-8601:
Here is the related discussion from the Tahoe trac:
- http://allmydata.org/trac/tahoe/ticket/326 # use consistent time stamps in logging
Here are some Python implementations of ISO and/or UTC timestamps:
- http://allmydata.org/trac/tahoe/browser/src/allmydata/node.py?rev=2731#L30
- http://allmydata.org/trac/tahoe/browser/src/allmydata/util/time_format.py?rev=2424#L12
- http://allmydata.org/trac/pyutil/browser/pyutil/pyutil/time_format.py?rev=93
This ticket is the more urgent, less controversial subset of #90 (timestamps: formatting and timezones).
Change History (5)
comment:1 Changed 16 years ago by
Description: | modified (diff) |
---|
comment:2 Changed 15 years ago by
I'm trying to figure out "what happened yesterday" by looking at foolscap incident report files, and I'm very frustrated that I can't easily tell what day it was or what timezone is used for the timestamps in the incident report file. Please use a fully-qualified, unambiguous format including date and timezone on all timestamps. If I write a patch for foolscap that does this, will you accept it?
comment:3 Changed 15 years ago by
How about this: for "flogtool web-viewer", I'll accept a patch which does:
- add a tooltip to the timestamp span which contains full ISO-8601 timestamps for both UTC and localtime: "UTC: 2008-02-28 03:01:02.092443Z\nLocal: 2008-02-27 20:01:02.092443-0700" (I know that you can add a tooltip to an anchor tag by adding a
title=
attribute, as in<a href="URL" title="tooltip">
.. I suspect it is possible to add one to an arbitrary<span>
too). - add a flag to the code that controls the non-tooltip string, to emit either localtime ("20:01:02.092") or UTC ("03:01:02.092Z")
- add an HTTP query argument named "timestamp" which accepts the values "utc" or "local", and sets that flag
- add a CLI argument --utc, which changes the default behavior (when ?timestamp= is omitted) from =local to =utc
Having that tooltip would also fix a problem I've had where sometimes I want to know the day of the event, but most of the time that would clutter up the display too much. Adding the full timezone info to the non-tooltip display would reduce the space available for useful (event) information. Think of the non-tooltip display as sort of being a relative timestamp, with the tooltip form giving you the absolute value.
For "flogtool dump", let's do this:
- add a --timestamp= CLI argument
- default value is "short-local", which sticks to the current "%H:%M:%.3S" localtime format
- --timestamp=utc will use "2008-02-28_03:01:02.092443Z" (UTC)
- --timestamp=long will use "2008-02-27_20:01:02.092443-0700" (localtime)
This would attempt to strike a compromise between my desire for short timestamps (so that they don't distract from the rest of the log event), my desire to compare timestamps against human events (like my wristwatch, or the server upgrade that I did just before lunch), and your desire to compare timestamps against events in other timezones.
Do you think that this would work for you? You might find yourself running "flogtool dump" (without a --timestamp argument), staring in confusion and dismay for a while at the ambiguous timestamps it prints out, and then realizing that you really wanted to use "flogtool dump --timestamp=utc". I'm hopeful that the lack of a "Z" suffix would be a cue that these timestamps are in localtime, which might remind you that there is another option.
comment:4 Changed 15 years ago by
This sounds like it would solve most of my problems. In addition to the above, I would also prefer to have an option which includes a full date stamp before the timestamp on each line.
comment:5 Changed 15 years ago by
Milestone: | undecided → 0.5.0 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
ok, I wrote and committed the patch to do the stuff described above. I also added some links to the web-viewer page to make it more obvious what form of timestamps are being used, and to switch between them (there are also links to change the sort order of the events). Added in [638248d149ec771757809428acd4d117d651642c].
reformatted summary a bit