A newer version of this documentation is available.

View Latest
March 23, 2025
+ 12

Description of the Sync Gateway Metrics REST API, alternative representation as a 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

Responses

HTTP Code Description Schema

200

OK - indicates success

ExpVars

Tags

  • Standard Output

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.

Sync Gateway Roles Required:

– Sync Gateway Dev Ops – External Stats Reader

Responses

HTTP Code Description Schema

200

OK - indicates success

Metrics

Tags

  • Prometheus

Definitions

ExpVars

Name Description Schema

cb
optional

Variables reported by the Couchbase SDK (go_couchbase package)

object

cmdline
optional

Built-in variables from the Go runtime, lists the command-line arguments

object

mc
optional

Variables reported by the low-level memcached API (gomemcached package)

object

memstats
optional

Dumps a large amount of information about the memory heap and garbage collector

object

syncGateway_changeCache
optional

syncGateway_changeCache

syncGateway_db
optional

syncGateway_db

syncgateway
optional

Monitoring stats

syncgateway

syncGateway_changeCache

Name Description Schema

lag-queue-0000ms
optional

Histogram of delay from Tap feed till doc is posted to changes feed

object

lag-tap-0000ms
optional

Histogram of delay from doc save till it shows up in Tap feed

object

lag-total-0000ms
optional

Histogram of total delay from doc save till posted to changes feed

object

maxPending
optional

Max number of sequences waiting on a missing earlier sequence number

object

outOfOrder
optional

Number of out-of-order sequences posted

object

view_queries
optional

Number of queries to channels view

object

syncGateway_db

Name Description Schema

channelChangesFeeds
optional

Number of calls to db.changesFeed, i.e. generating a changes feed for a single channel.

object

channelLogAdds
optional

Number of entries added to channel logs

object

channelLogAppends
optional

Number of times entries were written to channel logs using an APPEND operation

object

channelLogCacheHits
optional

Number of requests for channel-logs that were fulfilled from the in-memory cache

object

channelLogRewriteCollisions
optional

Number of collisions while attempting to rewrite channel logs using SET

object

channelLogRewrites
optional

Number of times entries were written to channel logs using a SET operation (rewriting the entire log)

object

document_gets
optional

Number of times a document was read from the database

object

revisionCache_adds
optional

Number of revisions added to the revision cache

object

revisionCache_hits
optional

Number of times a revision-cache lookup succeeded

object

revisionCache_misses
optional

Number of times a revision-cache lookup failed

object

revs_added
optional

Number of revisions added to the database (including deletions)

object

sequence_gets
optional

Number of times the database’s lastSequence was read

object

sequence_reserves
optional

Number of times the database’s lastSequence was incremented

object

syncgateway

Name Description Schema

global
optional

Global Sync Gateway stats

global

per_db
optional

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 replication_id

< per_db > array

per_replication
optional

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
optional

Resource utilization stats

resource_utilization

resource_utilization

Name Schema

admin_net_bytes_recv
optional

integer

admin_net_bytes_sent
optional

integer

error_count
optional

integer

go_memstats_heapalloc
optional

integer

go_memstats_heapidle
optional

integer

go_memstats_heapinuse
optional

integer

go_memstats_heapreleased
optional

integer

go_memstats_pausetotalns
optional

integer

go_memstats_stackinuse
optional

integer

go_memstats_stacksys
optional

integer

go_memstats_sys
optional

integer

goroutines_high_watermark
optional

integer

num_goroutines
optional

integer

process_cpu_percent_utilization
optional

integer

process_memory_resident
optional

integer

pub_net_bytes_recv
optional

integer

pub_net_bytes_sent
optional

integer

system_memory_total
optional

integer

warn_count
optional

integer

per_db

Name Schema

cache
optional

object

database
optional

object

per_replication
optional

< object > array

security
optional

object

per_replication

Name Schema

$replication_id
optional

$replication_id

$replication_id

Name Description Schema

sgr_active
optional

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
optional

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
optional

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
optional

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
optional

The total number of documents that failed to be pushed since replication started. Used by versions 1 and 2.

integer

sgr_num_docs_pushed
optional

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.

...
# 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