kubelet check failing to initialize - NameError: name 'log' is not defined #16179
Open
Description
Output of the info page
Check Initialization Errors
===========================
kubelet (7.9.2)
---------------
instance 0:
could not invoke 'kubelet' python check constructor. New constructor API returned:
Traceback (most recent call last):
File "/opt/datadog-agent/embedded/lib/python3.9/site-packages/datadog_checks/kubelet/kubelet.py", line 179, in __init__
cadvisor_instance = self._create_cadvisor_prometheus_instance(inst)
File "/opt/datadog-agent/embedded/lib/python3.9/site-packages/datadog_checks/kubelet/prometheus.py", line 81, in _create_cadvisor_prometheus_instance
endpoint = get_prometheus_url("dummy_url/cadvisor")
File "/opt/datadog-agent/embedded/lib/python3.9/site-packages/datadog_checks/kubelet/common.py", line 114, in get_prometheus_url
log.warning(error)
NameError: name 'log' is not defined
Deprecated constructor API returned:
__init__() got an unexpected keyword argument 'agentConfig'
Loading Errors
==============
kubelet
-------
Core Check Loader:
Check kubelet not found in Catalog
JMX Check Loader:
check is not a jmx check, or unable to determine if it's so
Python Check Loader:
could not configure check instance for python check kubelet: could not invoke 'kubelet' python check constructor. New constructor API returned:
Traceback (most recent call last):
File "/opt/datadog-agent/embedded/lib/python3.9/site-packages/datadog_checks/kubelet/kubelet.py", line 179, in __init__
cadvisor_instance = self._create_cadvisor_prometheus_instance(inst)
File "/opt/datadog-agent/embedded/lib/python3.9/site-packages/datadog_checks/kubelet/prometheus.py", line 81, in _create_cadvisor_prometheus_instance
endpoint = get_prometheus_url("dummy_url/cadvisor")
File "/opt/datadog-agent/embedded/lib/python3.9/site-packages/datadog_checks/kubelet/common.py", line 114, in get_prometheus_url
log.warning(error)
NameError: name 'log' is not defined
Deprecated constructor API returned:
__init__() got an unexpected keyword argument 'agentConfig'
Additional environment details (Operating System, Cloud provider, etc):
AWS EKS v1.24.17
Steps to reproduce the issue:
- Run an instance refresh on a very large cluster which results in new nodes being
- Do an
agent status
on the new datadog-agent on the new nodes - Some of the agents will show the error above if you are "lucky" enough
Describe the results you received:
The Agent does not retry the kubelet integration causing metrics loss.
Describe the results you expected:
The Agent should retry
Additional information you deem important (e.g. issue happens only occasionally):
It appears to be caused by the log
variable not being defined here:
integrations-core/kubelet/datadog_checks/kubelet/common.py
Lines 113 to 114 in ecf3c3c
This was introduced in #15706 which was the second attempt (#14546) to fix #14791
Activity