prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  [META 555] Add automated span type/subtype checking against shared spec
  Spec PR: https://github.com/elastic/apm/pull/443
  
  To start, we would just ensure that all span types/subtypes appear in the spec. In the future we will work on cross-agent alignment.
  
  
  </issue>
  <code>
  [start of elasticapm/instrumentation/packages/asyncio/aiopg.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 AioPGInstrumentation(AsyncAbstractInstrumentedModule):
  37     name = "aiopg"
  38 
  39     instrument_list = [
  40         ("aiopg.cursor", "Cursor.execute"),
  41         ("aiopg.cursor", "Cursor.callproc"),
  42         ("aiopg.connection", "Cursor.execute"),
  43         ("aiopg.connection", "Cursor.callproc"),
  44     ]
  45 
  46     async def call(self, module, method, wrapped, instance, args, kwargs):
  47         if method == "Cursor.execute":
  48             query = args[0] if len(args) else kwargs["operation"]
  49             query = _bake_sql(instance.raw, query)
  50             name = extract_signature(query)
  51             context = {"db": {"type": "sql", "statement": query}}
  52             action = "query"
  53         elif method == "Cursor.callproc":
  54             func = args[0] if len(args) else kwargs["procname"]
  55             name = func + "()"
  56             context = None
  57             action = "exec"
  58         else:
  59             raise AssertionError("call from uninstrumented method")
  60         async with async_capture_span(
  61             name, leaf=True, span_type="db", span_subtype="postgres", span_action=action, extra=context
  62         ):
  63             return await wrapped(*args, **kwargs)
  64 
  65 
  66 def _bake_sql(cursor, sql):
  67     # if this is a Composable object, use its `as_string` method
  68     # see http://initd.org/psycopg/docs/sql.html
  69     if hasattr(sql, "as_string"):
  70         return sql.as_string(cursor)
  71     return sql
  72
  [end of elasticapm/instrumentation/packages/asyncio/aiopg.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/aiopg.py b/elasticapm/instrumentation/packages/asyncio/aiopg.py
  --- a/elasticapm/instrumentation/packages/asyncio/aiopg.py
  +++ b/elasticapm/instrumentation/packages/asyncio/aiopg.py
  @@ -58,7 +58,7 @@
           else:
               raise AssertionError("call from uninstrumented method")
           async with async_capture_span(
  -            name, leaf=True, span_type="db", span_subtype="postgres", span_action=action, extra=context
  +            name, leaf=True, span_type="db", span_subtype="postgresql", span_action=action, extra=context
           ):
               return await wrapped(*args, **kwargs)
  
verification_info: {"golden_diff": "diff --git a/elasticapm/instrumentation/packages/asyncio/aiopg.py b/elasticapm/instrumentation/packages/asyncio/aiopg.py\n--- a/elasticapm/instrumentation/packages/asyncio/aiopg.py\n+++ b/elasticapm/instrumentation/packages/asyncio/aiopg.py\n@@ -58,7 +58,7 @@\n         else:\n             raise AssertionError(\"call from uninstrumented method\")\n         async with async_capture_span(\n-            name, leaf=True, span_type=\"db\", span_subtype=\"postgres\", span_action=action, extra=context\n+            name, leaf=True, span_type=\"db\", span_subtype=\"postgresql\", span_action=action, extra=context\n         ):\n             return await wrapped(*args, **kwargs)\n", "issue": "[META 555] Add automated span type/subtype checking against shared spec\nSpec PR: https://github.com/elastic/apm/pull/443\r\n\r\nTo start, we would just ensure that all span types/subtypes appear in the spec. In the future we will work on cross-agent alignment.\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 AioPGInstrumentation(AsyncAbstractInstrumentedModule):\n    name = \"aiopg\"\n\n    instrument_list = [\n        (\"aiopg.cursor\", \"Cursor.execute\"),\n        (\"aiopg.cursor\", \"Cursor.callproc\"),\n        (\"aiopg.connection\", \"Cursor.execute\"),\n        (\"aiopg.connection\", \"Cursor.callproc\"),\n    ]\n\n    async def call(self, module, method, wrapped, instance, args, kwargs):\n        if method == \"Cursor.execute\":\n            query = args[0] if len(args) else kwargs[\"operation\"]\n            query = _bake_sql(instance.raw, query)\n            name = extract_signature(query)\n            context = {\"db\": {\"type\": \"sql\", \"statement\": query}}\n            action = \"query\"\n        elif method == \"Cursor.callproc\":\n            func = args[0] if len(args) else kwargs[\"procname\"]\n            name = func + \"()\"\n            context = None\n            action = \"exec\"\n        else:\n            raise AssertionError(\"call from uninstrumented method\")\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\n\ndef _bake_sql(cursor, sql):\n    # if this is a Composable object, use its `as_string` method\n    # see http://initd.org/psycopg/docs/sql.html\n    if hasattr(sql, \"as_string\"):\n        return sql.as_string(cursor)\n    return sql\n", "path": "elasticapm/instrumentation/packages/asyncio/aiopg.py"}]}