A newer version of this documentation is available.

View Latest

Metrics REST API

      +

      Description of the Sync Gateway Metrics Rest API
      Use the API explorer to find out more about Sync Gateway’s endpoints by functionality.

      Content Blocking

      Couchbase Mobile’s API documentation utilizes Swagger UI to deliver an interactive and dynamic user experience. The page will not function correctly if your organization’s security policies restricts access to this type of content — instead see the alternate statics page Metrics REST API (Static Page)

      Introduction

      Sync Gateway makes collecting performance data easy and secure by providing a Metrics REST API. It exposes Sync Gateway’s stats on two endpoints, which deliver the same data in one of two formats:

      This API, separate from both the Public and Admin REST APIs, is available by default on port 4986 — see Configuration for how to change this, if needed. To allow users to access the Metrics API up you need to create a Couchbase Server-based RBAC-user for them — see: REST API Access

      Configuration

      The Metrics REST API is enabled by default on port 4986. To change this you need to edit the api.metricsInterface setting in your bootstrap configuration file and define the Sync Gateway URL and the port you want the API served on (for example: 4986) — see: Example 1.

      Alternatively

      If you are using 2.x file-based configuration then edit the metricsInterface setting in the sync-gateway-config.json configuration file — see: Legacy Pre-3.0 Configuration

      Example 1. Setting metrics interface endpoint
      • Persistent Configuration

      • 2.x File-based Configuration

      Within the bootstrap configuration file:

      "api.metricsInterface": "127.0.0.1:4986" (1)

      Within the sync gateway configuration file:

      "metricsInterface": "127.0.0.1:4986" (1)
      1 Here we define the Sync Gateway URL and the port (4986 in this instance) that we require the Metrics REST API to be served on.

      API Explorer

      You can browse the API using the explorer below. The explorer groups all the endpoints by functionality. Just click a label to expand the endpoints. For more information, refer to View Statistics and Metrics. You can also generate curl requests if required, for each endpoint: