feat(go): expose runtime ingest metrics

This commit is contained in:
lingniu
2026-07-02 19:06:24 +08:00
parent 1dfd540700
commit 896e841902
18 changed files with 602 additions and 28 deletions

View File

@@ -79,3 +79,19 @@ Every received frame should become one `FrameEnvelope`.
2. Add runtime metrics for protocol frame counts, parse failures, Kafka/NATS publish failures, and writer lag.
3. Review TDengine tables and remove unused tables only after export or explicit confirmation.
4. Keep new business tables narrow by default. Add a column only when a query or index proves it is needed.
## Runtime Metrics Baseline
Runtime metrics are exposed as Prometheus text from `/metrics`. They are operational signals and must not create new business tables by default.
Core counters:
- `vehicle_gateway_frames_total`: received protocol frames by protocol and parse status.
- `vehicle_gateway_publish_total`: raw and unified publish results by protocol.
- `vehicle_realtime_kafka_messages_total`: realtime consumer messages by topic and status.
- `vehicle_realtime_updates_total`: Redis/MySQL realtime projector updates by topic and status.
- `vehicle_history_writes_total`: TDengine history writes by topic and status.
- `vehicle_stat_writes_total`: MySQL metric writes by topic and status.
- `vehicle_bridge_kafka_writes_total`: NATS to Kafka bridge writes by Kafka topic and status.
If a metric becomes a product requirement, derive a narrow metric table from Kafka replay instead of widening raw or realtime tables.