Metrics REST API (Static Page)

      +

      Description of the Sync Gateway Metrics REST API, alternative representation as a static page

      Resources

      This section describes the operations available with this REST API. The operations are grouped in the following categories.

      default

      Table of Contents

      Get all Sync Gateway statistics

      GET /_expvar
      Description

      This returns a snapshot of all metrics in Sync Gateway for debugging and monitoring purposes.

      This includes per database stats, replication stats, and server stats.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      • Sync Gateway Dev Ops
      • External Stats Reader
      Produces
      • application/javascript

      Responses
      HTTP Code Description Schema

      200

      Returned statistics

      get__expvar_200_response

      Prometheus

      Endpoints for use with Prometheus

      Debugging/monitoring runtime stats in Prometheus Exposition format

      GET /_metrics
      Description

      Returns Sync Gateway statistics and other runtime variables in Prometheus Exposition format.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      • Sync Gateway Dev Ops
      • External Stats Reader
      Produces
      • text/plain

      Responses
      HTTP Code Description Schema

      200

      Successfully returned stats

      String

      Debugging/monitoring runtime stats in Prometheus Exposition format

      GET /metrics
      Description

      Returns Sync Gateway statistics and other runtime variables in Prometheus Exposition format.

      Required Sync Gateway RBAC roles:

      • Sync Gateway Architect
      • Sync Gateway Dev Ops
      • External Stats Reader
      Produces
      • text/plain

      Responses
      HTTP Code Description Schema

      200

      Successfully returned stats

      String

      Server

      Table of Contents

      Check if API is available

      GET /_ping
      Description

      Returns OK status if API is available.

      Produces
      • text/plain

      Responses
      HTTP Code Description Schema

      200

      Returned status

      String

      Check if API is available

      HEAD /_ping
      Description

      Returns OK status if API is available.

      Responses
      HTTP Code Description Schema

      200

      Server is available

      Definitions

      This section describes the properties consumed and returned by this REST API.

      ExpVars

      Name Description Schema

      cmdline
      optional

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

      Object

      memstats
      optional

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

      Object

      cb
      optional

      Variables reported by the Couchbase SDK (go_couchbase package)

      Object

      mc
      optional

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

      Object

      syncGateway_changeCache
      optional

      get__expvar_200_response_syncGateway_changeCache

      syncGateway_db
      optional

      get__expvar_200_response_syncGateway_db

      syncgateway
      optional

      Monitoring stats

      get__expvar_200_response_syncgateway

      GetExpvar200Response

      Name Description Schema

      cmdline
      optional

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

      Object

      memstats
      optional

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

      Object

      cb
      optional

      Variables reported by the Couchbase SDK (go_couchbase package)

      Object

      mc
      optional

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

      Object

      syncGateway_changeCache
      optional

      get__expvar_200_response_syncGateway_changeCache

      syncGateway_db
      optional

      get__expvar_200_response_syncGateway_db

      syncgateway
      optional

      Monitoring stats

      get__expvar_200_response_syncgateway

      GetExpvar200ResponseSyncGatewayChangeCache

      Name Description Schema

      maxPending
      optional

      Max number of sequences waiting on a missing earlier sequence number

      Object

      lag-tap-0000ms
      optional

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

      Object

      lag-queue-0000ms
      optional

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

      Object

      lag-total-0000ms
      optional

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

      Object

      outOfOrder
      optional

      Number of out-of-order sequences posted

      Object

      view_queries
      optional

      Number of queries to channels view

      Object

      GetExpvar200ResponseSyncGatewayDb

      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

      channelLogRewrites
      optional

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

      Object

      channelLogRewriteCollisions
      optional

      Number of collisions while attempting to rewrite channel logs using SET

      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

      GetExpvar200ResponseSyncgateway

      Name Description Schema

      global
      optional

      Global Sync Gateway stats

      get__expvar_200_response_syncgateway_global

      per_db
      optional

      This array contains stats for all databases declared in the config file — see the [Sync Gateway Statistics Schema](./../stats-monitoring.html) 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 - collections 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

      get__expvar_200_response_syncgateway_per_db_inner List

      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.

      get__expvar_200_response_syncgateway_per_replication_inner List

      GetExpvar200ResponseSyncgatewayGlobal

      Name Description Schema

      resource_utilization
      optional

      Resource utilization stats

      get__expvar_200_response_syncgateway_global_resource_utilization

      GetExpvar200ResponseSyncgatewayGlobalResourceUtilization

      Name Description 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

      GetExpvar200ResponseSyncgatewayPerDbInner

      Name Description Schema

      cache
      optional

      Object

      database
      optional

      Object

      per_replication
      optional

      Object

      collections
      optional

      Object

      security
      optional

      Object

      GetExpvar200ResponseSyncgatewayPerReplicationInner

      Name Description Schema

      $replication_id
      optional

      get__expvar_200_response_syncgateway_per_replication_inner__replication_id

      GetExpvar200ResponseSyncgatewayPerReplicationInnerReplicationId

      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_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_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_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