Metrics

/metrics

Beginngin with v2.21.3, you can use the metrics node to collect important data about your Webapp such as number of processes and outgoing traffic.

This document covers:

Webapp Metrics

Returns the Webapp data in JSON format.

Request

GET /metrics

Response

As an example, the response might look like this:

{
    "metrics": {
        "web_uptime": {
            "type": "gauge",
            "help": "Number of seconds since web server has started",
            "data": [
                {
                    "labels": {
                        "node": "06475793be9d"
                    },
                    "value": 348842
                }
            ]
        },
        "web_connections": {
            "type": "counter",
            "help": "Total number of connections accepted",
            "data": [
                {
                    "labels": {
                        "node": "06475793be9d"
                    },
                    "value": 23781
                }
            ]
        },
        "web_pending_connections": {
            "type": "gauge",
            "help": "Current number of pending connections in the queue",
            "data": [
                {
                    "labels": {
                        "node": "06475793be9d"
                    },
                    "value": 0
                }
            ]
        },
        "web_max_pending_connections": {
            "type": "gauge",
            "help": "Maximum number of pending connections in the queue",
            "data": [
                {
                    "labels": {
                        "node": "06475793be9d"
                    },
                    "value": 10
                }
            ]
        },
        "web_queue_len": {
            "type": "gauge",
            "help": "Size of queue for pending connections",
            "data": [
                {
                    "labels": {
                        "node": "06475793be9d"
                    },
                    "value": 128
                }
            ]
        },
        "web_idle_processes": {
            "type": "gauge",
            "help": "Current number of idle processes",
            "data": [
                {
                    "labels": {
                        "node": "06475793be9d"
                    },
                    "value": 10
                }
            ]
        },
        "web_total_processes": {
            "type": "gauge",
            "help": "Total process limit",
            "data": [
                {
                    "labels": {
                        "node": "06475793be9d"
                    },
                    "value": 12
                }
            ]
        },
        "web_process_limit_hit": {
            "type": "counter",
            "help": "Total number of times reached process limit",
            "data": [
                {
                    "labels": {
                        "node": "06475793be9d"
                    },
                    "value": 0
                }
            ]
        },
        "web_handled_requests": {
            "type": "counter",
            "help": "Total number of requests handled",
            "data": [
                {
                    "labels": {
                        "node": "06475793be9d"
                    },
                    "value": 29841
                }
            ]
        },
        "web_out_kbytes": {
            "type": "counter",
            "help": "Total outgoing traffic in kbytes",
            "data": [
                {
                    "labels": {
                        "node": "06475793be9d"
                    },
                    "value": 115529
                }
            ]
        },
        "web_requests": {
            "type": "gauge",
            "help": "Number of ongoing requests",
            "data": [
                {
                    "labels": {
                        "node": "06475793be9d",
                        "state": "read"
                    },
                    "value": 1
                },
                {
                    "labels": {
                        "node": "06475793be9d",
                        "state": "handle-request"
                    },
                    "value": 2
                },
            ]
        },
        "api_requests_duration_ms_sum": {
            "type": "counter",
            "help": "Total number of durations of API requests",
            "data": [
                {
                    "labels": {
                        "node": "06475793be9d",
                        "result": "200",
                        "method": "GET_v1_groups"
                    },
                    "value": 753
                },
                {
                    "labels": {
                        "node": "06475793be9d",
                        "result": "200",
                        "method": "POST_v1_settings_backup"
                    },
                    "value": 1255
                },
                {
                    "labels": {
                        "node": "06475793be9d",
                        "result": "200",
                        "method": "PATCH_v1_settings_application"
                    },
                    "value": 491
                },
                ...
            ]
        },
        "api_requests_duration_ms_count": {
            "type": "counter",
            "help": "Total number of API requests",
            "data": [
                {
                    "labels": {
                        "node": "06475793be9d",
                        "result": "401",
                        "method": "GET_v1_settings_application"
                    },
                    "value": 30
                },
                {
                    "labels": {
                        "node": "06475793be9d",
                        "result": "200",
                        "method": "GET_metrics"
                    },
                    "value": 5937
                },
                {
                    "labels": {
                        "node": "06475793be9d",
                        "result": "404",
                        "method": "POST_v1_users_login"
                    },
                    "value": 1
                },
            ]
        },
        "api_requests_db_duration_ms_sum": {
            "type": "counter",
            "help": "Total time spent in making DB calls",
            "data": [
                {
                    "labels": {
                        "node": "06475793be9d",
                        "query": "connect",
                        "result": "ok",
                        "method": "POST_v1_users_login"
                    },
                    "value": 0
                },
                {
                    "labels": {
                        "node": "06475793be9d",
                        "query": "executeQuery",
                        "result": "ok",
                        "method": "GET_v1_groups"
                    },
                    "value": 16
                },
                {
                    "labels": {
                        "node": "06475793be9d",
                        "query": "connect",
                        "result": "ok",
                        "method": "POST_v1_media"
                    },
                    "value": 3
                },
                ...
            ]
        },
        "api_requests_db_duration_ms_count": {
            "type": "counter",
            "help": "Total number of calls to the DB",
            "data": [
                {
                    "labels": {
                        "node": "06475793be9d",
                        "query": "connect",
                        "result": "ok",
                        "method": "GET_v1_stats_db"
                    },
                    "value": 548
                },
                {
                    "labels": {
                        "node": "06475793be9d",
                        "query": "executeUpdate",
                        "result": "ok",
                        "method": "POST_v1_users_login"
                    },
                    "value": 51
                },
                {
                    "labels": {
                        "node": "06475793be9d",
                        "query": "connect",
                        "result": "ok",
                        "method": "PATCH_v1_settings_application"
                    },
                    "value": 38
                },
                ...
            ]
        },
        "api_requests_coreapp_duration_ms_sum": {
            "type": "counter",
            "help": "Total time spent in making CoreApp calls",
            "data": [
                {
                    "labels": {
                        "node": "06475793be9d",
                        "coreapp": "wacore:6252",
                        "result": "ok",
                        "method": "GET_v1_stats_db"
                    },
                    "value": 2934
                },
                {
                    "labels": {
                        "node": "06475793be9d",
                        "coreapp": "wacore:6252",
                        "result": "ok",
                        "method": "GET_v1_health"
                    },
                    "value": 2083
                },
                {
                    "labels": {
                        "node": "06475793be9d",
                        "coreapp": "wacore:6252",
                        "result": "ok",
                        "method": "PATCH_v1_settings_application"
                    },
                    "value": 328
                },
                ...
            ]
        },
        "api_requests_coreapp_duration_ms_count": {
            "type": "counter",
            "help": "Total number of calls to the CoreApp",
            "data": [
                {
                    "labels": {
                        "node": "06475793be9d",
                        "coreapp": "wacore:6252",
                        "result": "ok",
                        "method": "GET_v1_stats_db"
                    },
                    "value": 274
                },
                {
                    "labels": {
                        "node": "06475793be9d",
                        "coreapp": "wacore:6252",
                        "result": "ok",
                        "method": "POST_v1_settings_backup"
                    },
                    "value": 14
                },
                {
                    "labels": {
                        "node": "06475793be9d",
                        "coreapp": "wacore:6252",
                        "result": "ok",
                        "method": "GET_v1_settings_application"
                    },
                    "value": 4
                },
                ...
            ]
        }
    },
    "meta": {
        "version": "v2.21.1",
        "api_status": "stable"
    }
}

