March 16, 2025
+ 12

Description of the Sync Gateway Metrics Rest API

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

Within the bootstrap configuration file:

json
"api.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 Reference

The API reference groups all the endpoints by functionality. For more information, refer to View Statistics and Metrics.