نحن بصدد إنهاء API داخل المواقع. راجع مستند حالة إنهاء API داخل المواقع للحصول على التفاصيل، والتعرف على كيفية الترحيل إلى API السحابة من الجيل القادم.
/v1/stats/app
Use the /v1/stats/app
endpoint to retrieve Coreapp stats.
Make a GET
call the /v1/stats/app
endpoint to retrieve Coreapp stats in JSON or Prometheus format. Coreapp stats live in memory and can be queried at regular intervals if needed.
Request to retrieve Coreapp stats in JSON format:
GET /v1/stats/app { Authorization: Bearer auth-token | Apikey api-key-token }
If successful, your request returns 200 OK
and a message body containing an app
object.
You get the following response for single instance:
"stats": { "app": { "callback_queue_size": { "data": [ { "value": 450 } ], "help": "Current callback queue size", "type": "gauge" }, "callback_requests_duration_ms_count": { "data": [ { "labels": { "result": "success", "type": "inbound_message" }, "value": 2 }, { "labels": { "result": "1", "type": "status_change" }, "value": 28 } ], "help": "Total number of callback requests", "type": "counter" }, "callback_requests_duration_ms_sum": { "data": [ { "labels": { "result": "success", "type": "inbound_message" }, "value": 32 }, { "labels": { "result": "1", "type": "status_change" }, "value": 451 } ], "help": "Total duration(ms) of callback requests", "type": "counter" }, "db_request_duration_us_count": { "data": [ { "labels": { "db": "messageStore", "request": "commit" }, "value": 5 }, { "labels": { "db": "_jobqueue-WhatsApp", "request": "prepare" }, "value": 10 }, ... "help": "Total number of successful SQL queries", "type": "counter" }, "db_request_duration_us_sum": { "data": [ { "labels": { "db": "messageStore", "request": "commit" }, "value": 14967 }, { "labels": { "db": "_jobqueue-WhatsApp", "request": "prepare" }, "value": 4236 },... "help": "Total duration(microseconds) of successful SQL queries", "type": "counter" }, "endpoint_requests": { "data": [ { "labels": { "method": "contacts", "result": "ok" }, "value": 3864 }, { "labels": { "method": "messaging", "result": "ok" }, "value": 3576 }, { "labels": { "method": "messaging", "result": "1020" }, "value": 15 }, { "labels": { "method": "control", "result": "ok" }, "value": 4169 } ], "help": "Total number of endpoint requests made", "type": "counter" }, "endpoint_requests_duration_ms_count": { "data": [ { "labels": { "method": "app_stats", "result": "ok" }, "value": 1 }, ... ], "help": "Total number of endpoint requests", "type": "counter" }, "endpoint_requests_duration_ms_sum": { "data": [ { "labels": { "method": "app_stats", "result": "ok" }, "value": 2 }, ... ], "help": "Total duration(ms) of endpoint requests", "type": "counter" }, "in_message_decoded": { "data": [ { "labels": { "type": "image" }, "value": 1 }, { "labels": { "type": "undefined" }, "value": 8 } ], "help": "Total number of incoming messages", "type": "counter" }, "in_message_from_server": { "data": [ { "value": 9 } ], "help": "Total number of incoming encrypted messages from server", "type": "counter" }, "in_message_persisted": { "data": [ { "labels": { "type": "image" }, "value": 1 }, { "labels": { "type": "system" }, "value": 3350 }, { "labels": { "type": "undefined" }, "value": 8 } ], "help": "Total number of incoming messages cached in DB", "type": "counter" }, "in_messages_pending_processing": { "data": [ { "value": 0 } ], "help": "Number of encrypted messages received yet to be processed", "type": "gauge" }, "internal_server_conn_duration_ms_count": { "data": [ { "labels": { "result": "Connected" }, "value": 1 } ], "help": "Total number of internal server connection requests made", "type": "counter" }, "internal_server_conn_duration_ms_sum": { "data": [ { "labels": { "result": "Connected" }, "value": 584 } ], "help": "Total time spent in connecting to internal server in ms", "type": "counter" }, "internal_server_requests_duration_ms_count": { "data": [ { "labels": { "operation": "FieldStatsResult", "result": "ok" }, "value": 2 }, { "labels": { "operation": "GetPrivacyListResult", "result": "404" }, "value": 1 },... "help": "Number of internal server requests", "type": "counter" }, "internal_server_requests_duration_ms_sum": { "data": [ { "labels": { "operation": "FieldStatsResult", "result": "ok" }, "value": 158 }, { "labels": { "operation": "GetPrivacyListResult", "result": "404" }, "value": 347 },... "help": "Duration of internal server requests", "type": "counter" }, "media_downloads": { "data": [ { "labels": { "result": "unknown", "type": "image" }, "value": 1 } ], "help": "Total number of media messages downloaded from server", "type": "counter" }, "media_uploads": { "data": [ { "labels": { "result": "ok", "type": "audio" }, "value": 95 }, { "labels": { "result": "ok", "type": "document" }, "value": 145 }, { "labels": { "result": "ok", "type": "image" }, "value": 81 } ], "help": "Total number of media messages uploaded to server", "type": "counter" }, "out_message_persisted": { "data": [ { "labels": { "type": "document" }, "value": 145 }, { "labels": { "type": "audio" }, "value": 95 }, { "labels": { "type": "image" }, "value": 81 }, { "labels": { "type": "undefined" }, "value": 79 }, { "labels": { "type": "hsm" }, "value": 3176 } ], "help": "Total number of outgoing messages cached in DB", "type": "counter" }, "out_message_sent_duration_ms_count": { "data": [ { "labels": { "retry": "0", "type": "hsm" }, "value": 3576 }, ... ], "help": "Total number of messages sent to server successfully", "type": "counter" }, "out_message_sent_duration_ms_sum": { "data": [ { "labels": { "retry": "0", "type": "hsm" }, "value": 536433 }, ... ], "help": "Total number of durations used to send messages to server", "type": "counter" }, "out_message_status": { "data": [ { "labels": { "status": "delivered" }, "value": 1034 }, { "labels": { "status": "sent" }, "value": 3576 }, { "labels": { "status": "read" }, "value": 1034 } ], "help": "Total number of outgoing messages of a particular status", "type": "counter" }, "pending_callbacks": { "data": [ { "labels": { "type": "inbound_message" }, "value": 8 }, { "labels": { "type": "status_change" }, "value": 442 } ], "help": "Current number of pending callbacks in the queue", "type": "gauge" }, "pending_messages": { "data": [ { "value": 0 } ], "help": "Current number of pending messages in the queue", "type": "gauge" } } }
You get the following response for high availability/multiconnect:
{ "stats": { "app": { "your-hostname1:your-container-id1":{ "callback_queue_size": { "data": [ {"value": 450} ], "help": "Current callback queue size", "type": "gauge" }, ... }, "your-hostname2:your-container-id2":{ "callback_queue_size": { "data": [ {"value": 10} ], "help": "Current callback queue size", "type": "gauge" }, ... }, ... } } }
Request to retrieve Coreapp stats in Prometheus format:
GET /v1/stats/app?format=prometheus { Authorization: Bearer your-auth-token | Apikey your-api-key-token }
You get the following response for single instance:
# HELP callback_queue_size Current callback queue size # TYPE callback_queue_size gauge callback_queue_size 450 # HELP callback_requests_duration_ms_count Total number of callback requests # TYPE callback_requests_duration_ms_count counter callback_requests_duration_ms_count{result="success",type="inbound_message"} 2 callback_requests_duration_ms_count{result="1",type="status_change"} 28 # HELP callback_requests_duration_ms_sum Total duration(ms) of callback requests # TYPE callback_requests_duration_ms_sum counter callback_requests_duration_ms_sum{result="success",type="inbound_message"} 32 callback_requests_duration_ms_sum{result="1",type="status_change"} 451 # HELP db_request_duration_us_count Total number of successful SQL queries # TYPE db_request_duration_us_count counter db_request_duration_us_count{db="messageStore",request="commit"} 5 db_request_duration_us_count{db="_jobqueue-WhatsApp",request="prepare"} 10 ... # HELP db_request_duration_us_sum Total duration(microseconds) of successful SQL queries # TYPE db_request_duration_us_sum counter db_request_duration_us_sum{db="messageStore",request="commit"} 14967 db_request_duration_us_sum{db="_jobqueue-WhatsApp",request="prepare"} 4236 ... # HELP endpoint_requests Total number of endpoint requests made # TYPE endpoint_requests counter endpoint_requests{method="contacts",result="ok"} 3864 endpoint_requests{method="messaging",result="ok"} 3576 endpoint_requests{method="messaging",result="1020"} 15 endpoint_requests{method="control",result="ok"} 4262 # HELP endpoint_requests_duration_ms_count Total number of endpoint requests # TYPE endpoint_requests_duration_ms_count counter endpoint_requests_duration_ms_count{method="app_stats",result="ok"} 1 ... # HELP endpoint_requests_duration_ms_sum Total duration(ms) of endpoint requests # TYPE endpoint_requests_duration_ms_sum counter endpoint_requests_duration_ms_sum{method="app_stats",result="ok"} 2 ... # HELP in_message_decoded Total number of incoming messages # TYPE in_message_decoded counter in_message_decoded{type="image"} 1 in_message_decoded{type="undefined"} 8 # HELP in_message_from_server Total number of incoming encrypted messages from server # TYPE in_message_from_server counter in_message_from_server 9 # HELP in_message_persisted Total number of incoming messages cached in DB # TYPE in_message_persisted counter in_message_persisted{type="image"} 1 in_message_persisted{type="system"} 3350 in_message_persisted{type="undefined"} 8 # HELP in_messages_pending_processing Number of encrypted messages received yet to be processed # TYPE in_messages_pending_processing gauge in_messages_pending_processing 0 # HELP internal_server_conn_duration_ms_count Total number of internal server connection requests made # TYPE internal_server_conn_duration_ms_count counter internal_server_conn_duration_ms_count{result="Connected"} 1 # HELP internal_server_conn_duration_ms_sum Total time spent in connecting to internal server in ms # TYPE internal_server_conn_duration_ms_sum counter internal_server_conn_duration_ms_sum{result="Connected"} 584 # HELP internal_server_requests_duration_ms_count Number of internal server requests # TYPE internal_server_requests_duration_ms_count counter internal_server_requests_duration_ms_count{operation="FieldStatsResult",result="ok"} 2 internal_server_requests_duration_ms_count{operation="GetPrivacyListResult",result="404"} 1 ... # HELP internal_server_requests_duration_ms_sum Duration of internal server requests # TYPE internal_server_requests_duration_ms_sum counter internal_server_requests_duration_ms_sum{operation="FieldStatsResult",result="ok"} 158 internal_server_requests_duration_ms_sum{operation="GetPrivacyListResult",result="404"} 347 ... # HELP media_downloads Total number of media messages downloaded from server # TYPE media_downloads counter media_downloads{result="unknown",type="image"} 1 # HELP media_uploads Total number of media messages uploaded to server # TYPE media_uploads counter media_uploads{result="ok",type="audio"} 95 media_uploads{result="ok",type="document"} 145 media_uploads{result="ok",type="image"} 81 # HELP out_message_persisted Total number of outgoing messages cached in DB # TYPE out_message_persisted counter out_message_persisted{type="document"} 145 out_message_persisted{type="audio"} 95 out_message_persisted{type="image"} 81 out_message_persisted{type="undefined"} 79 out_message_persisted{type="hsm"} 3176 # HELP out_message_sent_duration_ms_count Total number of messages sent to server successfully # TYPE out_message_sent_duration_ms_count counter out_message_sent_duration_ms_count{retry="0",type="hsm"} 3576 ... # HELP out_message_sent_duration_ms_sum Total number of durations used to send messages to server # TYPE out_message_sent_duration_ms_sum counter out_message_sent_duration_ms_sum{retry="0",type="hsm"} 536433 ... # HELP out_message_status Total number of outgoing messages of a particular status # TYPE out_message_status counter out_message_status{status="delivered"} 1034 out_message_status{status="sent"} 3576 out_message_status{status="read"} 1034 # HELP pending_callbacks Current number of pending callbacks in the queue # TYPE pending_callbacks gauge pending_callbacks{type="inbound_message"} 8 pending_callbacks{type="status_change"} 442 # HELP pending_messages Current number of pending messages in the queue # TYPE pending_messages gauge pending_messages 0
You get the following response for high availability/multiconnect:
# HELP callback_queue_size Current callback queue size # TYPE callback_queue_size gauge callback_queue_size{node="your-hostname1:your-container-id1"} 0 callback_queue_size{node="your-hostname2:your-container-id2"} 0 ...
Name | Description |
---|---|
type: Object | Current callback queue size. |
type: Object | Total number of callback requests made and result. |
type: Object | Total duration (ms) of callback requests. |
type: Object | Current number of concurrent rate limit triggers. |
type: Object | Total number of successful SQL queries. |
type: Object | Total duration (microseconds) of successful SQL queries. |
type: Object | Total number of failed SQL queries. |
type: Object | Total duration(microseconds) of failed SQL queries. |
type: Object | Total number of endpoint requests made for a given endpoint and result (either |
type: Object | Total number of endpoint requests. |
type: Object | Total duration (ms) of endpoint requests. |
type: Object | Total number of incoming messages decrypted successfully. |
type: Object | Total number of incoming encrypted messages from server. |
type: Object | Total number of incoming messages cached in the database. |
type: Object | Number of encrypted messages received yet to be processed. |
type: Object | Total number of internal server connection requests made. |
type: Object | Total duration (ms) spent in connecting to internal server in ms. |
type: Object | Total number of internal server requests. |
type: Object | Total duration(ms) of internal server requests. |
type: Object | Total number of media files downloaded from server. |
type: Object | Total number of media files uploaded to server. |
type: Object | Total number of outgoing messages cached in the database. |
type: Object | Total number of outgoing messages of a particular status. |
type: Object | Total number of messages sent to server successfully. |
type: Object | Total duration (ms) used to send messages to server. |
type: Object | Current number of pending callbacks in the queue for each callback type. |
type: Object | Current number of pending messages in the queue. |
type: Object | Current number of per second request rate limit triggers. |
type: Object | Current number of per hour request rate limit triggers. |
type: Object | Current number of per day request rate limit triggers. |
type: Object | Current number of per day contact scrape limit triggers. |
* These response fields are available beginning with v2.21.3
.