Parameters

NameTypeDescription

web_uptime

Object

Number of seconds since web server has started

web_connections

Object

Total number of connections accepted

web_pending_connections

Object

Current number of pending connections in the queue

web_max_pending_connections

Object

Maximum number of pending connections in the queue

web_queue_len

Object

Size of queue for pending connections

web_idle_processes

Object

Current number of idle processes

web_total_processes

Object

Total process limit

web_process_limit_hit

Object

Total number of times reached process limit

web_handled_requests

Object

Total number of requests handled

web_out_kbytes

Object

Total outgoing traffic in kbytes

web_requests

Object

Number of ongoing requests at different state

api_requests_duration_ms_sum

Object

Total number of durations of API requests

api_requests_duration_ms_count

Object

Total number of API requests

api_requests_db_duration_ms_sum

Object

Total time spent in making DB calls for each API

api_requests_db_duration_ms_count

Object

Total number of calls to the DB for each API

api_requests_coreapp_duration_ms_sum

Object

Total time spent in making CoreApp calls for each API

api_requests_coreapp_duration_ms_count

Object

Total number of calls to the CoreApp for each API

Prometheus

Returns the Webapp data in Prometheus format.

Request

GET /metrics?format=prometheus

Response

As an example, the response might look like this:

# HELP web_uptime Number of seconds since web server has started
# TYPE web_uptime gauge
web_uptime{node="06475793be9d"} 349141
# HELP web_connections Total number of connections accepted
# TYPE web_connections counter
web_connections{node="06475793be9d"} 23933
# HELP web_pending_connections Current number of pending connections in the queue
# TYPE web_pending_connections gauge
web_pending_connections{node="06475793be9d"} 0
# HELP web_max_pending_connections Maximum number of pending connections in the queue
# TYPE web_max_pending_connections gauge
web_max_pending_connections{node="06475793be9d"} 10
# HELP web_queue_len Size of queue for pending connections
# TYPE web_queue_len gauge
web_queue_len{node="06475793be9d"} 128
# HELP web_idle_processes Current number of idle processes
# TYPE web_idle_processes gauge
web_idle_processes{node="06475793be9d"} 10
# HELP web_total_processes Total process limit
# TYPE web_total_processes gauge
web_total_processes{node="06475793be9d"} 12
# HELP web_process_limit_hit Total number of times reached process limit
# TYPE web_process_limit_hit counter
web_process_limit_hit{node="06475793be9d"} 0
# HELP web_handled_requests Total number of requests handled
# TYPE web_handled_requests counter
web_handled_requests{node="06475793be9d"} 30054
# HELP web_out_kbytes Total outgoing traffic in kbytes
# TYPE web_out_kbytes counter
web_out_kbytes{node="06475793be9d"} 116726
# HELP web_requests Number of ongoing requests
# TYPE web_requests gauge
web_requests{node="06475793be9d",state="read"} 1
web_requests{node="06475793be9d",state="handle-request"} 2
web_requests{node="06475793be9d",state="idle"} 125
# HELP api_requests_duration_ms_sum Total number of durations of API requests
# TYPE api_requests_duration_ms_sum counter
api_requests_duration_ms_sum{node="06475793be9d",result="200",method="GET_v1_groups"} 753
api_requests_duration_ms_sum{node="06475793be9d",result="200",method="POST_v1_settings_backup"} 1255
api_requests_duration_ms_sum{node="06475793be9d",result="200",method="GET_metrics"} 249121
...
# HELP api_requests_duration_ms_count Total number of API requests
# TYPE api_requests_duration_ms_count counter
api_requests_duration_ms_count{node="06475793be9d",result="401",method="GET_v1_settings_application"} 30
api_requests_duration_ms_count{node="06475793be9d",result="200",method="GET_metrics"} 5998
api_requests_duration_ms_count{node="06475793be9d",result="404",method="POST_v1_users_login"} 1
...
# HELP api_requests_db_duration_ms_sum Total time spent in making DB calls
# TYPE api_requests_db_duration_ms_sum counter
api_requests_db_duration_ms_sum{node="06475793be9d",query="connect",result="ok",method="POST_v1_users_login"} 0
api_requests_db_duration_ms_sum{node="06475793be9d",query="executeQuery",result="ok",method="GET_v1_groups"} 16
api_requests_db_duration_ms_sum{node="06475793be9d",query="connect",result="ok",method="POST_v1_media"} 3
...
# HELP api_requests_db_duration_ms_count Total number of calls to the DB
# TYPE api_requests_db_duration_ms_count counter
api_requests_db_duration_ms_count{node="06475793be9d",query="connect",result="ok",method="GET_v1_stats_db"} 548
api_requests_db_duration_ms_count{node="06475793be9d",query="executeUpdate",result="ok",method="POST_v1_users_login"} 51
api_requests_db_duration_ms_count{node="06475793be9d",query="connect",result="ok",method="PATCH_v1_settings_application"} 38
...
# HELP api_requests_coreapp_duration_ms_sum Total time spent in making CoreApp calls
# TYPE api_requests_coreapp_duration_ms_sum counter
api_requests_coreapp_duration_ms_sum{node="06475793be9d",coreapp="wacore:6252",result="ok",method="GET_v1_stats_db"} 2934
api_requests_coreapp_duration_ms_sum{node="06475793be9d",coreapp="wacore:6252",result="ok",method="GET_v1_health"} 2090
api_requests_coreapp_duration_ms_sum{node="06475793be9d",coreapp="wacore:6252",result="ok",method="PATCH_v1_settings_application"} 328
...
# HELP api_requests_coreapp_duration_ms_count Total number of calls to the CoreApp
# TYPE api_requests_coreapp_duration_ms_count counter
api_requests_coreapp_duration_ms_count{node="06475793be9d",coreapp="wacore:6252",result="ok",method="GET_v1_stats_db"} 274
api_requests_coreapp_duration_ms_count{node="06475793be9d",coreapp="wacore:6252",result="ok",method="POST_v1_settings_backup"} 14
api_requests_coreapp_duration_ms_count{node="06475793be9d",coreapp="wacore:6252",result="ok",method="GET_v1_settings_application"} 4
...