diff --git a/newrelic/config.py b/newrelic/config.py index cdd69671f..82d95ce8e 100644 --- a/newrelic/config.py +++ b/newrelic/config.py @@ -20,6 +20,7 @@ import threading import time import traceback +from datetime import datetime, timezone from pathlib import Path import newrelic.api.application @@ -54,6 +55,8 @@ _logger = logging.getLogger(__name__) +DEPRECATED_MODULES = {"aioredis": datetime(2022, 2, 22, 0, 0, tzinfo=timezone.utc)} + def _map_aws_account_id(s): return newrelic.core.config._map_aws_account_id(s, _logger) @@ -1105,6 +1108,18 @@ def _module_import_hook(target, module, function): def _instrument(target): _logger.debug("instrument module %s", ((target, module, function),)) + # Deprecation warning for archived/unsupported modules + library_name = target.__package__.split(".")[0] + + if library_name in DEPRECATED_MODULES: + _logger.warning( + "%(module)s has been archived by the developers " + "and has not been supported since %(date)s. %(module)s " + "support will be removed from New Relic in a future " + "release.", + {"module": library_name, "date": DEPRECATED_MODULES[library_name].strftime("%B %d, %Y")}, + ) + try: instrumented = target._nr_instrumented except AttributeError: