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

improvement: Adds timestamp to messages #13

Merged
merged 1 commit into from
Sep 15, 2020
Merged

improvement: Adds timestamp to messages #13

merged 1 commit into from
Sep 15, 2020

Conversation

dm36
Copy link
Contributor

@dm36 dm36 commented Sep 2, 2020

improvement: Adds timestamp to messages

Includes a timestamp for each message/line that flows through the client.

Allows the user to provide their own timestamp through Options- and if the timestamp is not provided- a default value is used.

Semver: Patch
Ref: LOG-7156

@dm36 dm36 requested a review from mdeltito September 2, 2020 21:10
@dm36 dm36 marked this pull request as draft September 2, 2020 21:10
@dm36 dm36 changed the title Adds timestamp to messages improvement: Adds timestamp to messages Sep 3, 2020
@dm36 dm36 force-pushed the dmadhok/LOG-7156 branch 2 times, most recently from 8e67182 to 5f081f1 Compare September 9, 2020 21:09
@dm36 dm36 marked this pull request as ready for review September 9, 2020 21:09
@dm36 dm36 added the enhancement New feature or request label Sep 9, 2020
Copy link
Member

@mdeltito mdeltito left a comment

Choose a reason for hiding this comment

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

we'll need tests around the value that gets sent in the payload, rather than from the Options as it is currently

logger/logger.go Outdated Show resolved Hide resolved
logger/options.go Outdated Show resolved Hide resolved
logger/options.go Outdated Show resolved Hide resolved
logger/options_test.go Outdated Show resolved Hide resolved
logger/options_test.go Outdated Show resolved Hide resolved
@dm36 dm36 force-pushed the dmadhok/LOG-7156 branch 4 times, most recently from 2b7ff22 to 8ef23dc Compare September 10, 2020 06:24
@dm36 dm36 requested a review from mdeltito September 10, 2020 06:26
logger/logger.go Outdated Show resolved Hide resolved
logger/logger_test.go Outdated Show resolved Hide resolved
@mdeltito
Copy link
Member

also note that code coverage is being published, you can check it in CircleCI artifacts: https://98-268886384-gh.circle-artifacts.com/0/tmp/artifacts/coverage.html#file2 (you will see there is a new uncovered line in this PR)

@dm36 dm36 force-pushed the dmadhok/LOG-7156 branch 2 times, most recently from 4d3c07c to 680a50f Compare September 11, 2020 00:27
@dm36 dm36 requested a review from mdeltito September 11, 2020 00:29
logger/logger_test.go Outdated Show resolved Hide resolved
logger/logger_test.go Outdated Show resolved Hide resolved
logger/logger_test.go Outdated Show resolved Hide resolved
@dm36 dm36 requested a review from mdeltito September 12, 2020 03:02
logger/options.go Show resolved Hide resolved
logger/transport.go Outdated Show resolved Hide resolved
logger/logger.go Outdated Show resolved Hide resolved
Copy link
Contributor

@smusali smusali left a comment

Choose a reason for hiding this comment

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

few small comments

Copy link
Member

@mdeltito mdeltito left a comment

Choose a reason for hiding this comment

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

latest lgtm, one nit

logger/logger_test.go Outdated Show resolved Hide resolved
Includes a timestamp for each message/line that flows through the client.

Allows the user to provide their own timestamp through Options- and if the timestamp is not provided- the value is defaulted.

Semver: Patch
Ref: LOG-7156
Copy link
Contributor

@smusali smusali left a comment

Choose a reason for hiding this comment

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

lgtm!

if timestamp.IsZero() {
timestamp = time.Now()
}
line.Timestamp = timestamp.UnixNano() / int64(time.Millisecond)

Choose a reason for hiding this comment

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

I was also going to originally mention that this logic is a bit confusing to read at first. It's mostly an issue with the variable names not providing enough context. My understanding is that the constant time.Millisecond is the Duration of 1ms. Duration is measured in nanoseconds so time.Millisecond is the number of nanoseconds in 1 millisecond. That's why the math above works.

Might be worthwhile to drop a comment about it. Not necessary, gonna approve regardless.

@dm36 dm36 merged commit 1bec0a7 into master Sep 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants