This is a guest post from Shashi Ranjan, Backend Engineer at Mashape.
Mashape is excited to announce our partnership with Datadog. Through an integration with Kong, the most widely used open source API management platform, everyone in our community can now monitor Kong’s usage and performance metrics with Datadog. Kong features a plugin-oriented architecture which allows you to set up authentication, transformations, security, and manage traffic controls.
With the Datadog plugin you can log API metrics like request count, request size, response status and latency to the local Datadog Agent. Additionally, Datadog’s Agent has been updated to collect Kong’s connection and database details.
Configuration
Datadog Agent configuration
To connect Kong with the Datadog Agent follow these instructions. Once Agent is configured and running, metrics will begin flowing to Datadog immediately.
Kong Plugin
To collect the full set of metrics available for monitoring Kong, you’ll also want to configure the Kong plugin, which is straightforward. You can add it on top of an API (or Consumer) by executing the following request on your Kong server:
$ curl -X POST http://kong:8001/apis/{api}/plugins \
--data "name=datadog" \
--data "config.host=127.0.0.1" \
--data "config.port=8125" \
--data "config.timeout=1000" \
Parameter | Description |
---|---|
api | (Part of the URL.) The id or name of the API that this plugin configuration will target. |
name | The name of the plugin to use, in this case: datadog . |
consumer_id optional | The CONSUMER ID that this plugin configuration will target. This value can only be used if authentication has been enabled so that the system can identify the user making the request. |
config.host optional | Default 127.0.0.1 . The IP address or host name to send data to. |
config.port optional | Default 8125 . The port to send data to on the upstream server. |
config.metrics optional | The metrics to be logged, by default all are logged. Available values are described at Metrics. |
config.timeout optional | Default 10000 . Timeout in milliseconds when sending data to the upstream server. |
Metrics
Once the Datadog Agent and Kong plugin are set up, the following metrics will be available in Datadog for visualization, alerting, and correlation with any part of your stack.
Name | Description |
---|---|
kong.< api_name > .request.count | The count of the requests made to the API |
kong.< api_name >.request_size | The request's body size in bytes |
kong.< api_name >.response_size | The response's body size in bytes |
kong.< api_name>.latency | The time interval between the request started and response received from the upstream server |
kong.< api_name >.< http_status_code >.count | The number of times each status code has been returned |
kong.< api_name >.user.uniques | The number of users that have made a request to the API |
kong.< api_name >.< consumer_id >.count | The number of requests each user has made. |
kong.connections_accepted | Total number of accepted client connections. |
kong.connections_active | Current number of active client connections including Waiting connections. |
kong.connections_handled | Total number of handled connections. (Same as accepts unless resource limits were reached). |
kong.connections_reading | Current number of connections where Kong is reading the request header. |
kong.connections_waiting | Current number of idle client connections waiting for a request. |
kong.connections_writing | Current number of connections where nginx is writing the response back to the client. |
kong.table.count | Total number of tables in the database. |
kong.table.items | Number of items in each table of the database. |
kong.total_requests | Total number of client requests. |
Datadog + Kong just makes sense
The popularity of Datadog made it a natural fit as a Kong plugin. Through a suite of API logging metrics and tools built for small cloud teams to enterprise, Datadog has you covered.
We’re excited to be partnering with Datadog and know our relationship will provide developers better API management. Try the plugin today and experience the best of Kong and Datadog.
Editor’s note: if you already use Kong but not Datadog, you can get a free Datadog account here.