-
Notifications
You must be signed in to change notification settings - Fork 215
feat: debug logs #1460
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
Merged
Merged
feat: debug logs #1460
Changes from 29 commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
77cae8c
feat: debug logs
abbrowne126 dbf9475
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] d1b88fc
Update lint.yml
abbrowne126 2908929
Update streaming_pull_manager.py
abbrowne126 ffaf3e7
fix tests
abbrowne126 9786cad
Update pytest.ini
abbrowne126 48157e1
Update pytest.ini
abbrowne126 def1167
Update pytest.ini
abbrowne126 748fc27
Merge branch 'main' into add-debug-logs
abbrowne126 92ebea1
re-enable mypy
abbrowne126 8af2d93
add temporary ignore for credential warning when creds file used in u…
abbrowne126 7954be6
fix typo
abbrowne126 23f099d
fix filter
abbrowne126 791e5f2
fix samples errors
abbrowne126 fb76483
remove comment
abbrowne126 1b0a175
fix wrap callback errors structure
abbrowne126 01a0acb
adjust how exactly once passed to callback loggers
abbrowne126 c2224e6
formatting
abbrowne126 7fbf91b
formatting
abbrowne126 b41d8ab
adjust logic to log ack requests
abbrowne126 4ea941d
lint
abbrowne126 c2f9287
format
abbrowne126 444ba08
keep mypy disabled for now
abbrowne126 c10a7e6
try reverting
abbrowne126 e4140d5
format
abbrowne126 de4eac6
adjust message logic
abbrowne126 07cf4f0
add mock message generator
abbrowne126 df81335
formatting
abbrowne126 0630f20
clean up unused imports
abbrowne126 9fb4a1a
add missing param
abbrowne126 dcfaeff
try reverting callback changes
abbrowne126 a6a3b22
fix mock generation
abbrowne126 a48f8fb
try message count reduction
abbrowne126 c69e9c9
see err
abbrowne126 aee206e
add req_type property to _process_requests
abbrowne126 1d12711
format
abbrowne126 821fe3e
fix typing constraint for py3.7
abbrowne126 fa53276
noxfile
abbrowne126 6902ca0
nf 2
abbrowne126 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,7 @@ | |
|
|
||
| import datetime as dt | ||
| import json | ||
| import logging | ||
| import math | ||
| import time | ||
| import typing | ||
|
|
@@ -43,6 +44,8 @@ | |
| attributes: {} | ||
| }}""" | ||
|
|
||
| _ACK_NACK_LOGGER = logging.getLogger("ack-nack") | ||
|
|
||
| _SUCCESS_FUTURE = futures.Future() | ||
| _SUCCESS_FUTURE.set_result(AcknowledgeStatus.SUCCESS) | ||
|
|
||
|
|
@@ -274,6 +277,7 @@ def ack(self) -> None: | |
| time_to_ack = math.ceil(time.time() - self._received_timestamp) | ||
| self._request_queue.put( | ||
| requests.AckRequest( | ||
| message_id=self.message_id, | ||
| ack_id=self._ack_id, | ||
| byte_size=self.size, | ||
| time_to_ack=time_to_ack, | ||
|
|
@@ -282,6 +286,12 @@ def ack(self) -> None: | |
| opentelemetry_data=self.opentelemetry_data, | ||
| ) | ||
| ) | ||
| _ACK_NACK_LOGGER.debug( | ||
| "Called ack for message (id=%s, ack_id=%s, ordering_key=%s)", | ||
| self.message_id, | ||
| self.ack_id, | ||
| self.ordering_key, | ||
| ) | ||
|
|
||
| def ack_with_response(self) -> "futures.Future": | ||
| """Acknowledge the given message. | ||
|
|
@@ -322,6 +332,12 @@ def ack_with_response(self) -> "futures.Future": | |
| pubsub_v1.subscriber.exceptions.AcknowledgeError exception | ||
| will be thrown. | ||
| """ | ||
| _ACK_NACK_LOGGER.debug( | ||
| "Called ack for message (id=%s, ack_id=%s, ordering_key=%s, exactly_once=True)", | ||
|
Contributor
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. Could users still use the ack_with_response interface when EOD is disabled? If so, it would be worth setting |
||
| self.message_id, | ||
| self.ack_id, | ||
| self.ordering_key, | ||
| ) | ||
| if self.opentelemetry_data: | ||
| self.opentelemetry_data.add_process_span_event("ack called") | ||
| self.opentelemetry_data.end_process_span() | ||
|
|
@@ -335,6 +351,7 @@ def ack_with_response(self) -> "futures.Future": | |
| time_to_ack = math.ceil(time.time() - self._received_timestamp) | ||
| self._request_queue.put( | ||
| requests.AckRequest( | ||
| message_id=self.message_id, | ||
| ack_id=self._ack_id, | ||
| byte_size=self.size, | ||
| time_to_ack=time_to_ack, | ||
|
|
@@ -382,6 +399,7 @@ def modify_ack_deadline(self, seconds: int) -> None: | |
| """ | ||
| self._request_queue.put( | ||
| requests.ModAckRequest( | ||
| message_id=self.message_id, | ||
| ack_id=self._ack_id, | ||
| seconds=seconds, | ||
| future=None, | ||
|
|
@@ -445,6 +463,7 @@ def modify_ack_deadline_with_response(self, seconds: int) -> "futures.Future": | |
|
|
||
| self._request_queue.put( | ||
| requests.ModAckRequest( | ||
| message_id=self.message_id, | ||
| ack_id=self._ack_id, | ||
| seconds=seconds, | ||
| future=req_future, | ||
|
|
@@ -461,6 +480,13 @@ def nack(self) -> None: | |
| may take place immediately or after a delay, and may arrive at this subscriber | ||
| or another. | ||
| """ | ||
| _ACK_NACK_LOGGER.debug( | ||
| "Called nack for message (id=%s, ack_id=%s, ordering_key=%s, exactly_once=%s)", | ||
| self.message_id, | ||
| self.ack_id, | ||
| self.ordering_key, | ||
| self._exactly_once_delivery_enabled_func(), | ||
| ) | ||
| if self.opentelemetry_data: | ||
| self.opentelemetry_data.add_process_span_event("nack called") | ||
| self.opentelemetry_data.end_process_span() | ||
|
|
@@ -530,3 +556,7 @@ def nack_with_response(self) -> "futures.Future": | |
| ) | ||
|
|
||
| return future | ||
|
|
||
| @property | ||
| def exactly_once_enabled(self): | ||
| return self._exactly_once_delivery_enabled_func() | ||
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
Oops, something went wrong.
Oops, something went wrong.
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.