metrics: register inbound-trigger and outbound-service counters

This commit is contained in:
2026-09-15 16:26:09 +03:00
parent a19e5afd5e
commit 09479b5c48
2 changed files with 26 additions and 1 deletions
+11
View File
@@ -21,6 +21,8 @@ import HomeAssistant.Runtime.Metrics
, metricsAction
, parseInfoDs
, schemaMatches
, AppMetrics (..)
, registerAppMetrics
)
import qualified System.Metrics as M (Value (..))
import Test.Hspec
@@ -164,6 +166,15 @@ spec = do
schemaMatches [ds "a" Derive] [("a", Gauge)]
`shouldBe` False
describe "registerAppMetrics" $ do
it "registers both counters with the store" $ do
store <- Metrics.newStore
m <- registerAppMetrics store
Counter.inc (amTriggersIn m)
sample <- Metrics.sampleAll store
HM.lookup "hass.trigger.in" sample `shouldBe` Just (M.Counter 1)
HM.lookup "hass.service.out" sample `shouldBe` Just (M.Counter 0)
describe "end-to-end (rrdtool-gated)" $ do
it "creates an rrd, samples, and updates it" $ do
mRrdtool <- findExecutable "rrdtool"