Skip to content
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

more granular timestamps in logs #129

Merged
merged 3 commits into from
Aug 1, 2023

Conversation

tzaffi
Copy link
Contributor

@tzaffi tzaffi commented Jul 31, 2023

Summary

Change Conduit's formatter for a higher level of granularity to:

time.RFC3339Nano = "2006-01-02T15:04:05.999999999Z07:00"

Caveat

The RFC3339Nano format removes trailing zeros from the seconds field and thus may not sort correctly once formatted.

Taken from: https://pkg.go.dev/time

Test Plan

CI

@codecov
Copy link

codecov bot commented Jul 31, 2023

Codecov Report

Merging #129 (4b32a7e) into master (442791a) will increase coverage by 2.81%.
Report is 47 commits behind head on master.
The diff coverage is 77.64%.

@@            Coverage Diff             @@
##           master     #129      +/-   ##
==========================================
+ Coverage   67.66%   70.47%   +2.81%     
==========================================
  Files          32       36       +4     
  Lines        1976     2544     +568     
==========================================
+ Hits         1337     1793     +456     
- Misses        570      654      +84     
- Partials       69       97      +28     
Files Changed Coverage Δ
conduit/data/block_export_data.go 100.00% <ø> (+92.30%) ⬆️
conduit/metrics/metrics.go 100.00% <ø> (ø)
conduit/pipeline/metadata.go 69.11% <ø> (ø)
conduit/plugins/config.go 100.00% <ø> (ø)
...duit/plugins/exporters/filewriter/file_exporter.go 81.63% <ø> (-1.06%) ⬇️
conduit/plugins/importers/algod/metrics.go 100.00% <ø> (ø)
...gins/processors/filterprocessor/fields/searcher.go 77.50% <ø> (ø)
...ins/processors/filterprocessor/filter_processor.go 83.82% <ø> (+3.54%) ⬆️
...plugins/processors/filterprocessor/gen/generate.go 34.28% <ø> (ø)
conduit/plugins/processors/noop/noop_processor.go 64.70% <ø> (+6.81%) ⬆️
... and 19 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

assert.Equal(t, str, "{\"__type\":\"A Question\",\"_name\":\"What's in a name?\",\"level\":\"info\",\"msg\":\"That which we call a rose by any other name would smell just as sweet.\",\"time\":\"0001-01-01T00:00:00Z\"}\n")

assert.Equal(t,
"{\"__type\":\"A Question\",\"_name\":\"What's in a name?\",\"level\":\"info\",\"msg\":\"That which we call a rose by any other name would smell just as sweet.\",\"time\":\"0001-01-01T00:00:00Z\"}\n",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interestingly, I'm NOT actually changing this test in any meaningful way. The unit test already assumed this format and the zero-value of the timestamp doesn't print out the sub-second info.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 20 to 21
// Unfortunately, variations on this theme didn't work:
// ConduitTimeFormat = "Mon, 02 Jan 2006 15:04:05.123456789 -0700"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^^^ just adding more decimal places didn't work ^^^

@tzaffi tzaffi changed the title more granular timestamps in log more granular timestamps in logs Jul 31, 2023
conduit/data/config.go Outdated Show resolved Hide resolved
@tzaffi tzaffi requested a review from a team July 31, 2023 13:59
conduit/data/config.go Outdated Show resolved Hide resolved
@tzaffi tzaffi marked this pull request as ready for review July 31, 2023 14:33
@tzaffi tzaffi mentioned this pull request Jul 31, 2023
10 tasks
@tzaffi tzaffi merged commit a0ab9f6 into algorand:master Aug 1, 2023
3 checks passed
@tzaffi tzaffi deleted the logger-timestamp-format branch August 1, 2023 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants