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

test: fix list logs test flakiness #301

Merged
merged 13 commits into from
Oct 28, 2020

Conversation

simonz130
Copy link

@simonz130 simonz130 commented Oct 27, 2020

  • Added monitored resource and improved filtering logic for listing logs. Previously it was flaky due to # of calls to list logs that could (despite filter) be executed too many times, exceeding quota.

Fixes #288
Fixes #271
Fixes #270
Fixes #268
Fixes #264 ☕️

@simonz130 simonz130 added priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: cleanup An internal cleanup or hygiene concern. api: logging Issues related to the googleapis/java-logging API. automerge Merge the pull request once unit tests and other checks pass. labels Oct 27, 2020
@simonz130 simonz130 requested a review from chingor13 October 27, 2020 23:43
@simonz130 simonz130 requested a review from a team as a code owner October 27, 2020 23:43
@simonz130 simonz130 requested a review from a team October 27, 2020 23:43
@simonz130 simonz130 requested a review from a team as a code owner October 27, 2020 23:43
@simonz130 simonz130 self-assigned this Oct 27, 2020
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Oct 27, 2020
Copy link

@yoshi-code-bot yoshi-code-bot left a comment

Choose a reason for hiding this comment

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

Some suggestions could not be made:

  • google-cloud-logging/src/main/java/com/google/cloud/logging/LogEntry.java
    • lines 35-40
  • google-cloud-logging/src/main/java/com/google/cloud/logging/Logging.java
    • lines 440-442
    • lines 461-465
    • lines 681-682
  • google-cloud-logging/src/main/java/com/google/cloud/logging/LoggingHandler.java
    • lines 38-39
    • lines 56-58
    • lines 75-76
  • google-cloud-logging/src/main/java/com/google/cloud/logging/Metric.java
    • lines 29-30
  • google-cloud-logging/src/main/java/com/google/cloud/logging/MetricInfo.java
    • lines 27-28
  • google-cloud-logging/src/main/java/com/google/cloud/logging/SinkInfo.java
    • lines 458-459
    • lines 617-618
  • google-cloud-logging/src/main/java/com/google/cloud/logging/Synchronicity.java
    • lines 20-22
  • google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/LoggingRpc.java
    • lines 99-101

Copy link

@yoshi-code-bot yoshi-code-bot left a comment

Choose a reason for hiding this comment

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

Some suggestions could not be made:

  • google-cloud-logging/src/main/java/com/google/cloud/logging/LogEntry.java
    • lines 35-40
  • google-cloud-logging/src/main/java/com/google/cloud/logging/Logging.java
    • lines 440-442
    • lines 461-465
    • lines 681-682
  • google-cloud-logging/src/main/java/com/google/cloud/logging/LoggingHandler.java
    • lines 38-39
    • lines 56-58
    • lines 75-76
  • google-cloud-logging/src/main/java/com/google/cloud/logging/Metric.java
    • lines 29-30
  • google-cloud-logging/src/main/java/com/google/cloud/logging/MetricInfo.java
    • lines 27-28
  • google-cloud-logging/src/main/java/com/google/cloud/logging/SinkInfo.java
    • lines 458-459
    • lines 617-618
  • google-cloud-logging/src/main/java/com/google/cloud/logging/Synchronicity.java
    • lines 20-22
  • google-cloud-logging/src/main/java/com/google/cloud/logging/spi/v2/LoggingRpc.java
    • lines 99-101

Copy link
Collaborator

@chingor13 chingor13 left a comment

Choose a reason for hiding this comment

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

please run mvn com.coveo:fmt-maven-plugin:format. I'm not sure what's going on with the bot suggestions.

@gcf-merge-on-green
Copy link

Your PR has attempted to merge for 3 hours. Please check that all required checks have passed, you have an automerge label, and that all your reviewers have approved the PR

1 similar comment
@gcf-merge-on-green
Copy link

Your PR has attempted to merge for 3 hours. Please check that all required checks have passed, you have an automerge label, and that all your reviewers have approved the PR

@gcf-merge-on-green
Copy link

Merge-on-green attempted to merge your PR for 6 hours, but it was not mergeable because either one of your required status checks failed, or one of your required reviews was not approved. Learn more about your required status checks here: https://help.github.com/en/github/administering-a-repository/enabling-required-status-checks. You can remove and reapply the label to re-run the bot.

1 similar comment
@gcf-merge-on-green
Copy link

Merge-on-green attempted to merge your PR for 6 hours, but it was not mergeable because either one of your required status checks failed, or one of your required reviews was not approved. Learn more about your required status checks here: https://help.github.com/en/github/administering-a-repository/enabling-required-status-checks. You can remove and reapply the label to re-run the bot.

@gcf-merge-on-green gcf-merge-on-green bot removed the automerge Merge the pull request once unit tests and other checks pass. label Oct 28, 2020
@chingor13 chingor13 added the automerge Merge the pull request once unit tests and other checks pass. label Oct 28, 2020
@chingor13 chingor13 changed the title fix: list logs test flackiness test: fix list logs test flackiness Oct 28, 2020
Copy link
Contributor

@freelerobot freelerobot left a comment

Choose a reason for hiding this comment

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

Are there Devsite docs that contain these samples with mentions of "stackdriver"? If so, you might want to request changes there as well if you haven't done so already.

@freelerobot freelerobot changed the title test: fix list logs test flackiness test: fix list logs test flakiness Oct 28, 2020
String monitoredResourceFilter =
appendResourceTypeFilter(filter.toString(), monitoredResources);

Logging.EntryListOption[] options = {Logging.EntryListOption.filter(monitoredResourceFilter)};
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think we should change Logging.EntryListOption.filter to use a 1 day timestamp filter by default? That's what I did in Python. It seems like a bad developer experience to hang on this function using the default options

Copy link
Author

Choose a reason for hiding this comment

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

That's what I did here too - even a bit more restrictive filter of 1 hour back instead of 24 hours back. If you look at line 106 - I call createTimestampFilter(1) to restrict logs range, then on line 110 I add resourceType filter to further restrict the filter on top of time range.

Copy link
Contributor

@daniel-sanche daniel-sanche Oct 28, 2020

Choose a reason for hiding this comment

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

It looks like you changed the test, but should we change the function itself too? (unless I missed that)

@simonz130
Copy link
Author

Are there Devsite docs that contain these samples with mentions of "stackdriver"? If so, you might want to request changes there as well if you haven't done so already.

There is a bot that will open a bunch of bugs to verify that all docs pages that include the sample are "OK" with it. I'll verify them as we go.

@simonz130 simonz130 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 28, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 28, 2020
@codecov
Copy link

codecov bot commented Oct 28, 2020

Codecov Report

Merging #301 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #301   +/-   ##
=========================================
  Coverage     75.34%   75.34%           
  Complexity      593      593           
=========================================
  Files            42       42           
  Lines          3715     3715           
  Branches        259      259           
=========================================
  Hits           2799     2799           
  Misses          762      762           
  Partials        154      154           
Impacted Files Coverage Δ Complexity Δ
...c/main/java/com/google/cloud/logging/LogEntry.java 90.45% <ø> (ø) 51.00 <0.00> (ø)
...rc/main/java/com/google/cloud/logging/Logging.java 100.00% <ø> (ø) 0.00 <0.00> (ø)
.../java/com/google/cloud/logging/LoggingHandler.java 73.63% <ø> (ø) 22.00 <0.00> (ø)
...in/java/com/google/cloud/logging/LoggingLevel.java 100.00% <ø> (ø) 3.00 <0.00> (ø)
...src/main/java/com/google/cloud/logging/Metric.java 91.89% <ø> (ø) 15.00 <0.00> (ø)
...main/java/com/google/cloud/logging/MetricInfo.java 90.00% <ø> (ø) 16.00 <0.00> (ø)
...g/src/main/java/com/google/cloud/logging/Sink.java 89.74% <ø> (ø) 14.00 <0.00> (ø)
...c/main/java/com/google/cloud/logging/SinkInfo.java 80.69% <ø> (ø) 19.00 <0.00> (ø)
...n/java/com/google/cloud/logging/Synchronicity.java 100.00% <ø> (ø) 1.00 <0.00> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 453cc05...7ce4515. Read the comment docs.

@simonz130 simonz130 merged commit 024b73d into googleapis:master Oct 28, 2020
@gcf-merge-on-green gcf-merge-on-green bot removed the automerge Merge the pull request once unit tests and other checks pass. label Oct 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: logging Issues related to the googleapis/java-logging API. cla: yes This human has signed the Contributor License Agreement. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: cleanup An internal cleanup or hygiene concern.
Projects
None yet
6 participants