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.
Related REST API topics: Public REST API | Admin REST API | Use the REST API? | Monitor | Prometheus Integration
Introduction
Sync Gateway makes collecting performance data easy and secure by providing a Metrics REST API.
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.
It exposes Sync Gateway’s stats on two endpoints, which deliver the same data in one of two formats:
-
The
_metrics
endpoint returns Sync Gateway statistics in Prometheus format.
For example:GET host:4986/_metrics
For information on integration with Prometheus — see Prometheus Integration and our blog entry Monitoring and Visualization of Couchbase Sync Gateway with Prometheus and Grafana.
-
The
_expvars
endpoint returns Sync Gateway statistics in JSON format.
Configuration
The Metrics REST API is enabled by default on port 4986.
To change this you need to edit your sync-gateway-config.json
configuration file.
Locate the metricsInterface
setting and define the Sync Gateway URL and the port you want the API served on (for example: 4986) — see: Example 1.
"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. You can also generate curl requests if required, for each endpoint.