// Package metrics defines ingest-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 ( MQTTMessagesReceived = promauto.NewCounter(prometheus.CounterOpts{ Name: "ingest_mqtt_messages_received_total", Help: "Total number of telemetry messages received from MQTT.", }) MQTTMessagesInvalid = promauto.NewCounter(prometheus.CounterOpts{ Name: "ingest_mqtt_messages_invalid_total", Help: "Total number of telemetry messages dropped for failing validation.", }) MQTTMessagesDropped = promauto.NewCounter(prometheus.CounterOpts{ Name: "ingest_mqtt_messages_dropped_total", Help: "Total number of readings dropped because the worker backlog was full.", }) BatchFlushes = promauto.NewCounterVec(prometheus.CounterOpts{ Name: "ingest_batch_flush_total", Help: "Total number of batch flushes to ClickHouse, by outcome.", }, []string{"outcome"}) BatchFlushDuration = promauto.NewHistogram(prometheus.HistogramOpts{ Name: "ingest_batch_flush_duration_seconds", Help: "Duration of ClickHouse batch insert calls.", Buckets: prometheus.DefBuckets, }) BatchSize = promauto.NewHistogram(prometheus.HistogramOpts{ Name: "ingest_batch_size", Help: "Number of readings per flushed batch.", Buckets: []float64{1, 5, 10, 25, 50, 100, 250, 500, 1000}, }) RabbitMQPublishes = promauto.NewCounterVec(prometheus.CounterOpts{ Name: "ingest_rabbitmq_publish_total", Help: "Total number of new-reading events published to RabbitMQ, by outcome.", }, []string{"outcome"}) )