Skip to content

πŸ™Œ OpenHands: AI-Driven Development

fix: use appropriate log level for webhook installation results (#12493)

Graham Neubig4c3542a91c3b
diff --git a/enterprise/integrations/gitlab/webhook_installation.py b/enterprise/integrations/gitlab/webhook_installation.py
index c3ab74b205..123ec21079 100644
--- a/enterprise/integrations/gitlab/webhook_installation.py
+++ b/enterprise/integrations/gitlab/webhook_installation.py
@@ -167,17 +167,15 @@ async def install_webhook_on_resource(
scopes=SCOPES,
)
- logger.info(
- 'Creating new webhook',
- extra={
- 'webhook_id': webhook_id,
- 'status': status,
- 'resource_id': resource_id,
- 'resource_type': resource_type,
- },
- )
+ log_extra = {
+ 'webhook_id': webhook_id,
+ 'status': status,
+ 'resource_id': resource_id,
+ 'resource_type': resource_type,
+ }
if status == WebhookStatus.RATE_LIMITED:
+ logger.warning('Rate limited while creating webhook', extra=log_extra)
raise BreakLoopException()
if webhook_id:
@@ -191,9 +189,8 @@ async def install_webhook_on_resource(
'webhook_uuid': webhook_uuid, # required to identify which webhook installation is sending payload
},
)
-
- logger.info(
- f'Installed webhook for {webhook.user_id} on {resource_type}:{resource_id}'
- )
+ logger.info('Created new webhook', extra=log_extra)
+ else:
+ logger.error('Failed to create webhook', extra=log_extra)
return webhook_id, status