prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Metadata should have language / language_version fields
  Standardizing metadata between the various agents - put a fixed `python` string in `language`, and  the version (`3.4.1` or whatever) in `language_version`
  
  Keep the existing fields for now. Need to ensure that the CoreAgent handles them nicely when missing.
  
  </issue>
  <code>
  [start of src/scout_apm/core/metadata.py]
  1 # coding=utf-8
  2 from __future__ import absolute_import, division, print_function, unicode_literals
  3 
  4 import datetime as dt
  5 import logging
  6 import sys
  7 from os import getpid
  8 
  9 from scout_apm.core.commands import ApplicationEvent
  10 from scout_apm.core.config import scout_config
  11 from scout_apm.core.socket import CoreAgentSocket
  12 
  13 logger = logging.getLogger(__name__)
  14 
  15 
  16 class AppMetadata(object):
  17     @classmethod
  18     def report(cls):
  19         event = ApplicationEvent(
  20             event_type="scout.metadata",
  21             event_value=cls.data(),
  22             source="Pid: " + str(getpid()),
  23             timestamp=dt.datetime.utcnow(),
  24         )
  25         CoreAgentSocket.instance().send(event)
  26 
  27     @classmethod
  28     def data(cls):
  29         try:
  30             data = {
  31                 "language": "python",
  32                 "version": "{}.{}.{}".format(*sys.version_info[:3]),
  33                 "server_time": dt.datetime.utcnow().isoformat() + "Z",
  34                 "framework": scout_config.value("framework"),
  35                 "framework_version": scout_config.value("framework_version"),
  36                 "environment": "",
  37                 "app_server": scout_config.value("app_server"),
  38                 "hostname": scout_config.value("hostname"),
  39                 "database_engine": "",  # Detected
  40                 "database_adapter": "",  # Raw
  41                 "application_name": "",  # Environment.application_name,
  42                 "libraries": cls.get_python_packages_versions(),
  43                 "paas": "",
  44                 "application_root": scout_config.value("application_root"),
  45                 "scm_subdirectory": scout_config.value("scm_subdirectory"),
  46                 "git_sha": scout_config.value("revision_sha"),
  47             }
  48         except Exception as e:
  49             logger.debug("Exception in AppMetadata: %r", e)
  50             data = {}
  51 
  52         return data
  53 
  54     @classmethod
  55     def get_python_packages_versions(cls):
  56         try:
  57             import pkg_resources
  58         except ImportError:
  59             return []
  60 
  61         return list(
  62             sorted(
  63                 (distribution.project_name, distribution.version)
  64                 for distribution in pkg_resources.working_set
  65             )
  66         )
  67
  [end of src/scout_apm/core/metadata.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/src/scout_apm/core/metadata.py b/src/scout_apm/core/metadata.py
  --- a/src/scout_apm/core/metadata.py
  +++ b/src/scout_apm/core/metadata.py
  @@ -29,6 +29,8 @@
           try:
               data = {
                   "language": "python",
  +                "language_version": "{}.{}.{}".format(*sys.version_info[:3]),
  +                # Deprecated: (see #327)
                   "version": "{}.{}.{}".format(*sys.version_info[:3]),
                   "server_time": dt.datetime.utcnow().isoformat() + "Z",
                   "framework": scout_config.value("framework"),
  
verification_info: {"golden_diff": "diff --git a/src/scout_apm/core/metadata.py b/src/scout_apm/core/metadata.py\n--- a/src/scout_apm/core/metadata.py\n+++ b/src/scout_apm/core/metadata.py\n@@ -29,6 +29,8 @@\n         try:\n             data = {\n                 \"language\": \"python\",\n+                \"language_version\": \"{}.{}.{}\".format(*sys.version_info[:3]),\n+                # Deprecated: (see #327)\n                 \"version\": \"{}.{}.{}\".format(*sys.version_info[:3]),\n                 \"server_time\": dt.datetime.utcnow().isoformat() + \"Z\",\n                 \"framework\": scout_config.value(\"framework\"),\n", "issue": "Metadata should have language / language_version fields\nStandardizing metadata between the various agents - put a fixed `python` string in `language`, and  the version (`3.4.1` or whatever) in `language_version`\r\n\r\nKeep the existing fields for now. Need to ensure that the CoreAgent handles them nicely when missing.\n", "before_files": [{"content": "# coding=utf-8\nfrom __future__ import absolute_import, division, print_function, unicode_literals\n\nimport datetime as dt\nimport logging\nimport sys\nfrom os import getpid\n\nfrom scout_apm.core.commands import ApplicationEvent\nfrom scout_apm.core.config import scout_config\nfrom scout_apm.core.socket import CoreAgentSocket\n\nlogger = logging.getLogger(__name__)\n\n\nclass AppMetadata(object):\n    @classmethod\n    def report(cls):\n        event = ApplicationEvent(\n            event_type=\"scout.metadata\",\n            event_value=cls.data(),\n            source=\"Pid: \" + str(getpid()),\n            timestamp=dt.datetime.utcnow(),\n        )\n        CoreAgentSocket.instance().send(event)\n\n    @classmethod\n    def data(cls):\n        try:\n            data = {\n                \"language\": \"python\",\n                \"version\": \"{}.{}.{}\".format(*sys.version_info[:3]),\n                \"server_time\": dt.datetime.utcnow().isoformat() + \"Z\",\n                \"framework\": scout_config.value(\"framework\"),\n                \"framework_version\": scout_config.value(\"framework_version\"),\n                \"environment\": \"\",\n                \"app_server\": scout_config.value(\"app_server\"),\n                \"hostname\": scout_config.value(\"hostname\"),\n                \"database_engine\": \"\",  # Detected\n                \"database_adapter\": \"\",  # Raw\n                \"application_name\": \"\",  # Environment.application_name,\n                \"libraries\": cls.get_python_packages_versions(),\n                \"paas\": \"\",\n                \"application_root\": scout_config.value(\"application_root\"),\n                \"scm_subdirectory\": scout_config.value(\"scm_subdirectory\"),\n                \"git_sha\": scout_config.value(\"revision_sha\"),\n            }\n        except Exception as e:\n            logger.debug(\"Exception in AppMetadata: %r\", e)\n            data = {}\n\n        return data\n\n    @classmethod\n    def get_python_packages_versions(cls):\n        try:\n            import pkg_resources\n        except ImportError:\n            return []\n\n        return list(\n            sorted(\n                (distribution.project_name, distribution.version)\n                for distribution in pkg_resources.working_set\n            )\n        )\n", "path": "src/scout_apm/core/metadata.py"}]}