Traffic Analytics

Last updated: 3 minutes read.

The Tyk Dashboard provides a full set of analytics functions and graphs that you can use to segment and view your API traffic and activity. The Dashboard offers a great way for you to debug your APIs and quickly pin down where errors might be cropping up and for which clients.

Note

In Tyk v5.1 (and LTS patches v4.0.14 and v5.0.3) we introduced User Owned Analytics which can be used to limit the visibility of aggregate statistics to users when API Ownership is enabled. Due to the way that the analytics data are aggregated, not all statistics can be filtered by API and so may be inaccessible to users with the Owned Analytics permission.

How does Tyk capture and process Traffic Analytics?

When a client makes a request to the Tyk Gateway, the details of the request and response are captured and stored in a temporary Redis list. This list is read (and then flushed) every 10 seconds by the Tyk Pump. The Pump processes the records that it has read from Redis and forwards them to the required data sinks using the pumps configured in your system. You can set up multiple pumps and configure them to send different analytics to different data sinks.

The Mongo Aggregate and SQL Aggregate pumps perform aggregation of the raw analytics records before storing the aggregated statistics in the MongoDB or SQL database respectively.

Note

Note that you must enable traffic analytics in your Tyk Gateway so that it will generate analytics records.

Minimal pump configuration for Tyk Dashboard analytics

For the Tyk Dashboard’s analytics functionality to work, you must configure both per request and aggregated pumps for the database platform that you are using

  • if you are using MongoDB, you must configure mongo and mongo_aggregate pumps
  • if you are using SQL, you must configure sql and sql_aggregate pumps

Per-request (raw) analytics

The transaction records contain information about each request and response, such as path or status. The fields captured in each analytics record are included in the Tyk Pump documentation.

It is also possible to enable detailed request logging in the Gateway so that Tyk will log the requests and responses (including payloads) in wire format as base64 encoded data.

These data are displayed in the Log Browser, on the Activity logs screen in the Tyk Dashboard.

Aggregated analytics

The Mongo Aggregate and SQL Aggregate pumps will collate statistics from the analytics records, aggregated by hour, for the following keys:

Key Analytics aggregated by Dashboard screen
APIID API Activity by API
TrackPath API endpoint Activity by endpoint
ResponseCode HTTP status code (success/error) Activity by errors
APIVersion API version n/a
APIKey Client access key/token Activity by Key
OauthID OAuth client (if OAuth used) Traffic per OAuth Client
Geo Geographic location of client Activity by location
Tags Custom session context tags n/a