Company
Date Published
Author
Wangchong Zhou
Word count
1938
Language
English
Hacker News points
None

Summary

Kong Cloud has re-engineered its metrics pipeline to improve performance and cost-effectiveness by using OpenResty to send metrics to Prometheus, enabling effective monitoring of high traffic volumes with reduced compute power. By decoupling the metrics and logging infrastructure, the systems can scale independently. The architecture leverages both push and pull models, with Prometheus primarily utilizing the pull model, complemented by an edge logger that uses Lua code to collect and push metrics to an edge exporter. Metrics are stored and processed in local memory, with aggregation challenges addressed by avoiding shared memory contention, ultimately employing a combination of foreign function interface (FFI) and LuaJIT for optimized performance. The edge exporter functions similarly to a Pushgateway, translating metrics received from OpenResty worker processes into Prometheus-compatible formats. This design, which updates metrics periodically and skips zero-value metrics, ensures efficiency and reduces the load on Prometheus while maintaining statelessness and ease of maintenance.