Skip to content

Commit

Permalink
Add deprecation warning to old aws lambda threadstats integration (Da…
Browse files Browse the repository at this point in the history
…taDog#417)

* Add deprecation warning to old aws lambda threadstats integration

* Fix lint warnings

* Change aws_lambda deprecation warning to refer to relocation

* Use shortened github link in both deprecation comment
  • Loading branch information
DarcyRaynerDD authored and David Bouchare committed Oct 25, 2019
1 parent 9b2418d commit ba1dd1d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions datadog/threadstats/aws_lambda.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit ba1dd1d

Please sign in to comment.