SIENTIAPDE-1445
Enhance PI Web API integration and update test configurations - Adjusted execution counts in tests.ipynb for better notebook state management. - Introduced a new pi_web_api_query structure in tests.ipynb for improved API configuration. - Updated API class to format timestamps using DATETIME_FORMAT_WITH_TZ. - Refactored PIWebAPIClient to ensure correct web ID retrieval and emit metrics accurately. - Streamlined workflow parameters in pi_web_api_scouter.py for clarity and flexibility.
This commit is contained in:
@@ -212,10 +212,7 @@ class PIWebAPIClient(SientiaMonitoring):
|
||||
metric_object=metrics.GENERIC_REST_CLIENT_LAG,
|
||||
tags=core_labels,
|
||||
)
|
||||
await self.emit_metric(
|
||||
metric_object=metrics.GENERIC_REST_READ_COUNT,
|
||||
tags=core_labels,
|
||||
)
|
||||
|
||||
|
||||
status_code = c.getinfo(pycurl.RESPONSE_CODE)
|
||||
body = buffer.getvalue().decode('utf-8', errors='replace')
|
||||
@@ -227,6 +224,10 @@ class PIWebAPIClient(SientiaMonitoring):
|
||||
)
|
||||
raise PIMSRequestError(f"HTTP {status_code} calling '{full_url}': {body[:200]}")
|
||||
|
||||
await self.emit_metric(
|
||||
metric_object=metrics.GENERIC_REST_READ_COUNT,
|
||||
tags=core_labels,
|
||||
)
|
||||
try:
|
||||
return json.loads(body)
|
||||
except json.JSONDecodeError as e:
|
||||
@@ -315,7 +316,7 @@ class PIWebAPIClient(SientiaMonitoring):
|
||||
if isinstance(it, dict) and 'Timestamp' in it and 'Value' in it:
|
||||
ts = it.get('Timestamp')
|
||||
val = it.get('Value')
|
||||
web_id = web_ids.get(tag_name)
|
||||
web_id = web_ids[tag_name]['webid']
|
||||
if ts is not None:
|
||||
records.append(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user