GetMetrics

Retrieve the current metric values.

Parameters

  • [optional] format: Set the format in which to return the metric values. Supported formats:
    • “json” (default)Return metric values as a json object.

      Numeric values are represented as strings and may be “inf”, “-inf”, or “nan”.

    • “prometheus” : Return metric values as a string formatted for Prometheus.

  • [optional] metrics: An array of specific metrics to include in the result. By default, all metrics are returned.

Details

A metric represents a single specific measurable phenomenon such as the size of a database or the number of queries that have run. Metrics come in a variety of types:

  • A counter is a single cumulative value that can only increase over time. As their name implies, counters can be used to ‘count’ discrete events as they occur, for example the number of queries received. The value of a counter reflects the amount accumulated since the ApertureDB process launched.

  • A gauge is a numerical value that can go up or down. The value of a gauge generally reflects some current state, for example the length of a queue.

  • A histogram provides a breakdown of discrete samples into buckets. It also includes a ‘count’ (counter) and ‘sum’ (gauge) representing the total number of samples taken and sum of all sample values respectively. Histograms are used to describe the distribution of events according to their size, such as query processing times or response sizes.

  • A summary is similar to a histogram but instead of fixed buckets it computes running quantiles over a sliding time window. Summaries are more expensive to compute than other metric types and are used less frequently.

ApertureDB metrics are organized into families. A family describes a class of related metrics that can be compared directly with each other. Metrics within a family are differentiated using labels and must share the same type. See below for examples.

Examples

The following shows how to obtain metrics in JSON:

# Query:
[{
    "GetMetrics": {}
}]

# Response:
[{
    "GetMetrics": {
        "status": 0,
        "version": "0.9.2",
        "values": {
            "families": [{
                "name": "cpu_cycles_total",
                "help": "Elapsed CPU cycles",
                "type": "Counter",
                "metrics": [
                    {"labels": {"type": "system"}, "value": "2828933849"},
                    {"labels": {"type": "application"}, "value": "27"}
                ]
            },{
                "name": "memory_bytes",
                "help": "Bytes of memory in use",
                "type": "Gauge",
                "metrics": [
                    {"labels": {"type": "total"}, "value": "33675821056"},
                    {"labels": {"type": "virtual"}, "value": "3303710560256"},
                    {"labels": {"type": "physical"}, "value": "57339904"}
                ]
            },
            {
                "name": "wait_seconds_total",
                "help": "Amount of time spent waiting in the work queue, in seconds",
                "type": "Histogram",
                "metrics": [{
                    "labels": {"query_type": "retry"},
                    "count": 0,
                    "sum": "0",
                    "buckets": [
                        {"count": 0, "max": "0.001"},
                        {"count": 0, "max": "0.01"},
                        {"count": 0, "max": "0.1"},
                        {"count": 0, "max": "1"},
                        {"count": 0, "max": "10"},
                        {"count": 0, "max": "60"},
                        {"count": 0, "max": "inf"}
                    ]
                },{
                    "labels": {"query_type": "read_write"},
                    "count": 1,
                    "sum": "1.7489e-05",
                    "buckets": [
                        {"count": 1, "max": "0.001"},
                        {"count": 1, "max": "0.01"},
                        {"count": 1, "max": "0.1"},
                        {"count": 1, "max": "1"},
                        {"count": 1, "max": "10"},
                        {"count": 1, "max": "60"},
                        {"count": 1, "max": "inf"}
                    ]
                },{
                    "labels": {"query_type": "read_only"},
                    "count": 0,
                    "sum": "0",
                    "buckets": [
                        {"count": 0, "max": "0.001"},
                        {"count": 0, "max": "0.01"},
                        {"count": 0, "max": "0.1"},
                        {"count": 0, "max": "1"},
                        {"count": 0, "max": "10"},
                        {"count": 0, "max": "60"},
                        {"count": 0, "max": "inf"}
                    ]
                }]
            },
            # ...
            ]
        }
    }
}]

This is an example of retrieving the same metrics in Prometheus format:

# Query
[{
    "GetMetrics": {
        "format": "prometheus"
    }
}]

