Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add deprecation warning to old aws lambda threadstats integration #417

Merged
merged 4 commits into from
Jul 30, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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