Metrics

⚠️
BETA Warning
The features described in this document are subject to change and may be updated in future releases.

The metrics are provided in 1 minute, 5 minutes and 15 minutes sampling periods.

HTTP API

To retrieve the metrics via the RESTful API, use the endpoint:

http://127.0.0.1:5654/debug/statz?interval=[1m|5m|15m]&format=[json|html]

This endpoint allows you to specify the interval for which you want to gather metrics, choosing from 1 minute, 5 minutes, or 15 minutes. Please note that this endpoint is only accessible from the same machine (localhost) by default.

By default, the output format is JSON. If format=html is specified, the response will be in an HTML table.

TQL with CHART

The example below shows how to render machbase-neo’s HTTP latency distribution in a chart. It uses FAKE( statz(period, metrics...) ) SRC function, and then makes time-value pairs for input of the CHART().

FAKE(statz("15m", 
    "machbase:http:latency_p50",
    "machbase:http:latency_p90",
    "machbase:http:latency_p99"
))
MAPVALUE(1, list(value(0), value(1)))
MAPVALUE(2, list(value(0), value(2)))
MAPVALUE(3, list(value(0), value(3)))
CHART(
    size("600px", "300px"),
    chartJSCode({
        function yformatter(val, idx){
            if (val > 1000000000)   { return `${val/1000000000} s`; }
            else if (val > 1000000) { return `${val/1000000} ms`; } 
            else if (val > 1000)    { return `${val/1000} µs`; }
            return `${val} ns`
        }
    }),
    chartOption({
        animation: false,
        yAxis: { type: "value", axisLabel:{ formatter: yformatter }},
        xAxis: { type: "time", axisLabel:{ rotate: -90 }},
        series: [
            {type: "line", data: column(3), areaStyle:{}, smooth:false, name: "p99"},
            {type: "line", data: column(2), areaStyle:{}, smooth:false, name: "p90"},
            {type: "line", data: column(1), areaStyle:{}, smooth:false, name: "p50"},
        ],
        tooltip: { trigger: "axis", valueFormatter: yformatter },
        legend: {}
    })
)

Metrics

All metrics are based on the selected sampling period, which can be one of the following:
1 minute (1m), 5 minutes (5m), or 15 minutes (15m).

HTTP

MetricDescription
machbase:http:countTotal number of HTTP requests
machbase:http:latency_p50HTTP response latency at the 50th percentile, median (ns.)
machbase:http:latency_p90HTTP response latency at the 90th percentile (ns.)
machbase:http:latency_p99HTTP response latency at the 99th percentile (ns.)
machbase:http:recv_bytesTotal size of HTTP request payloads
machbase:http:send_bytesTotal size of HTTP response payloads
machbase:http:status_1xxNumber of HTTP responses with 1xx status codes
machbase:http:status_2xxNumber of HTTP responses with 2xx status codes
machbase:http:status_3xxNumber of HTTP responses with 3xx status codes
machbase:http:status_4xxNumber of HTTP responses with 4xx status codes
machbase:http:status_5xxNumber of HTTP responses with 5xx status codes

MQTT

MetricDescription
machbase:mqtt:recv_bytestotal number of bytes received (bytes)
machbase:mqtt:send_bytestotal number of bytes sent (bytes)
machbase:mqtt:recv_pktsthe total number of publish messages received
machbase:mqtt:send_pktstotal number of messages of any type sent
machbase:mqtt:recv_msgstotal number of publish messages received
machbase:mqtt:send_msgstotal number of publish messages sent
machbase:mqtt:drop_msgstotal number of publish messages dropped to slow subscriber
machbase:mqtt:retainedtotal number of retained messages active on the broker
machbase:mqtt:subscriptionstotal number of subscriptions active on the broker
machbase:mqtt:clientstotal number of connected and disconnected clients with a persistent session currently connected and registered
machbase:mqtt:clients_connectednumber of currently connected clients
machbase:mqtt:clients_disconnectedtotal number of persistent clients (with clean session disabled) that are registered at the broker but are currently disconnected
machbase:mqtt:inflightthe number of messages currently in-flight
machbase:mqtt:inflight_droppedthe number of inflight messages which were dropped

TQL

MetricDescription
machbase:tql:cache:count_[avg|max|min]Number of items in the TQL cache
machbase:tql:cache:data_size_[avg|max|min]Total size of the TQL cache (bytes)
machbase:tql:cache:evictionsNumber of items evicted from the TQL cache
machbase:tql:cache:insertionsNumber of new items inserted into the TQL cache
machbase:tql:cache:hitsNumber of cache hits in the TQL cache
machbase:tql:cache:missesNumber of cache misses in the TQL cache

Database Sessions

MetricDescription
machbase:session:append:countTotal number of appenders used
machbase:session:append:in_useNumber of appenders currently open
machbase:session:conn:countTotal number of connections used
machbase:session:conn:in_useNumber of connections currently open
machbase:session:stmt:countTotal number of statements used
machbase:session:stmt:in_useNumber of statements currently open
machbase:session:conn:use_time_[avg|max|min]Connection usage time (ns.)
machbase:session:conn:wait_time_[avg|max|min]Wait time for fetch iteration limit (ns.)
machbase:session:query:countTotal number of queries (only those using fetch iteration)
machbase:session:query:exec_time_[avg|max|min]Execution time of prepared statements (ns.)
machbase:session:query:fetch_time_[avg|max|min]Fetch time (ns.)
machbase:session:query:wait_time_[avg|max|min]Wait time for iteration limit (ns.)
machbase:session:query:hwm:elapseHigh Water Marked Query total elapsed time (ns.)
machbase:session:query:hwm:exec_timeHigh Water Marked Query’s statement preparation time (ns.)
machbase:session:query:hwm:fetch_timeHigh Water Marked Query’s fetch time (ns.)
machbase:session:query:hwm:wait_timeHigh Water Marked Query’s iteration limit wait time (ns.)
machbase:session:query:hwm:sql_argsHigh Water Marked Query’s SQL bind variables ([]string)
machbase:session:query:hwm:sql_textHigh Water Marked Query’s SQL text (string)

Go

MetricDescription
go:heap_in_use_[avg|max|min]Heap usage (bytes)
go:cgo_call_[avg|max|min]Number of CGO function calls
go:goroutine_[avg|max|min]Number of goroutines
Last updated on