We’re excited to release version 7 of the Datadog Agent. It has all of the same functionality as Agent 6, but it is the first version to ship with only the Python 3 runtime—recent versions of Agent 6 shipped with both Python 2 and 3. With Python 2 reaching its end of life on January 1, 2020, migrating your services to Python 3 will ensure that they continue working as expected. We’ve tested all of our more than 600 integrations to ensure they work with Python 3. If you have any custom Datadog checks you may have written in Python 2, we’ll show how you can start migrating them below.
If you don’t use custom checks, or if they are already Python 3 compatible, you can seamlessly upgrade to Datadog Agent 7 at any time. Note that we will continue to support and update Agent 6.
Datadog’s in-app Custom Check Compatibility tool offers an overview of all of your custom checks, so you can quickly see which ones are compatible with Python 3 and which ones need to be migrated.
You can view your list by either the check name or host. If you sort by check name, you can select an individual check to view all of the hosts where it is deployed.
Or, if you organize by host, you can see all checks available on a single host. Once you have a better idea of which checks are incompatible, you can begin updating them.
Python 3 introduces some library and syntax changes that you should be aware of as you migrate your custom checks. For example, if you used the following import statement in your check:
from datadog_checks.checks import AgentCheck
You will need to update it to the following:
from datadog_checks.base.checks import AgentCheck
Other syntax issues could include differences in how Python 3 handles
You can validate and see more details about what is incompatible in your checks with Python’s
pylint package. Check out our documentation for more information.
To help test your checks before you upgrade to Agent 7, Datadog Agent 6.16 includes the ability to configure whether you want to use the Python 2 or Python 3 runtime for the Agent. Agent 6 uses Python 2 by default, but you can switch to the Python 3 runtime by setting the
python_version option in your Agent configuration file. That way, you can confirm that all of your checks will work properly with Python 3 before upgrading your Agent to version 7.
Check out our documentation to start migrating your custom Python 2 checks. You’ll find more information about the migration process, including using Containerized Agent images and helpful libraries for converting your Python 2 code to Python 3. Or you can get started with Agent 7 by checking out our upgrade docs. If you don’t already have a Datadog account, you can sign up for a free 14 day trial.