How to Monitor API Metrics for Tyk API Gateway with Moesif

In the last few years API gateways have become increasing popular. By bundling standard API related functionality inside a single software component, development resources are freed up and system architect is simplified.

Tyk is such an API gateway. It’s open-source and written in the Go programming language. It comes with a range of features, such as authentication, access control, quotas and rate-limiting, API versioning, and many more.

Tyk follows a lightweight, modular approach to API gateway software that focuses on access control. This made it easy to build a Moesif plugin for Tyk API gateways.

In this article, we’ll talk about the insights Moesif gives you, and how to integrate it into your Tyk setup.

Setting Up Moesif API Analytics with Tyk

Tyk comes with an analytics pump for Moesif API Analytics. All you have to do is configure the right analytics pump in pump.conf, reload Tyk and you’re ready to go.

Moesif recommends the use of one application ID for all Tyk gateway instances and data-center regions. However, Production, Staging, and Development environments should get different IDs.

The pump.conf file should look something like this:

"pumps": {
  "moesif": {
    "name": "moesif",
    "meta": {
      "application_id": "Your Moesif Application Id"
    }
  },
}

The Moesif analytics pump for Tyk is open-source. Review it on GitHub.

How Does Moesif API Analytics Enhance Tyk?

Most of Moesif’s SDK features are also available with the Tyk analytics pump.

Service and route detection

Moesif can filter by routes by REST template, so that IDs can be used as wildcards.

For example, GET /media/videos/:id will match all GET requests to a video, independent of their ID.

Geo segmentation

The Tyk analytics pump will capture IP data in addition to timing metrics, enabling filtering and geo-heatmaps. The figure below shows locations which are experiencing a latency of > 1 second.

Geo heatmap

User sessions

By configuring Tyk with authentication, the Moesif analytics pump will automatically capture the relevant credentials. From session information Moesif is able to generate API session traces and user profiles containing additional details such as user first seen time, user last seen time, etc.

With the Moesif browser SDK it’s even possible to log the user’s journey from the first click on a landing page to the last request they send to your API

You may find it beneficial to add user demographic info such as name, email, phone, etc. As long as you have the user’s API key/session token, you can use any of the Moesif API libs to add/update user profile metadata.

User Dashboard

Using demographic info Moesif can perform more advanced user cohort analyses, such as allowing you to track 30-day active retention.

Retention measures the percentage of users, within a cohort, that return and stay active.

Cohort Analysis

Incoming and outgoing API calls

The Moesif analytics pump can be used to track your API calls, along with outgoing API requests to your partners. This can be used to understand and monitor whats going on with your partner’s infrastructure and give you an early head’s up of any issues. As long as traffic is flowing through your Tyk gateway, Moesif can analyze it.

API Calls

Summary

Moesif API Analytics plus Tyk is a formidable package that helps minimize development time and keeps maintenance low, over the whole API lifecycle.

Tyk allows bundling of all common API features into one system, called the Tyk API gateway.

With the addition of Moesif, user-centric data can be analyzed. By combining Moesif’s analytics pump and browser SDK, all user interactions can be saved (from the first landing page visit to the last sent request), logged and made available for further analysis.

Learn More About Moesif Get User-Centric API Monitoring for Tyk 14 day free trial. No credit card required. Learn More
Get User-Centric API Monitoring for Tyk Get User-Centric API Monitoring for Tyk

Get User-Centric API Monitoring for Tyk

Learn More