このページは、まだ日本語ではご利用いただけません。翻訳中です。
古いプラグインバージョンのドキュメントを閲覧しています。
Looking for the plugin's configuration parameters? You can find them in the StatsD configuration reference doc.
Log metrics for a service or route to a StatsD server. It can also be used to log metrics on Collectd daemon by enabling its StatsD plugin.
By default, the plugin sends a packet for each metric it observes. The udp_packet_size option
configures the greatest datagram size the plugin can combine. It should be less than
65507 according to UDP protocol. Consider the MTU of the network when setting this parameter.
Metrics
| Metric | Description | Namespace |
|---|---|---|
request_count |
The number of requests. | kong.<service_identifier>.request.count |
request_size |
The request’s body size in bytes. | kong.<service_identifier>.request.size |
response_size |
The response’s body size in bytes. | kong.<service_identifier>.response.size |
latency |
The time interval in milliseconds between the request and response. | kong.<service_identifier>.latency |
status_count |
Tracks each status code returned in a response. |
kong.<service_identifier>.request.status.<status>.count and kong.<service_name>.request.status.<status>.total
|
unique_users |
Tracks unique users who made requests to the underlying Service or Route. | kong.<service_identifier>.user.uniques |
request_per_user |
Tracks the request count per Consumer. | kong.<service_identifier>.user.<consumer_identifier>.request.count |
upstream_latency |
Tracks the time in milliseconds it took for the final Service to process the request. | kong.<service_identifier>.upstream_latency |
kong_latency |
Tracks the internal Kong latency in milliseconds that it took to run all the plugins. | kong.<service_identifier>.kong_latency |
status_count_per_user |
Tracks the status code for per Consumer per Service. |
kong.<service_identifier>.user.<consumer_identifier>.request.status.<status> and kong.<service_identifier>.user.<consumer_identifier>.request.status.total
|
If a request URI doesn’t match any Routes, the following metrics are sent instead:
| Metric | Description | Namespace |
|---|---|---|
request_count |
The request count. | kong.global.unmatched.request.count |
request_size |
The request’s body size in bytes. | kong.global.unmatched.request.size |
response_size |
The response’s body size in bytes. | kong.global.unmatched.response.size |
latency |
The time interval between when the request started and when the response is received from the upstream server. | kong.global.unmatched.latency |
status_count |
The status count. | kong.global.unmatched.status.<status>.count |
kong_latency |
The internal Kong latency in milliseconds that it took to run all the plugins. | kong.global.unmatched.kong_latency |
Metric Fields
The plugin can be configured with any combination of Metrics, with each entry containing the following fields:
| Field | Description | Datatype | Allowed values |
|---|---|---|---|
name required |
StatsD metric’s name. | String | Metrics |
stat_type required |
Determines what sort of event a metric represents. | String |
gauge, timer, counter, histogram, meter and set
|
sample_raterequired conditional |
Sampling rate. | Number | number |
consumer_identifierconditional |
Authenticated user detail. | String | One of the following options: consumer_id, custom_id, username, null
|
Metric behaviors
- By default, all metrics get logged.
- Metric with
stat_typeset tocounterorgaugemust havesample_ratedefined as well. -
unique_usersmetric only works withstat_typeasset. -
status_count,status_count_per_userandrequest_per_userwork only withstat_typeascounter. -
status_count_per_user,request_per_userandunique_usersmust havecustomer_identifierdefined.
Kong Process Errors
This logging plugin logs HTTP request and response data, and also supports stream data (TCP, TLS, and UDP).
The Kong process error file is the Nginx error file. You can find it at the following path:
{prefix}/logs/error.log
Configure the prefix in
kong.conf.