diff --git a/datadog/threadstats/aws_lambda.py b/datadog/threadstats/aws_lambda.py index 478bf6c8e..d62298890 100644 --- a/datadog/threadstats/aws_lambda.py +++ b/datadog/threadstats/aws_lambda.py @@ -2,9 +2,10 @@ from threading import Lock, Thread from datadog import api import os - +import warnings """ +DEPRECATED use datadog-lambda package instead https://git.io/fjy8o Usage: from datadog import datadog_lambda_wrapper, lambda_metric @@ -16,7 +17,7 @@ def my_lambda_handle(event, context): class _LambdaDecorator(object): - """ Decorator to automatically init & flush metrics, created for Lambda functions""" + """ DEPRECATED Decorator to automatically init & flush metrics, created for Lambda functions""" # Number of opened wrappers, flush when 0 _counter = 0 @@ -29,6 +30,7 @@ def __init__(self, func): @classmethod def _enter(cls): + with cls._counter_lock: if not cls._was_initialized: cls._was_initialized = True @@ -61,6 +63,7 @@ def _close(cls): _lambda_stats.flush(float("inf")) def __call__(self, *args, **kw): + warnings.warn("datadog_lambda_wrapper() is relocated to https://git.io/fjy8o", DeprecationWarning) _LambdaDecorator._enter() try: return self.func(*args, **kw)