mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-04 21:00:40 +08:00
get_log_context
This commit is contained in:
@ -218,6 +218,18 @@ def handle_closed_pr(body, event, action, log_context):
|
|||||||
get_logger().info("PR-Agent statistics for closed PR", analytics=True)
|
get_logger().info("PR-Agent statistics for closed PR", analytics=True)
|
||||||
|
|
||||||
|
|
||||||
|
def get_log_context(body, event, action, build_number):
|
||||||
|
sender = body.get("sender", {}).get("login")
|
||||||
|
sender_id = body.get("sender", {}).get("id")
|
||||||
|
repo = body.get("repository", {}).get("full_name", "")
|
||||||
|
org = body.get("organization", {}).get("login", "")
|
||||||
|
app_name = get_settings().get("CONFIG.APP_NAME", "Unknown")
|
||||||
|
log_context = {"action": action, "event": event, "sender": sender, "server_type": "github_app",
|
||||||
|
"request_id": uuid.uuid4().hex, "build_number": build_number, "app_name": app_name,
|
||||||
|
"repo": repo, "org": org}
|
||||||
|
return log_context, sender, sender_id
|
||||||
|
|
||||||
|
|
||||||
async def handle_request(body: Dict[str, Any], event: str):
|
async def handle_request(body: Dict[str, Any], event: str):
|
||||||
"""
|
"""
|
||||||
Handle incoming GitHub webhook requests.
|
Handle incoming GitHub webhook requests.
|
||||||
@ -230,11 +242,7 @@ async def handle_request(body: Dict[str, Any], event: str):
|
|||||||
if not action:
|
if not action:
|
||||||
return {}
|
return {}
|
||||||
agent = PRAgent()
|
agent = PRAgent()
|
||||||
sender = body.get("sender", {}).get("login")
|
log_context, sender, sender_id = get_log_context(body, event, action, build_number)
|
||||||
sender_id = body.get("sender", {}).get("id")
|
|
||||||
app_name = get_settings().get("CONFIG.APP_NAME", "Unknown")
|
|
||||||
log_context = {"action": action, "event": event, "sender": sender, "server_type": "github_app",
|
|
||||||
"request_id": uuid.uuid4().hex, "build_number": build_number, "app_name": app_name}
|
|
||||||
|
|
||||||
# handle comments on PRs
|
# handle comments on PRs
|
||||||
if action == 'created':
|
if action == 'created':
|
||||||
|
Reference in New Issue
Block a user