-
Notifications
You must be signed in to change notification settings - Fork 29
fix(sentry): factor out redis-related logging #563
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -65,6 +65,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| logger = logging.getLogger(__name__) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| redis_logger = logging.getLogger("agent.redis") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def get_instructions() -> str: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -526,19 +527,19 @@ async def comment_in_jira(state): | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if container_version == "c9s" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else RedisQueues.REBASE_QUEUE_C10S.value | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| logger.info( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| redis_logger.info( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| f"Connected to Redis, max retries set to {max_retries}, listening to queue: {rebase_queue}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| while True: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| logger.info(f"Waiting for tasks from {rebase_queue} (timeout: 30s)...") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| redis_logger.info(f"Waiting for tasks from {rebase_queue} (timeout: 30s)...") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| element = await fix_await(redis.brpop([rebase_queue], timeout=30)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if element is None: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| logger.info("No tasks received, continuing to wait...") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| redis_logger.info("No tasks received, continuing to wait...") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| continue | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _, payload = element | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| logger.info("Received task from queue.") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| redis_logger.info("Received task from queue.") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+530
to
+542
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. The
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| task = Task.model_validate_json(payload) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| triage_state = task.metadata | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -39,6 +39,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| logger = logging.getLogger(__name__) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| redis_logger = logging.getLogger("agent.redis") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| async def main() -> None: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -333,19 +334,19 @@ async def comment_in_jira(state): | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if container_version == "c9s" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else RedisQueues.REBUILD_QUEUE_C10S.value | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| logger.info( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| redis_logger.info( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| f"Connected to Redis, max retries set to {max_retries}, listening to queue: {rebuild_queue}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| while True: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| logger.info(f"Waiting for tasks from {rebuild_queue} (timeout: 30s)...") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| redis_logger.info(f"Waiting for tasks from {rebuild_queue} (timeout: 30s)...") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| element = await fix_await(redis.brpop([rebuild_queue], timeout=30)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if element is None: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| logger.info("No tasks received, continuing to wait...") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| redis_logger.info("No tasks received, continuing to wait...") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| continue | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _, payload = element | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| logger.info("Received task from queue.") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| redis_logger.info("Received task from queue.") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+337
to
+349
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. The
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| task = Task.model_validate_json(payload) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -67,6 +67,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||
| from ymir.tools.unprivileged.version_mapper import VersionMapperTool | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| logger = logging.getLogger(__name__) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| redis_logger = logging.getLogger("agent.redis") | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| def _should_update_jira(silent_run: bool, resolution: Resolution = None) -> bool: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -1191,17 +1192,17 @@ async def main() -> None: | |||||||||||||||||||||||||||||||||||||||||||||||||||
| logger.info(f"Starting triage agent in queue mode (AUTO_CHAIN={'enabled' if auto_chain else 'disabled'})") | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| async with redis_client(os.environ["REDIS_URL"]) as redis: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| max_retries = int(os.getenv("MAX_RETRIES", 3)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| logger.info(f"Connected to Redis, max retries set to {max_retries}") | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| redis_logger.info(f"Connected to Redis, max retries set to {max_retries}") | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| while True: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| logger.info("Waiting for tasks from triage_queue (timeout: 30s)...") | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| redis_logger.info("Waiting for tasks from triage_queue (timeout: 30s)...") | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| element = await fix_await(redis.brpop([RedisQueues.TRIAGE_QUEUE.value], timeout=30)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| if element is None: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| logger.info("No tasks received, continuing to wait...") | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| redis_logger.info("No tasks received, continuing to wait...") | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| continue | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| _, payload = element | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| logger.info("Received task from queue") | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| redis_logger.info("Received task from queue") | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1195
to
+1205
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. The
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| task = Task.model_validate_json(payload) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| input = InputSchema.model_validate(task.metadata) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
The
Connected to Redis...andReceived task from queue.log messages are not highly recurrent or spammy. The connection log occurs only once at startup, and the task receipt log occurs only when a task is actually dispatched. Keeping these on the mainloggeris highly beneficial for observability and debugging in Sentry (e.g., as breadcrumbs leading up to an error), whereas only the idle polling logs (Waiting for tasks...andNo tasks received...) should be ignored.