SIENTIAPDE-1478
Refactor timestamp normalization in API class to handle NaN values correctly by dropping them before calculating the maximum timestamp.
This commit is contained in:
@@ -136,13 +136,14 @@ class API(SientiaMonitoring):
|
||||
)
|
||||
raise e
|
||||
|
||||
|
||||
latest_values['timestamp'] = latest_values['timestamp'].dt.strftime(DATETIME_FORMAT_WITH_TZ)
|
||||
|
||||
self.debug(f'Latest values: {latest_values.to_string()}', metadata=metadata)
|
||||
|
||||
# Normalize the package timestamp
|
||||
latest_values['timestamp'] = latest_values['timestamp'].max()
|
||||
|
||||
valid_timestamp_values = latest_values['timestamp'].dropna()
|
||||
latest_values['timestamp'] = valid_timestamp_values.max()
|
||||
|
||||
self.info(f'Gathered {len(latest_values)} tag values', metadata=metadata)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user