prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Python agent should show database as a dependency, shows up in span
  **Is your feature request related to a problem? Please describe.**
  I can see Postgres under **Time spent by span type** graph but it is not shown as a dependency. Rails agent is able to show this as Postgresql
  
  <img width="397" alt="Screenshot 2021-04-24 at 12 03 10 PM" src="https://user-images.githubusercontent.com/36618391/115949791-14edbe80-a4f5-11eb-999a-9b2880460abc.png">
  
  I am using asyncpg==0.21.0
  
  **Describe the solution you'd like**
  The database(Postgres) should show up as a dependency just like it shows up for ruby agent. Screenshot attached below.
  
  <img width="979" alt="Screenshot 2021-04-24 at 11 40 09 AM" src="https://user-images.githubusercontent.com/36618391/115949754-d526d700-a4f4-11eb-9d43-bad114aad4eb.png">
  
  
  </issue>
  <code>
  [start of elasticapm/instrumentation/packages/asyncio/asyncpg.py]
  1 #  BSD 3-Clause License
  2 #
  3 #  Copyright (c) 2019, Elasticsearch BV
  4 #  All rights reserved.
  5 #
  6 #  Redistribution and use in source and binary forms, with or without
  7 #  modification, are permitted provided that the following conditions are met:
  8 #
  9 #  * Redistributions of source code must retain the above copyright notice, this
  10 #    list of conditions and the following disclaimer.
  11 #
  12 #  * Redistributions in binary form must reproduce the above copyright notice,
  13 #    this list of conditions and the following disclaimer in the documentation
  14 #    and/or other materials provided with the distribution.
  15 #
  16 #  * Neither the name of the copyright holder nor the names of its
  17 #    contributors may be used to endorse or promote products derived from
  18 #    this software without specific prior written permission.
  19 #
  20 #  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  21 #  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  22 #  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  23 #  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  24 #  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  25 #  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  26 #  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  27 #  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  28 #  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  29 #  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30 
  31 from elasticapm.contrib.asyncio.traces import async_capture_span
  32 from elasticapm.instrumentation.packages.asyncio.base import AsyncAbstractInstrumentedModule
  33 from elasticapm.instrumentation.packages.dbapi2 import extract_signature
  34 
  35 
  36 class AsyncPGInstrumentation(AsyncAbstractInstrumentedModule):
  37     """
  38     Implement asyncpg instrumentation with two methods Connection.execute
  39     and Connection.executemany since Connection._do_execute is not called
  40     given a prepared query is passed to a connection. As in:
  41     https://github.com/MagicStack/asyncpg/blob/master/asyncpg/connection.py#L294-L297
  42     """
  43 
  44     name = "asyncpg"
  45 
  46     instrument_list = [
  47         ("asyncpg.connection", "Connection.execute"),
  48         ("asyncpg.connection", "Connection.executemany"),
  49         ("asyncpg.connection", "Connection.fetch"),
  50         ("asyncpg.connection", "Connection.fetchval"),
  51         ("asyncpg.connection", "Connection.fetchrow"),
  52     ]
  53 
  54     async def call(self, module, method, wrapped, instance, args, kwargs):
  55         query = args[0] if len(args) else kwargs["query"]
  56         name = extract_signature(query)
  57         context = {"db": {"type": "sql", "statement": query}}
  58         action = "query"
  59         async with async_capture_span(
  60             name, leaf=True, span_type="db", span_subtype="postgres", span_action=action, extra=context
  61         ):
  62             return await wrapped(*args, **kwargs)
  63
  [end of elasticapm/instrumentation/packages/asyncio/asyncpg.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/elasticapm/instrumentation/packages/asyncio/asyncpg.py b/elasticapm/instrumentation/packages/asyncio/asyncpg.py
  --- a/elasticapm/instrumentation/packages/asyncio/asyncpg.py
  +++ b/elasticapm/instrumentation/packages/asyncio/asyncpg.py
  @@ -31,6 +31,7 @@
   from elasticapm.contrib.asyncio.traces import async_capture_span
   from elasticapm.instrumentation.packages.asyncio.base import AsyncAbstractInstrumentedModule
   from elasticapm.instrumentation.packages.dbapi2 import extract_signature
  +from elasticapm.utils import default_ports
   
   
   class AsyncPGInstrumentation(AsyncAbstractInstrumentedModule):
  @@ -56,6 +57,12 @@
           name = extract_signature(query)
           context = {"db": {"type": "sql", "statement": query}}
           action = "query"
  +        destination_info = {
  +            "address": kwargs.get("host", "localhost"),
  +            "port": int(kwargs.get("port", default_ports.get("postgresql"))),
  +            "service": {"name": "postgres", "resource": "postgres", "type": "db"},
  +        }
  +        context["destination"] = destination_info
           async with async_capture_span(
               name, leaf=True, span_type="db", span_subtype="postgres", span_action=action, extra=context
           ):
  
verification_info: {"golden_diff": "diff --git a/elasticapm/instrumentation/packages/asyncio/asyncpg.py b/elasticapm/instrumentation/packages/asyncio/asyncpg.py\n--- a/elasticapm/instrumentation/packages/asyncio/asyncpg.py\n+++ b/elasticapm/instrumentation/packages/asyncio/asyncpg.py\n@@ -31,6 +31,7 @@\n from elasticapm.contrib.asyncio.traces import async_capture_span\n from elasticapm.instrumentation.packages.asyncio.base import AsyncAbstractInstrumentedModule\n from elasticapm.instrumentation.packages.dbapi2 import extract_signature\n+from elasticapm.utils import default_ports\n \n \n class AsyncPGInstrumentation(AsyncAbstractInstrumentedModule):\n@@ -56,6 +57,12 @@\n         name = extract_signature(query)\n         context = {\"db\": {\"type\": \"sql\", \"statement\": query}}\n         action = \"query\"\n+        destination_info = {\n+            \"address\": kwargs.get(\"host\", \"localhost\"),\n+            \"port\": int(kwargs.get(\"port\", default_ports.get(\"postgresql\"))),\n+            \"service\": {\"name\": \"postgres\", \"resource\": \"postgres\", \"type\": \"db\"},\n+        }\n+        context[\"destination\"] = destination_info\n         async with async_capture_span(\n             name, leaf=True, span_type=\"db\", span_subtype=\"postgres\", span_action=action, extra=context\n         ):\n", "issue": "Python agent should show database as a dependency, shows up in span\n**Is your feature request related to a problem? Please describe.**\r\nI can see Postgres under **Time spent by span type** graph but it is not shown as a dependency. Rails agent is able to show this as Postgresql\r\n\r\n<img width=\"397\" alt=\"Screenshot 2021-04-24 at 12 03 10 PM\" src=\"https://user-images.githubusercontent.com/36618391/115949791-14edbe80-a4f5-11eb-999a-9b2880460abc.png\">\r\n\r\nI am using asyncpg==0.21.0\r\n\r\n**Describe the solution you'd like**\r\nThe database(Postgres) should show up as a dependency just like it shows up for ruby agent. Screenshot attached below.\r\n\r\n<img width=\"979\" alt=\"Screenshot 2021-04-24 at 11 40 09 AM\" src=\"https://user-images.githubusercontent.com/36618391/115949754-d526d700-a4f4-11eb-9d43-bad114aad4eb.png\">\r\n\n", "before_files": [{"content": "#  BSD 3-Clause License\n#\n#  Copyright (c) 2019, Elasticsearch BV\n#  All rights reserved.\n#\n#  Redistribution and use in source and binary forms, with or without\n#  modification, are permitted provided that the following conditions are met:\n#\n#  * Redistributions of source code must retain the above copyright notice, this\n#    list of conditions and the following disclaimer.\n#\n#  * Redistributions in binary form must reproduce the above copyright notice,\n#    this list of conditions and the following disclaimer in the documentation\n#    and/or other materials provided with the distribution.\n#\n#  * Neither the name of the copyright holder nor the names of its\n#    contributors may be used to endorse or promote products derived from\n#    this software without specific prior written permission.\n#\n#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n#  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\n#  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n#  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n#  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n#  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n#  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n#  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\nfrom elasticapm.contrib.asyncio.traces import async_capture_span\nfrom elasticapm.instrumentation.packages.asyncio.base import AsyncAbstractInstrumentedModule\nfrom elasticapm.instrumentation.packages.dbapi2 import extract_signature\n\n\nclass AsyncPGInstrumentation(AsyncAbstractInstrumentedModule):\n    \"\"\"\n    Implement asyncpg instrumentation with two methods Connection.execute\n    and Connection.executemany since Connection._do_execute is not called\n    given a prepared query is passed to a connection. As in:\n    https://github.com/MagicStack/asyncpg/blob/master/asyncpg/connection.py#L294-L297\n    \"\"\"\n\n    name = \"asyncpg\"\n\n    instrument_list = [\n        (\"asyncpg.connection\", \"Connection.execute\"),\n        (\"asyncpg.connection\", \"Connection.executemany\"),\n        (\"asyncpg.connection\", \"Connection.fetch\"),\n        (\"asyncpg.connection\", \"Connection.fetchval\"),\n        (\"asyncpg.connection\", \"Connection.fetchrow\"),\n    ]\n\n    async def call(self, module, method, wrapped, instance, args, kwargs):\n        query = args[0] if len(args) else kwargs[\"query\"]\n        name = extract_signature(query)\n        context = {\"db\": {\"type\": \"sql\", \"statement\": query}}\n        action = \"query\"\n        async with async_capture_span(\n            name, leaf=True, span_type=\"db\", span_subtype=\"postgres\", span_action=action, extra=context\n        ):\n            return await wrapped(*args, **kwargs)\n", "path": "elasticapm/instrumentation/packages/asyncio/asyncpg.py"}]}