mirror of
https://github.com/nanomq/nanomq.git
synced 2025-06-22 01:57:27 +00:00
* NEW [rest/api] HTTP API produce out bridging metrics
Signed-off-by: jaylin <jaylin@emqx.io>
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
#define NANO_VER_MAJOR 0
|
||||
#define NANO_VER_MINOR 23
|
||||
#define NANO_VER_PATCH 2
|
||||
#define NANO_VER_ID_SHORT "2"
|
||||
|
||||
#define NANO_VER_ID_SHORT "2"
|
@ -1566,21 +1566,16 @@ get_metrics(http_msg *msg, kv **params, size_t param_num,
|
||||
// st2 = nng_stat_find_pipe(nng_stats, pipe);
|
||||
// nng_stats_dump(st2);
|
||||
// }
|
||||
nng_stats_dump(st1);
|
||||
nng_stat *child = NULL;
|
||||
|
||||
cJSON *bridge_info = cJSON_CreateObject();
|
||||
child = nng_stat_find(st1, "name");
|
||||
log_info("%s", nng_stat_desc(child));
|
||||
log_info("%s", nng_stat_string(child));
|
||||
if (child) {
|
||||
cJSON_AddStringToObject(bridge_info,
|
||||
nng_stat_desc(child),
|
||||
"bridge name",
|
||||
nng_stat_string(child));
|
||||
}
|
||||
child = nng_stat_find(st1, "tx_msgs");
|
||||
if (child) {
|
||||
log_info("%s", nng_stat_desc(child));
|
||||
cJSON_AddNumberToObject(bridge_info,
|
||||
nng_stat_desc(child),
|
||||
nng_stat_value(child));
|
||||
@ -1603,7 +1598,24 @@ get_metrics(http_msg *msg, kv **params, size_t param_num,
|
||||
nng_stat_desc(child),
|
||||
nng_stat_value(child));
|
||||
}
|
||||
// cJSON_AddNumberToObject(subscribe, "qos", tq->qos);
|
||||
child = nng_stat_find(st1, "mqtt_client_reconnect");
|
||||
if (child) {
|
||||
cJSON_AddNumberToObject(bridge_info,
|
||||
nng_stat_desc(child),
|
||||
nng_stat_value(child));
|
||||
}
|
||||
child = nng_stat_find(st1, "mqtt_msg_send_drop");
|
||||
if (child) {
|
||||
cJSON_AddNumberToObject(bridge_info,
|
||||
nng_stat_desc(child),
|
||||
nng_stat_value(child));
|
||||
}
|
||||
child = nng_stat_find(st1, "mqtt_msg_recv_drop");
|
||||
if (child) {
|
||||
cJSON_AddNumberToObject(bridge_info,
|
||||
nng_stat_desc(child),
|
||||
nng_stat_value(child));
|
||||
}
|
||||
cJSON_AddItemToArray(metrics, bridge_info);
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ extern void put_http_msg(http_msg *msg, const char *content_type,
|
||||
const char *method, const char *uri, const char *token, const char *data,
|
||||
size_t data_sz);
|
||||
extern void destory_http_msg(http_msg *msg);
|
||||
extern http_msg process_request(http_msg *msg, proxy_info *proxy);
|
||||
extern http_msg process_request_cli(http_msg *msg, proxy_info *proxy);
|
||||
|
||||
#define GET_METHOD "GET"
|
||||
#define POST_METHOD "POST"
|
||||
|
Reference in New Issue
Block a user