# Response:
[{
    "GetMetrics": {
        "status": 0,
        "version": "0.9.2",
        "values":
"""
# HELP cpu_cycles_total Elapsed CPU cycles
# TYPE cpu_cycles_total counter
cpu_cycles_total{type="system"} 2828933849
cpu_cycles_total{type="application"} 27
# HELP memory_bytes Bytes of memory in use
# TYPE memory_bytes gauge
memory_bytes{type="total"} 33675821056
memory_bytes{type="virtual"} 3303710560256
memory_bytes{type="physical"} 57339904
# HELP wait_seconds_total Amount of time spent waiting in the work queue, in seconds
# TYPE wait_seconds_total histogram
wait_seconds_total_count{query_type="retry"} 0
wait_seconds_total_sum{query_type="retry"} 0
wait_seconds_total_bucket{query_type="retry",le="0.001"} 0
wait_seconds_total_bucket{query_type="retry",le="0.01"} 0
wait_seconds_total_bucket{query_type="retry",le="0.1"} 0
wait_seconds_total_bucket{query_type="retry",le="1"} 0
wait_seconds_total_bucket{query_type="retry",le="10"} 0
wait_seconds_total_bucket{query_type="retry",le="60"} 0
wait_seconds_total_bucket{query_type="retry",le="+Inf"} 0
wait_seconds_total_count{query_type="read_write"} 1
wait_seconds_total_sum{query_type="read_write"} 1.7489e-05
wait_seconds_total_bucket{query_type="read_write",le="0.001"} 1
wait_seconds_total_bucket{query_type="read_write",le="0.01"} 1
wait_seconds_total_bucket{query_type="read_write",le="0.1"} 1
wait_seconds_total_bucket{query_type="read_write",le="1"} 1
wait_seconds_total_bucket{query_type="read_write",le="10"} 1
wait_seconds_total_bucket{query_type="read_write",le="60"} 1
wait_seconds_total_bucket{query_type="read_write",le="+Inf"} 1
wait_seconds_total_count{query_type="read_only"} 0
wait_seconds_total_sum{query_type="read_only"} 0
wait_seconds_total_bucket{query_type="read_only",le="0.001"} 0
wait_seconds_total_bucket{query_type="read_only",le="0.01"} 0
wait_seconds_total_bucket{query_type="read_only",le="0.1"} 0
wait_seconds_total_bucket{query_type="read_only",le="1"} 0
wait_seconds_total_bucket{query_type="read_only",le="10"} 0
wait_seconds_total_bucket{query_type="read_only",le="60"} 0
wait_seconds_total_bucket{query_type="read_only",le="+Inf"} 0
...
"""
    }
}]

Metric Families

The following are the metric families exposed by ApertureDB.

  • name : help

  • queries_processed_total : Number of queries processed

  • commands_per_query : Number of commands per ApertureDB query

  • client_connections_total : Number of client connections served

  • connection_queue_seconds_pushes : Number of connections pushed onto the connection queue

  • connection_queue_seconds : Time spent in the connection queue, in seconds

  • cpu_cycles_total : Elapsed CPU cycles

  • memory_bytes : Bytes of memory in use

  • pmgd_transaction_seconds : Time taken per PMGD transaction, in seconds

  • query_seconds : Time taken per query, in seconds

  • queries_queued_total : Number of queries added to the work queue

  • wait_seconds_total : Amount of time spent waiting in the work queue, in seconds

  • queries_active_total : Number of queries active on the work queue

  • work_queue_idle_seconds_total : The amount of time queries spent waiting, in seconds.

  • api_bytes_transferred : The amount of data sent and received by the ApertureDB API, in bytes

  • pmgd_alloc_in_use_bytes : The total size of all objects in use

  • pmgd_alloc_in_use_count : The number of objects in use

  • pmgd_alloc_total_bytes : The total capacity of the region managed by this allocator, in bytes

  • pmgd_alloc_health_pct : A measure of the contiguousness of the allocated memory, as a percentage

  • log_messages_total : The number of log messages generated

  • audit_events_total : The number of audit events generated