-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(attribute.state): prevent missing state in sensor and metric
Introduced `SensorStateInterface` and `MetricStateInterface` to formalize state handling in sensors and metrics. Adjusted exception handling to throw `LogicException` instead of `RuntimeException` for unset states. Enhanced `CheckCommand` and `AttributeNormalizer` to incorporate the new interfaces and handle state retrieval more robustly.
- Loading branch information
Robin Lehrmann
committed
Aug 29, 2024
1 parent
82d093b
commit 5f44547
Showing
7 changed files
with
82 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace whatwedo\MonitorBundle\Monitoring\Metric; | ||
|
||
use whatwedo\MonitorBundle\Enums\MetricStateEnum; | ||
|
||
interface MetricStateInterface | ||
{ | ||
/** @throws \LogicException */ | ||
public function getState(): MetricStateEnum; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace whatwedo\MonitorBundle\Monitoring\Sensor; | ||
|
||
use whatwedo\MonitorBundle\Enums\SensorStateEnum; | ||
|
||
interface SensorStateInterface | ||
{ | ||
/** @throws \LogicException */ | ||
public function getState(): SensorStateEnum; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters