prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Submit logged warnings to Sentry
  Currently, we only report exceptions to Sentry.
  It'd be nice to report warnings too, so we can get a sense of how often they happen.
  IIRC in the code-review bot (https://github.com/mozilla/code-review), we are doing that kind of automatically.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `http_service/bugbug_http/worker.py`
  Content:
  ```
  1 #!/usr/bin/env python
  2 # -*- coding: utf-8 -*-
  3 # This Source Code Form is subject to the terms of the Mozilla Public
  4 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
  5 # You can obtain one at http://mozilla.org/MPL/2.0/.
  6 
  7 import os
  8 import sys
  9 
  10 import sentry_sdk
  11 from redis import Redis
  12 from rq import Connection, Worker
  13 from sentry_sdk.integrations.rq import RqIntegration
  14 
  15 import bugbug_http.boot
  16 from bugbug import get_bugbug_version
  17 
  18 if os.environ.get("SENTRY_DSN"):
  19     sentry_sdk.init(
  20         os.environ.get("SENTRY_DSN"),
  21         integrations=[RqIntegration()],
  22         release=get_bugbug_version(),
  23     )
  24 
  25 
  26 def main():
  27     # Bootstrap the worker assets
  28     bugbug_http.boot.boot_worker()
  29 
  30     # Provide queue names to listen to as arguments to this script,
  31     # similar to rq worker
  32     redis_url = os.environ.get("REDIS_URL", "redis://localhost/0")
  33     redis_conn = Redis.from_url(redis_url)
  34     with Connection(connection=redis_conn):
  35         qs = sys.argv[1:] or ["default"]
  36 
  37         w = Worker(qs)
  38         w.work()
  39 
  40 
  41 if __name__ == "__main__":
  42     main()
  43
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/http_service/bugbug_http/worker.py b/http_service/bugbug_http/worker.py
  --- a/http_service/bugbug_http/worker.py
  +++ b/http_service/bugbug_http/worker.py
  @@ -4,21 +4,29 @@
   # License, v. 2.0. If a copy of the MPL was not distributed with this file,
   # You can obtain one at http://mozilla.org/MPL/2.0/.
   
  +import logging
   import os
   import sys
   
   import sentry_sdk
   from redis import Redis
   from rq import Connection, Worker
  +from sentry_sdk.integrations.logging import LoggingIntegration
   from sentry_sdk.integrations.rq import RqIntegration
   
   import bugbug_http.boot
   from bugbug import get_bugbug_version
   
   if os.environ.get("SENTRY_DSN"):
  +    logging_integration = LoggingIntegration(
  +        # Default behaviour: INFO messages will be included as breadcrumbs
  +        level=logging.INFO,
  +        # Change default behaviour (ERROR messages events)
  +        event_level=logging.WARNING,
  +    )
       sentry_sdk.init(
  -        os.environ.get("SENTRY_DSN"),
  -        integrations=[RqIntegration()],
  +        dsn=os.environ.get("SENTRY_DSN"),
  +        integrations=[RqIntegration(), logging_integration],
           release=get_bugbug_version(),
       )
  
verification_info: {"golden_diff": "diff --git a/http_service/bugbug_http/worker.py b/http_service/bugbug_http/worker.py\n--- a/http_service/bugbug_http/worker.py\n+++ b/http_service/bugbug_http/worker.py\n@@ -4,21 +4,29 @@\n # License, v. 2.0. If a copy of the MPL was not distributed with this file,\n # You can obtain one at http://mozilla.org/MPL/2.0/.\n \n+import logging\n import os\n import sys\n \n import sentry_sdk\n from redis import Redis\n from rq import Connection, Worker\n+from sentry_sdk.integrations.logging import LoggingIntegration\n from sentry_sdk.integrations.rq import RqIntegration\n \n import bugbug_http.boot\n from bugbug import get_bugbug_version\n \n if os.environ.get(\"SENTRY_DSN\"):\n+    logging_integration = LoggingIntegration(\n+        # Default behaviour: INFO messages will be included as breadcrumbs\n+        level=logging.INFO,\n+        # Change default behaviour (ERROR messages events)\n+        event_level=logging.WARNING,\n+    )\n     sentry_sdk.init(\n-        os.environ.get(\"SENTRY_DSN\"),\n-        integrations=[RqIntegration()],\n+        dsn=os.environ.get(\"SENTRY_DSN\"),\n+        integrations=[RqIntegration(), logging_integration],\n         release=get_bugbug_version(),\n     )\n", "issue": "Submit logged warnings to Sentry\nCurrently, we only report exceptions to Sentry.\r\nIt'd be nice to report warnings too, so we can get a sense of how often they happen.\r\nIIRC in the code-review bot (https://github.com/mozilla/code-review), we are doing that kind of automatically.\n", "before_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n# This Source Code Form is subject to the terms of the Mozilla Public\n# License, v. 2.0. If a copy of the MPL was not distributed with this file,\n# You can obtain one at http://mozilla.org/MPL/2.0/.\n\nimport os\nimport sys\n\nimport sentry_sdk\nfrom redis import Redis\nfrom rq import Connection, Worker\nfrom sentry_sdk.integrations.rq import RqIntegration\n\nimport bugbug_http.boot\nfrom bugbug import get_bugbug_version\n\nif os.environ.get(\"SENTRY_DSN\"):\n    sentry_sdk.init(\n        os.environ.get(\"SENTRY_DSN\"),\n        integrations=[RqIntegration()],\n        release=get_bugbug_version(),\n    )\n\n\ndef main():\n    # Bootstrap the worker assets\n    bugbug_http.boot.boot_worker()\n\n    # Provide queue names to listen to as arguments to this script,\n    # similar to rq worker\n    redis_url = os.environ.get(\"REDIS_URL\", \"redis://localhost/0\")\n    redis_conn = Redis.from_url(redis_url)\n    with Connection(connection=redis_conn):\n        qs = sys.argv[1:] or [\"default\"]\n\n        w = Worker(qs)\n        w.work()\n\n\nif __name__ == \"__main__\":\n    main()\n", "path": "http_service/bugbug_http/worker.py"}], "after_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n# This Source Code Form is subject to the terms of the Mozilla Public\n# License, v. 2.0. If a copy of the MPL was not distributed with this file,\n# You can obtain one at http://mozilla.org/MPL/2.0/.\n\nimport logging\nimport os\nimport sys\n\nimport sentry_sdk\nfrom redis import Redis\nfrom rq import Connection, Worker\nfrom sentry_sdk.integrations.logging import LoggingIntegration\nfrom sentry_sdk.integrations.rq import RqIntegration\n\nimport bugbug_http.boot\nfrom bugbug import get_bugbug_version\n\nif os.environ.get(\"SENTRY_DSN\"):\n    logging_integration = LoggingIntegration(\n        # Default behaviour: INFO messages will be included as breadcrumbs\n        level=logging.INFO,\n        # Change default behaviour (ERROR messages events)\n        event_level=logging.WARNING,\n    )\n    sentry_sdk.init(\n        dsn=os.environ.get(\"SENTRY_DSN\"),\n        integrations=[RqIntegration(), logging_integration],\n        release=get_bugbug_version(),\n    )\n\n\ndef main():\n    # Bootstrap the worker assets\n    bugbug_http.boot.boot_worker()\n\n    # Provide queue names to listen to as arguments to this script,\n    # similar to rq worker\n    redis_url = os.environ.get(\"REDIS_URL\", \"redis://localhost/0\")\n    redis_conn = Redis.from_url(redis_url)\n    with Connection(connection=redis_conn):\n        qs = sys.argv[1:] or [\"default\"]\n\n        w = Worker(qs)\n        w.work()\n\n\nif __name__ == \"__main__\":\n    main()\n", "path": "http_service/bugbug_http/worker.py"}]}