Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions ymir/agents/backport_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
)

logger = logging.getLogger(__name__)
redis_logger = logging.getLogger("agent.redis")


BACKPORT_INSTRUCTIONS = """
Expand Down Expand Up @@ -1413,19 +1414,19 @@ async def main() -> None:
if container_version == "c9s"
else RedisQueues.BACKPORT_QUEUE_C10S.value
)
logger.info(
redis_logger.info(
f"Connected to Redis, max retries set to {max_retries}, listening to queue: {backport_queue}"
)

while True:
logger.info(f"Waiting for tasks from {backport_queue} (timeout: 30s)...")
redis_logger.info(f"Waiting for tasks from {backport_queue} (timeout: 30s)...")
element = await fix_await(redis.brpop([backport_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 +1417 to +1429
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The Connected to Redis... and Received 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 main logger is 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... and No tasks received...) should be ignored.

Suggested change
redis_logger.info(
f"Connected to Redis, max retries set to {max_retries}, listening to queue: {backport_queue}"
)
while True:
logger.info(f"Waiting for tasks from {backport_queue} (timeout: 30s)...")
redis_logger.info(f"Waiting for tasks from {backport_queue} (timeout: 30s)...")
element = await fix_await(redis.brpop([backport_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.")
logger.info(
f"Connected to Redis, max retries set to {max_retries}, listening to queue: {backport_queue}"
)
while True:
redis_logger.info(f"Waiting for tasks from {backport_queue} (timeout: 30s)...")
element = await fix_await(redis.brpop([backport_queue], timeout=30))
if element is None:
redis_logger.info("No tasks received, continuing to wait...")
continue
_, payload = element
logger.info("Received task from queue.")


task = Task.model_validate_json(payload)
triage_state = task.metadata
Expand Down
9 changes: 5 additions & 4 deletions ymir/agents/rebase_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
)

logger = logging.getLogger(__name__)
redis_logger = logging.getLogger("agent.redis")


def get_instructions() -> str:
Expand Down Expand Up @@ -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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The Connected to Redis... and Received 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 main logger is 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... and No tasks received...) should be ignored.

Suggested change
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.")
logger.info(
f"Connected to Redis, max retries set to {max_retries}, listening to queue: {rebase_queue}"
)
while True:
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:
redis_logger.info("No tasks received, continuing to wait...")
continue
_, payload = element
logger.info("Received task from queue.")


task = Task.model_validate_json(payload)
triage_state = task.metadata
Expand Down
9 changes: 5 additions & 4 deletions ymir/agents/rebuild_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
)

logger = logging.getLogger(__name__)
redis_logger = logging.getLogger("agent.redis")


async def main() -> None:
Expand Down Expand Up @@ -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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The Connected to Redis... and Received 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 main logger is 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... and No tasks received...) should be ignored.

Suggested change
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.")
logger.info(
f"Connected to Redis, max retries set to {max_retries}, listening to queue: {rebuild_queue}"
)
while True:
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:
redis_logger.info("No tasks received, continuing to wait...")
continue
_, payload = element
logger.info("Received task from queue.")


try:
task = Task.model_validate_json(payload)
Expand Down
9 changes: 5 additions & 4 deletions ymir/agents/triage_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The Connected to Redis... and Received 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 main logger is 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... and No tasks received...) should be ignored.

Suggested change
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")
logger.info(f"Connected to Redis, max retries set to {max_retries}")
while True:
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:
redis_logger.info("No tasks received, continuing to wait...")
continue
_, payload = element
logger.info("Received task from queue")


task = Task.model_validate_json(payload)
input = InputSchema.model_validate(task.metadata)
Expand Down
2 changes: 2 additions & 0 deletions ymir/agents/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ def init_sentry() -> None:
import sentry_sdk
from sentry_sdk.integrations.asyncio import AsyncioIntegration
from sentry_sdk.integrations.litellm import LiteLLMIntegration
from sentry_sdk.integrations.logging import ignore_logger

sentry_sdk.init(
dsn=dsn,
Expand All @@ -191,3 +192,4 @@ def init_sentry() -> None:
LiteLLMIntegration(),
],
)
ignore_logger("agent.redis")
Loading