Enhance OPC UA communication and metrics tracking - Updated README.md to include new OPC UA Communication section and detailed metrics for session and write diagnostics. - Added new metrics in laborious/metrics.py for tracking OPC UA session states and write attempts. - Refactored OPC activity in laborious/activities/opc.py to handle session errors and improve error reporting. - Updated e2e tests to cover new scenarios for OPC session/channel errors and reconnect handling. - Modified .gitignore to include relatorio files and mlruns directory. - Added ipykernel to requirements-dev.txt for Jupyter notebook support.
26 lines
499 B
Python
26 lines
499 B
Python
# %%
|
|
|
|
# Load logs.txt
|
|
with open('logs.txt', 'r') as file:
|
|
lines = file.readlines()
|
|
|
|
# %%
|
|
import re
|
|
# Grep "inter-arrival_s=number" with regex
|
|
intervals = []
|
|
for line in lines:
|
|
match = re.search(r'inter-arrival_s=([0-9.]+)', line)
|
|
if match:
|
|
intervals.append(float(match.group(1)))
|
|
# %%
|
|
|
|
print(intervals)
|
|
# %%
|
|
import matplotlib.pyplot as plt
|
|
plt.plot(intervals)
|
|
plt.ylabel('Inter-arrival time (s)')
|
|
plt.xlabel('Sample')
|
|
plt.title('Inter-arrival time distribution')
|
|
plt.show()
|
|
# %%
|