Monitor Kong With Our New Datadog Integration | Datadog

Monitor Kong with our new Datadog integration

Author Shashi Ranjan

Published: June 17, 2016

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.


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 "" \
    --data "config.port=8125" \
    --data "config.timeout=1000" \
api(Part of the URL.) The id or name of the API that this plugin configuration will target.
nameThe name of the plugin to use, in this case: datadog.
consumer_id optionalThe 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. optionalDefault The IP address or host name to send data to.
config.port optionalDefault 8125. The port to send data to on the upstream server.
config.metrics optionalThe metrics to be logged, by default all are logged. Available values are described at Metrics.
config.timeout optionalDefault 10000. Timeout in milliseconds when sending data to the upstream server.


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.

kong.< api_name > .request.countThe count of the requests made to the API
kong.< api_name >.request_sizeThe request's body size in bytes
kong.< api_name >.response_sizeThe response's body size in bytes
kong.< api_name>.latencyThe time interval between the request started and response received from the upstream server
kong.< api_name >.< http_status_code >.countThe number of times each status code has been returned
kong.< api_name >.user.uniquesThe number of users that have made a request to the API
kong.< api_name >.< consumer_id >.countThe number of requests each user has made.
kong.connections_acceptedTotal number of accepted client connections.
kong.connections_activeCurrent number of active client connections including Waiting connections.
kong.connections_handledTotal number of handled connections. (Same as accepts unless resource limits were reached).
kong.connections_readingCurrent number of connections where Kong is reading the request header.
kong.connections_waitingCurrent number of idle client connections waiting for a request.
kong.connections_writingCurrent number of connections where nginx is writing the response back to the client.
kong.table.countTotal number of tables in the database.
kong.table.itemsNumber of items in each table of the database.
kong.total_requestsTotal 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.