-
Notifications
You must be signed in to change notification settings - Fork 311
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
fix: timestampNanos nanos precision. #2003
fix: timestampNanos nanos precision. #2003
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Working on CLA |
...g-cloud-gcp-logging/src/main/java/com/google/cloud/spring/logging/StackdriverJsonLayout.java
Outdated
Show resolved
Hide resolved
...-logging/src/test/java/com/google/cloud/spring/logging/StackdriverJsonLayoutLoggerTests.java
Outdated
Show resolved
Hide resolved
1549643
to
86a4344
Compare
.map(data -> (Double) data.get(StackdriverTraceConstants.TIMESTAMP_NANOS_ATTRIBUTE)) | ||
.collect(Collectors.toList()); | ||
|
||
assertThat(logTimestampNanos).anySatisfy(nanos -> assertThat(nanos % 1000000).isGreaterThan(0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't nanos be 0
though?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I wanted to create test to ensure that there is nano precision and not just mili.
I am testing 2 logs with any greater than 0 to lower false negative possibility (when all micros and nanos are 0) to 1:1e+12.
Not sure if you like it this way or maybe just simple 1 log with nanos greaterOrEqual(0).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the way you have it is fine. As you point out, the likelihood of flakiness due to this is tiny. You might just want to make sure you are getting 2 timestamps in the array. You can even make the number of logs a variable.
Kudos, SonarCloud Quality Gate passed! |
Sorry, my company can't sign the CLA. Closing. |
Fix #1996
I hope that testTimestampNanos() is enough. I am testing 2 logs to lower false negative possibility (when all micros and nanos are 0) to 1:1e+12