cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

"Heartbeat failed because Expecting value" Exception Handling

chris_cho
Contributor

Hello,

I created a custom Dynatrace Extension using APIs ingesting data from one system into Dynatrace BizEvents, based on a custom scheduler. The execution of data ingestion take few minutes exceeding the regular 60 seconds/1 minute, that is set to execute query method. The executions of the process based on the schedule are successful. Checking the logs from python3.log file, I notice sometimes I am getting an exception from executing the _heartbeat method from the SDK module extension.py
/var/lib/dynatrace/remotepluginmodule/agent/runtime/extensions/python_venvs/custom_<custom_extension_name>_0.0.8/lib/python3.10/site-packages/dynatrace_extension/sdk/extension.py

First, it starts with an error
Error HTTP 400 from http://127.0.0.1:14599/alive/-5515299317920783049: b'Bad Request - unable to parse status
and continues with another
Heartbeat failed because Expecting value: line 1 column 1 (char 0), response b'not set'

As it can be seen in the screenshot the exceptions are triggered by different thread executor ThreadPoolExecutor-0_2, than the one executes the process ThreadPoolExecutor-0_0

Below is the code of fastcheck method, nothing particular:
def fastcheck(self) -> Status:
"""
Use to check if the extension can run.
If this Activegate cannot run this extension, you can
raise an Exception or return StatusValue.ERROR.
This does not run for OneAgent extensions.
"""
  return Status(StatusValue.OK, "Fastcheck - TODO:: Check the connections.")

Screenshot of logs
chris_cho_0-1756835550229.png

Screenshot of the extension.py _heartbeat method

chris_cho_1-1756838166926.png

Please let me know if you have any thoughts.

 

0 REPLIES 0

Featured Posts