Disk I/O stats are not always available and should therefore be optional.

This commit is contained in:
Fabio Manganiello 2023-04-23 22:25:24 +02:00
parent 8e7d444c02
commit dc3392c11d
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774
2 changed files with 8 additions and 8 deletions

View file

@ -240,7 +240,7 @@ class SystemPlugin(SensorPlugin, EntityManager):
[
{
**info,
**io_stats[part],
**io_stats.get(part, {}),
**usage[part],
}
for part, info in parts.items()

View file

@ -70,7 +70,7 @@ class Disk:
}
)
read_count: int = field(
read_count: Optional[int] = field(
metadata={
'metadata': {
'description': 'Number of recorded read operations',
@ -78,7 +78,7 @@ class Disk:
}
)
write_count: int = field(
write_count: Optional[int] = field(
metadata={
'metadata': {
'description': 'Number of recorded write operations',
@ -86,7 +86,7 @@ class Disk:
}
)
read_bytes: int = field(
read_bytes: Optional[int] = field(
metadata={
'metadata': {
'description': 'Number of read bytes',
@ -94,7 +94,7 @@ class Disk:
}
)
write_bytes: int = field(
write_bytes: Optional[int] = field(
metadata={
'metadata': {
'description': 'Number of written bytes',
@ -102,7 +102,7 @@ class Disk:
}
)
read_time: float = field(
read_time: Optional[float] = field(
metadata={
'metadata': {
'description': 'Time spent reading, in seconds',
@ -110,7 +110,7 @@ class Disk:
}
)
write_time: float = field(
write_time: Optional[float] = field(
metadata={
'metadata': {
'description': 'Time spent writing, in seconds',
@ -118,7 +118,7 @@ class Disk:
}
)
busy_time: float = field(
busy_time: Optional[float] = field(
metadata={
'metadata': {
'description': 'Total disk busy time, in seconds',