timestamp
for dotnet counters
in JSON Formatted Incorrectly
#3905
Labels
Milestone
timestamp
for dotnet counters
in JSON Formatted Incorrectly
#3905
Description
When outputting using the
JSON
format, I get aStartTime
that looks like this:5/23/2023 10:34:49 AM
.However, each individual
timestamp
looks like this:2023-05-23 10:34:59Z
.My understanding is that the "Z" at the end of the time indicates that this is supposed to be UTC; however, this is still local time (as seen in
StartTime
). I'm not sure if this time is supposed to be in UTC, but if so, I believe.ToUniversalTime()
should be used here.This became apparent while I was working on automated testing for
dotnet counters
; when deserializing aJSONCounterTrace
, I believe the trailing "Z" is indicating that the timestamp should be treated as UTC, causing thetimestamp
to be incorrect (e.g.{5/23/2023 3:34:49 AM}
local time). When I made the change listed above (using.ToUniversalTime()
), this fixed the issue with the test reporting the incorrect time (note that this causesdotnet-counters
to actually print in UTC though).Configuration
Debugging locally on Windows using
main
:collect --format json --output "C:\\artifacts\\collect.json" --counters "HatCo.HatStore" --name CustomMetricsTest --refresh-interval 5
Regression?
This appears to have originated in this change.
Other information
The text was updated successfully, but these errors were encountered: