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

feat: implement listLogs API and provide sample snippet #602

Merged
merged 14 commits into from Aug 12, 2021

Conversation

minherz
Copy link
Contributor

@minherz minherz commented Jul 30, 2021

Implements listLogs interface for com.google.cloud.logging.Logging interface.
Implements unit testing for the listLogs interface.
Adds sample snippet for listLogs interface.
Refactors com.example.logging.ListLogs to incorporate listLogs snippet into the class.

Fixes #593
Fixes #358

@minherz minherz requested review from a team as code owners July 30, 2021 11:18
@product-auto-label product-auto-label bot added the api: logging Issues related to the googleapis/java-logging API. label Jul 30, 2021
@snippet-bot
Copy link

snippet-bot bot commented Jul 30, 2021

Here is the summary of changes.

You are about to add 3 region tags.
You are about to delete 1 region tag.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@product-auto-label product-auto-label bot added the samples Issues that are directly related to samples. label Jul 30, 2021
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Jul 30, 2021
@minherz minherz added the lang: java Issues specific to Java. label Jul 30, 2021
@simonz130 simonz130 assigned minherz and unassigned shubha-rajan Jul 30, 2021
google-cloud-logging/clirr-ignored-differences.xml Outdated Show resolved Hide resolved
@minherz minherz requested a review from chingor13 August 8, 2021 12:09
@minherz minherz dismissed chingor13’s stale review August 8, 2021 15:24

The XML file was modified to narrow the opted out scope. The default method implementations were provided.

@minherz minherz requested a review from simonz130 August 8, 2021 15:24
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.

Feature looks fine to me (aside from the method name on the Rpc interface/implementation).

New samples need to follow the rubric/format set by the Java samples working group: https://github.com/GoogleCloudPlatform/java-docs-samples/blob/master/SAMPLE_FORMAT.md. If that is significant work, consider breaking apart the feature PR and the sample PR

Copy link

@simonz130 simonz130 left a comment

Choose a reason for hiding this comment

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

Great work!

@minherz minherz requested a review from chingor13 August 10, 2021 12:50
@minherz
Copy link
Contributor Author

minherz commented Aug 10, 2021

@chingor13 i did not find the reason why the snippet-bot fails. the region tags in ListLogs.java and ListLogEntries.java match and I am unaware of other tests that the bot may perform. maybe it is due to the split of the snippets.
i tried to restart the check from the Checks console, but it either does not work or has no effect.

@chingor13
Copy link
Collaborator

@chingor13 i did not find the reason why the snippet-bot fails. the region tags in ListLogs.java and ListLogEntries.java match and I am unaware of other tests that the bot may perform. maybe it is due to the split of the snippets.
i tried to restart the check from the Checks console, but it either does not work or has no effect.

The way snippets work on Cloudsite is the reference the snippet by GitHub repo, file path, and snippet name. By moving the snippet to a different file, it will break the sample usage. Moving a snippet to a new file or repo involves 3 steps:

  1. Duplicate the snippet to the new file
  2. Fix references to that snippet to the new location
  3. Remove the original snippet.

@minherz minherz force-pushed the minherz/create-list-logs branch 2 times, most recently from 379aca9 to df90c9f Compare August 11, 2021 05:30
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.

nit on license header in new file

Otherwise make sure we're not breaking the snippets

@minherz minherz requested a review from chingor13 August 11, 2021 17:01
Copy link

@lesv lesv left a comment

Choose a reason for hiding this comment

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

We do not bump copyrights.
Please ping me if you want details.

@minherz
Copy link
Contributor Author

minherz commented Aug 11, 2021

@lesv the copyright year change for existing files are rolled back. the copyright year is adjusted for a new file only.

@minherz minherz requested a review from lesv August 11, 2021 18:24
@minherz minherz requested a review from chingor13 August 12, 2021 05:23
Add listLogs API support to hand-written layer of google-cloud-logging.
Add unit testing for the new listLogs API.

Fixes #593
Add a sample snippet to demonstrate use of listLogs API.
Refactor ListLogs to include snippets for listLogs and listLogEntries.
Format all snippets.

Fixes #358.
Because of JDK 1.7 it is impossible to provide default implementation
for new interface methods.
File with exclusions is added instead. The file should be removed once
JDK version is upgraded.
Fix printed string in LogEntryWriteHttpRequest.createLogEntryRequest().
Fix loops to wait for any data in STDOUT.
Add test for listLogs snippet.
Update testListLogNames() signature to throw exceptions
Test ListLogs.printLogNames vs audit logs to save time.
Restore retrieval of log entries in the wait loop to ensure printing to STDOUT
Provide method level exception configuration in clirr-ignored-differences.
Implement default methods for new methods in Logging and LoggingRpc interfaces.
Following guidelines, remove serialVersionUID from LogNamePageFetcher.
Make more verbose naming for methods.
Refactor testing after renaming interface method(s).
Split ListLogs sample into two: ListLogEntries and ListLogs.
update the list log entries filter to bring results only for the last hour.
adding empty region tag logging_list_log_entries to ListLogs.java
@chingor13 chingor13 dismissed their stale review August 12, 2021 15:55

stale, will defer to other reviewers

@lesv
Copy link

lesv commented Aug 12, 2021

+// [START logging_list_log_entries]
+
+
+// [END logging_list_log_entries]

Jeff, it is a problem of the chicken and egg. Your review request was to have one snippet per file (by guidelines). Snippet management team requires the migration to be done by first introducing the code and then moving the region tag (spoke with Takashi). It is impossible to do both at once. This PR is stuck for a week just because we discuss this subject. Please, release it. I will issue the fixing PR within an hour that will clean up the duplicated region tag.
The guidelines allow a short period of time when the particular sample will be empty. I just need the help to take the work forward.

Woa - this seems wrong. Where are you hearing about this process -- I'd like to fix it.

@lesv
Copy link

lesv commented Aug 12, 2021

Note - my LGTM was only for the copyrights. Let me take another look.

@minherz minherz merged commit 9359569 into master Aug 12, 2021
@minherz minherz deleted the minherz/create-list-logs branch August 12, 2021 17:35
@lesv
Copy link

lesv commented Aug 12, 2021 via email

gcf-merge-on-green bot pushed a commit that referenced this pull request Aug 24, 2021
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. lang: java Issues specific to Java. samples Issues that are directly related to samples.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: Implement user friendly interface for listLogs API Add sample to list available logs
5 participants