Metrics REST API (Static Page)
Description of the Sync Gateway Metrics REST API, alternative representation as a static page
Related REST API topics: Public REST API (Static Page) | Admin REST API (Static Page)
Paths
This resources section groups together the available API operations under functional categories.
Debugging/monitoring at runtime
GET /_expvar
Description
The Expvars
method returns Sync Gateways' numerous statistics, and other runtime variables, in JSON format.
Making them readily available for debugging or performance monitoring purposes.
See : Sync Gateway Statistics Schema for more details on the metrics collected and reported by Sync Gateway.
Sync Gateway Roles Required:
– Sync Gateway Dev Ops – External Stats Reader
Debugging/monitoring runtime stats in Prometheus format
GET /_metrics
Description
The _metrics
method returns Sync Gateway’s statistics and other runtime variables in Prometheus format.
This makes for a convenient feed for your debugging or performance monitoring purposes.
-
For more details on the metrics collected and reported by Sync Gateway – see: Sync Gateway Statistics Schema.
-
For more details on Monitoring Sync Gateway using the
_metrics
feed – see: our blog on Monitoring and Visualization of Couchbase Sync Gateway with Prometheus and Grafana
Sync Gateway Roles Required:
– Sync Gateway Dev Ops – External Stats Reader
Definitions
ExpVars
Name | Description | Schema |
---|---|---|
cb |
Variables reported by the Couchbase SDK (go_couchbase package) |
object |
cmdline |
Built-in variables from the Go runtime, lists the command-line arguments |
object |
mc |
Variables reported by the low-level memcached API (gomemcached package) |
object |
memstats |
Dumps a large amount of information about the memory heap and garbage collector |
object |
syncGateway_changeCache |
||
syncGateway_db |
||
syncgateway |
Monitoring stats |
syncGateway_changeCache
Name | Description | Schema |
---|---|---|
lag-queue-0000ms |
Histogram of delay from Tap feed till doc is posted to changes feed |
object |
lag-tap-0000ms |
Histogram of delay from doc save till it shows up in Tap feed |
object |
lag-total-0000ms |
Histogram of total delay from doc save till posted to changes feed |
object |
maxPending |
Max number of sequences waiting on a missing earlier sequence number |
object |
outOfOrder |
Number of out-of-order sequences posted |
object |
view_queries |
Number of queries to channels view |
object |
syncGateway_db
Name | Description | Schema |
---|---|---|
channelChangesFeeds |
Number of calls to db.changesFeed, i.e. generating a changes feed for a single channel. |
object |
channelLogAdds |
Number of entries added to channel logs |
object |
channelLogAppends |
Number of times entries were written to channel logs using an APPEND operation |
object |
channelLogCacheHits |
Number of requests for channel-logs that were fulfilled from the in-memory cache |
object |
channelLogRewriteCollisions |
Number of collisions while attempting to rewrite channel logs using SET |
object |
channelLogRewrites |
Number of times entries were written to channel logs using a SET operation (rewriting the entire log) |
object |
document_gets |
Number of times a document was read from the database |
object |
revisionCache_adds |
Number of revisions added to the revision cache |
object |
revisionCache_hits |
Number of times a revision-cache lookup succeeded |
object |
revisionCache_misses |
Number of times a revision-cache lookup failed |
object |
revs_added |
Number of revisions added to the database (including deletions) |
object |
sequence_gets |
Number of times the database’s lastSequence was read |
object |
sequence_reserves |
Number of times the database’s lastSequence was incremented |
object |
syncgateway
Name | Description | Schema |
---|---|---|
global |
Global Sync Gateway stats |
|
per_db |
This array contains stats for all databases declared in the config file – see the Sync Gateway Statistics Schema for more details on the metrics collected and reported by Sync Gateway. The statistics for each {$db_name} database are grouped into: * cache related statistics
* cbl_replication_push
* cbl_replication_pull
* database_related_statistics
* delta_sync
* gsi_views
* security_related_statistics
* shared_bucket_import
* per_replication statistics for each |
< per_db > array |
per_replication |
An array of stats for each replication declared in the config file Deprecated @ 2.8: used only by inter-sync-gateway replications version 1. |
< per_replication > array |
global
Name | Description | Schema |
---|---|---|
resource_utilization |
Resource utilization stats |
resource_utilization
Name | Schema |
---|---|
admin_net_bytes_recv |
integer |
admin_net_bytes_sent |
integer |
error_count |
integer |
go_memstats_heapalloc |
integer |
go_memstats_heapidle |
integer |
go_memstats_heapinuse |
integer |
go_memstats_heapreleased |
integer |
go_memstats_pausetotalns |
integer |
go_memstats_stackinuse |
integer |
go_memstats_stacksys |
integer |
go_memstats_sys |
integer |
goroutines_high_watermark |
integer |
num_goroutines |
integer |
process_cpu_percent_utilization |
integer |
process_memory_resident |
integer |
pub_net_bytes_recv |
integer |
pub_net_bytes_sent |
integer |
system_memory_total |
integer |
warn_count |
integer |
per_db
Name | Schema |
---|---|
cache |
object |
database |
object |
per_replication |
< object > array |
security |
object |
per_replication
Name | Schema |
---|---|
$replication_id |
$replication_id
Name | Description | Schema |
---|---|---|
sgr_active |
Whether the replication is active at this time. Deprecated @ 2.8: used only by inter-sync-gateway replications version 1. |
boolean |
sgr_docs_checked_sent |
The total number of documents checked for changes since replication started. This represents the number of potential change notifications pushed by Sync Gateway. Constraints This is not necessarily the number of documents pushed, as a given target might already have the change. Used by versions 1 and 2. |
integer |
sgr_num_attachment_bytes_transferred |
The total number of attachment bytes transferred since replication started. Deprecated @ 2.8: used only by inter-sync-gateway replications version 1. |
integer |
sgr_num_attachments_transferred |
The total number of attachments transferred since replication started. Deprecated @ 2.8: used only by inter-sync-gateway replications version 1. |
integer |
sgr_num_docs_failed_to_push |
The total number of documents that failed to be pushed since replication started. Used by versions 1 and 2. |
integer |
sgr_num_docs_pushed |
The total number of documents that were pushed since replication started. Used by versions 1 and 2. |
integer |
Metrics
The Prometheus output is expected to by consumed only by a Prometheus server. For that reason its format is irrelevant, and a brief extract is show here for completeness and information only.
-
For more details on the metrics collected and reported by Sync Gateway – see: Sync Gateway Statistics Schema.
-
For more details on Monitoring Sync Gateway using the
_metrics
feed – see: our blog on Monitoring and Visualization of Couchbase Sync Gateway with Prometheus and Grafana
... # HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles. # TYPE go_gc_duration_seconds summary go_gc_duration_seconds{quantile="0"} 0.0001155 go_gc_duration_seconds{quantile="0.25"} 0.0001254 go_gc_duration_seconds{quantile="0.5"} 0.0001597 go_gc_duration_seconds{quantile="0.75"} 0.0001806 go_gc_duration_seconds{quantile="1"} 0.0049731 go_gc_duration_seconds_sum 0.006334 go_gc_duration_seconds_count 9 # HELP go_goroutines Number of goroutines that currently exist. # TYPE go_goroutines gauge go_goroutines 205 ...
Type : object