Skip to content

Commit 21b61b8

Browse files
committed
set env in config instead of using os to do it
1 parent c833e33 commit 21b61b8

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

datadog_lambda/cold_start.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import os
21
import time
32
from typing import List, Hashable
43
import logging
@@ -74,9 +73,7 @@ def is_managed_instances_mode():
7473
Returns:
7574
bool: True if running in managed instances mode, False otherwise
7675
"""
77-
return (
78-
os.environ.get("AWS_LAMBDA_INITIALIZATION_TYPE") == "lambda-managed-instances"
79-
)
76+
return config.aws_lambda_initialization_type == "lambda-managed-instances"
8077

8178

8279
class ImportNode(object):

datadog_lambda/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ def _resolve_env(self, key, default=None, cast=None, depends_on_tracing=False):
9898
integration_test = _get_env("DD_INTEGRATION_TEST", "false", as_bool)
9999

100100
aws_lambda_function_name = _get_env("AWS_LAMBDA_FUNCTION_NAME")
101+
aws_lambda_initialization_type = _get_env("AWS_LAMBDA_INITIALIZATION_TYPE")
101102

102103
@property
103104
def function_name(self):

0 commit comments

Comments
 (0)