// Package metrics defines rule-engine-service's Prometheus metrics. // Registered automatically (via promauto) into the default registry on // import; served by main.go's dedicated metrics HTTP server. package metrics import ( "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" ) var ( ReadingsConsumed = promauto.NewCounter(prometheus.CounterOpts{ Name: "rule_engine_readings_consumed_total", Help: "Total number of telemetry.new_reading events consumed from RabbitMQ.", }) RulesMatched = promauto.NewCounter(prometheus.CounterOpts{ Name: "rule_engine_rules_matched_total", Help: "Total number of rule conditions that evaluated true and were dispatched.", }) RulesTriggered = promauto.NewCounterVec(prometheus.CounterOpts{ Name: "rule_engine_rules_triggered_total", Help: "Total number of rule dispatch attempts, by action type and outcome.", }, []string{"action_type", "outcome"}) DispatchDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{ Name: "rule_engine_dispatch_duration_seconds", Help: "Duration of the gRPC/HTTP call to device-control-service, by action type.", Buckets: prometheus.DefBuckets, }, []string{"action_type"}) CacheRefreshes = promauto.NewCounterVec(prometheus.CounterOpts{ Name: "rule_engine_cache_refresh_total", Help: "Total number of automation_rules cache refreshes from PostgreSQL, by outcome.", }, []string{"outcome"}) )