By on August 1, 2018

Expose Performance Metrics in Prometheus for any API – Kong CE 0.14 Feature Highlight

As part of our series helping you get up to speed on the new features released in Kong CE 0.14, we want to dive into one of the most important plugins we’ve created to date – Kong’s Prometheus Plugin. Kong is committed to the Open Source Ecosystem, and we’re excited to expand our coverage of the CNCF’s most popular hosted projects.

A key measure of a technical organization’s efficiency is the speed at which performance issues are identified and addressed. With the ever-increasing complexity and pace of innovation in technology today, real-time monitoring and alerting are essential to operating a high performing technical organization. Kong’s new Prometheus plugin empowers users to easily track performance metrics for upstream APIs and expose them in Prometheus exposition format, providing the backbone for implementation of robust monitoring and alerting.

By using a Prometheus Collector to scrape the endpoint on the Admin API, Kong users can gather performance metrics across all their Kong clusters, including those within Kubernetes clusters. Even if your microservice doesn’t have a Prometheus exporter, putting Kong in-front of it will expose a few metrics of your micro-services and enable you to track performance. Once the data is scraped, users can run custom rules across the dataset to pinpoint issues. With effective automation, users can leverage the Prometheus plugin set up workflows to proactively identify, evaluate, and resolve performance issues inside and outside of Kong.


The plugin records and exposes metrics at the node-level, however, Prometheus can be used to aggregate metrics across the entire cluster. Kong’s Prometheus plugin currently supports the following metrics:


  • Status codes: HTTP status codes returned by upstream services. These are available per service and across all services.
  • Latencies Histograms: Latency as measured at Kong:
    • Request: Total time taken by Kong and upstream services to serve requests.
    • Kong: Time taken for Kong to route a request and run all configured plugins.
    • Upstream: Time taken by the upstream service to respond to requests.
  • Bandwidth: Total Bandwidth (egress/ingress) flowing through Kong. This metric is available per service and as a sum across all services.
  • DB reachability: A gauge type with a value of 0 or 1, representing if DB can be reached by a Kong node or not.
  • Connections: Various Nginx connection metrics like active, reading, writing, and number of accepted connections.


You can enable the plugin for your services:

curl http://kong:8001/plugins -d ‘name=prometheus’ -d ‘service_id=<uuid>’


Once the plugin is enabled, you can consume your metrics via the following endpoint:

curl http://kong:8001/metrics


At Kong, we’re committed to providing our users with the best possible solutions and experience for their API needs. To see the Prometheus plugin in action, check out this recorded webinar. And of course, thank you to our open source contributors, core maintainers ( @thibaultcha @hisham @bungle @kikito) and other Kong Inc. employees who all made huge contributions to this release!


Happy Konging!