This repository was archived by the owner on Feb 26, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 59
feat: support AuditLog and RequestLog protos #274
Merged
+138
−23
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
5c8bd7e
added support for audit log proto
daniel-sanche b15b20e
added system test for audit logs
daniel-sanche f389c33
changed payload_json logic
daniel-sanche 7a75fca
tests should still pass of audit log can't be found
daniel-sanche 646f717
system test actually creates audit log
daniel-sanche 06cf4f5
improved tests
daniel-sanche 549566e
fixed warnings
daniel-sanche fc36053
fixed lint issues
daniel-sanche 568bfcf
fixed lint issues
daniel-sanche 05f3283
fixed test issues
daniel-sanche 83e3111
added more proto dependencies
daniel-sanche 5ce683f
added new system test
daniel-sanche dc90e72
removed extra protos
daniel-sanche 66d9c62
fixed lint issues
daniel-sanche afddbf9
added test comments
daniel-sanche 25c39df
Merge branch 'master' into support-protos
daniel-sanche 2aa35ca
adjusted system test parameters
daniel-sanche 2d89fa1
use uuids in system tests
daniel-sanche 2c8e136
changed retry logic
daniel-sanche File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -503,6 +503,20 @@ def test_to_api_repr_defaults(self): | |
| } | ||
| self.assertEqual(entry.to_api_repr(), expected) | ||
|
|
||
| def test_to_api_repr_struct(self): | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please, no abbreviations in test or other method names
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "to_api_repr" is an existing function that we can't change here without breaking the API. We could add this to the list for v3.0.0 changes (but it may not be worth the user confusion) |
||
| from google.protobuf.struct_pb2 import Struct, Value | ||
| from google.cloud.logging_v2.logger import _GLOBAL_RESOURCE | ||
|
|
||
| LOG_NAME = "struct.log" | ||
| message = Struct(fields={"foo": Value(bool_value=True)}) | ||
| entry = self._make_one(log_name=LOG_NAME, payload=message) | ||
| expected = { | ||
| "logName": LOG_NAME, | ||
| "jsonPayload": message, | ||
| "resource": _GLOBAL_RESOURCE._to_dict(), | ||
| } | ||
| self.assertEqual(entry.to_api_repr(), expected) | ||
|
|
||
| def test_to_api_repr_explicit(self): | ||
| import datetime | ||
| from google.cloud.logging import Resource | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.