Datadog Setup
Last updated: 3 minutes read.
Introduction
The Tyk Pump can be configured to send your API traffic analytics to Datadog with which you can build a dashboards with various metrics based on your API traffic in Tyk.
Datadog dashboard example
We ceated a defaulkt Tyk dashboard canvat to give our users an easier starting point. You can find it in Datadog portal, under the Dashboards --> lists
section, (https://app.datadoghq.com/dashboard/lists)[https://app.datadoghq.com/dashboard/lists], and it is called Tyk Analytics Canvas
. To use this dashboard you will need to make sure that your datadog agent deployment has the following tag env:tyk-demo-env
and that your Tyk Pump configuration has dogstatsd.meta.namespace
set to pump
. You can also import it from Datadog official GH repo and change those values in the dashboard itself to visualize your analytics data as it flows into Datadog.
Prerequisites
- A working Datadog agent installed on your Environment. See the Datadog Tyk integration docs for more information.
- Either a Tyk Pro install or Tyk OSS Gateway install along with a Tyk Pump install.
How it works
When running the Datadog Agent, DogstatsD gets the request_time metric from your Tyk Pump in real time, per request, so you can understand the usage of your APIs and get the flexibility of aggregating by various parameters such as date, version, returned code, method etc.
Tyk Pump configuration
Below is a sample DogstatD section from a Tyk pump.conf
file
"dogstatsd": {
"type": "dogstatsd",
"meta": {
"address": "dd-agent:8126",
"namespace": "tyk",
"async_uds": true,
"async_uds_write_timeout_seconds": 2,
"buffered": true,
"buffered_max_messages": 32,
"sample_rate": 0.9999999999,
"tags": [
"method",
"response_code",
"api_version",
"api_name",
"api_id",
"org_id",
"tracked",
"path",
"oauth_id"
]
}
},
Field descriptions
address
: address of the datadog agent including host & portnamespace
: prefix for your metrics to datadogasync_uds
: Enable async UDS over UDPasync_uds_write_timeout_seconds
: Integer write timeout in seconds ifasync_uds: true
buffered
: Enable buffering of messagesbuffered_max_messages
: Max messages in single datagram ifbuffered: true
. Default 16sample_rate
: default 1 which equates to 100% of requests. To sample at 50%, set to 0.5tags
: List of tags to be added to the metric. The possible options are listed in the below example
If no tag is specified the fallback behavior is to use the below tags:
path
method
response_code
api_version
api_name
api_id
org_id
tracked
oauth_id
Note that this configuration can generate significant data due to the unbound nature of the path
tag.
On startup, you should see the loaded configs when initialising the DogstatsD pump
[May 10 15:23:44] INFO dogstatsd: initializing pump
[May 10 15:23:44] INFO dogstatsd: namespace: pump.
[May 10 15:23:44] INFO dogstatsd: sample_rate: 50%
[May 10 15:23:44] INFO dogstatsd: buffered: true, max_messages: 32
[May 10 15:23:44] INFO dogstatsd: async_uds: true, write_timeout: 2s