Skip to content

Commit

Permalink
Merge pull request #1123 from Codium-ai/ok/app_name
Browse files Browse the repository at this point in the history
Add app_name to log_context in Bitbucket and GitLab webhook handlers
  • Loading branch information
mrT23 authored Aug 12, 2024
2 parents 4228f92 + b59111e commit cc73d45
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pr_agent/servers/bitbucket_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ async def _perform_commands_bitbucket(commands_conf: str, agent: PRAgent, api_ur

@router.post("/webhook")
async def handle_github_webhooks(background_tasks: BackgroundTasks, request: Request):
log_context = {"server_type": "bitbucket_app"}
app_name = get_settings().get("CONFIG.APP_NAME", "Unknown")
log_context = {"server_type": "bitbucket_app", "app_name": app_name}
get_logger().debug(request.headers)
jwt_header = request.headers.get("authorization", None)
if jwt_header:
Expand Down
1 change: 1 addition & 0 deletions pr_agent/servers/gitlab_webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ async def handle_request(api_url: str, body: str, log_context: dict, sender_id:
log_context["action"] = body
log_context["event"] = "pull_request" if body == "/review" else "comment"
log_context["api_url"] = api_url
log_context["app_name"] = get_settings().get("CONFIG.APP_NAME", "Unknown")

with get_logger().contextualize(**log_context):
await PRAgent().handle_request(api_url, body)
Expand Down

0 comments on commit cc73d45

Please sign in to comment.