From c6e1f7fe8bd904c2203ec33ef1b039f7fa43f3bb Mon Sep 17 00:00:00 2001 From: Yoann Ciabaud Date: Thu, 17 May 2018 08:31:43 +0200 Subject: [PATCH] Prepare for 0.1.0 release :tada: --- README.md | 26 +++++++++++++------------- schema.lua | 13 +++++++++---- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 75fb9fb..9653914 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ # kong-prometheus-plugin -**WIP - not ready yet** Widely inspired by [nginx-lua-prometheus](https://github.com/knyar/nginx-lua-prometheus/) NGINX module and the [Kong StatsD plugin](https://github.com/Mashape/kong/tree/master/kong/plugins/statsd). @@ -51,23 +50,23 @@ The plugin exposes is metrics on kong's admin endpoint (port 8001 by default) on Metrics the plugin can expose in the prometheus format: -Metric | description | namespace ---- | --- | --- +Metric | description | namespace +--- | --- | --- `http_requests_total` | tracks api request | kong_http_requests_total -`http_request_size_bytes` | tracks api request's body size in bytes | kong_http_request_size_bytes -`http_response_size_bytes` | tracks api response's body size in bytes | kong_http_response_size_bytes -`http_request_duration_ms` | tracks the time interval between the request started and response received from the upstream server | kong_http_latency -`http_upstream_latency` | tracks the time it took for the final service to process the request | kong_http_upstream_latency -`http_kong_latency` | tracks the internal Kong latency that it took to run all the plugins | kong_http_kong_latency +`http_request_size_bytes` | tracks api request's body size in bytes | kong_http_request_size_bytes +`http_response_size_bytes` | tracks api response's body size in bytes | kong_http_response_size_bytes +`http_request_duration_ms` | tracks the time interval between the request started and response received from the upstream server | kong_http_latency +`http_upstream_duration_ms` | tracks the time it took for the final service to process the request | kong_http_upstream_latency +`http_kong_duration_ms` | tracks the internal Kong latency that it took to run all the plugins | kong_http_kong_latency ### Metric Fields Plugin can be configured with any combination of [Metrics](#metrics), with each entry containing the following fields. -Field | description | allowed values ---- | --- | --- -`name` | Prometheus metric's name | [Metrics](#metrics) -`stat_type` | determines what sort of event the metric represents | `gauge`, `counter` and `histogram` +Field | description | allowed values +--- | --- | --- +`name` | Prometheus metric's name | [Metrics](#metrics) +`stat_type` | determines what sort of event the metric represents | `gauge`, `counter` and `histogram` ## Kong Process Errors @@ -96,7 +95,8 @@ might want to keep the number of metrics (and distinct metric label values) to a minimum. ## Credits -- Adapted and maintained by Yoann Ciabaud (@yciabaud) +- Adapted and maintained by Yoann Ciabaud [@yciabaud](#yciabaud) +- :heart: kindly improved and tested by [@jayhding](#jayhding) ### Kong StatsD plugin - Source [Plugin](https://getkong.org/plugins/statsd/) created and maintained by the [Kong](https://getkong.org/) folks at [Mashape](https://www.mashape.com) diff --git a/schema.lua b/schema.lua index 11a61a6..aeb6793 100644 --- a/schema.lua +++ b/schema.lua @@ -1,11 +1,11 @@ local metrics = { - ["http_requests_total"] = true, + ["http_requests_total"] = true, ["http_request_duration_ms"] = true, - ["http_request_size_bytes"] = true, - ["http_response_size_bytes"] = true, + ["http_request_size_bytes"] = true, + ["http_response_size_bytes"] = true, ["http_upstream_duration_ms"] = true, ["http_kong_duration_ms"] = true, - ["http_connections"] = true, + ["http_connections"] = true, } @@ -53,6 +53,11 @@ local default_metrics = { stat_type = "histogram", labels = {"api"}, }, + { + name = "http_upstream_duration_ms", + stat_type = "gauge", + labels = {"api"}, + }, { name = "http_kong_duration_ms", stat_type = "histogram",