Skip to content

Commit 2ca873e

Browse files
Check extension exists before calling hello route (#143)
* Check extension exists before calling hello route * Fix formatting
1 parent 888ef6d commit 2ca873e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

datadog_lambda/extension.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
import logging
22
import requests
3+
from os import path
34

45
AGENT_URL = "http://127.0.0.1:8124"
56
HELLO_PATH = "/lambda/hello"
67
FLUSH_PATH = "/lambda/flush"
8+
EXTENSION_PATH = "/opt/extensions/datadog-agent"
79

810
logger = logging.getLogger(__name__)
911

1012

1113
def is_extension_running():
14+
if not path.exists(EXTENSION_PATH):
15+
return False
1216
try:
1317
requests.get(AGENT_URL + HELLO_PATH)
1418
except Exception as e:

0 commit comments

Comments
 (0)