[Agent crash on api/v1/info call] - fixes #12559 (#12565)
* [Agent crash on api/v1/info call] - fixes #12559 returns boolean values updated swagger files
Erdem Ergen committed
Mar 31, 2022 at 00:02 UTC
382e021d47b61e050c595e999ed7c9fa378786ac
3 files changed
+19
-5
web/api/netdata-swagger.json
+6
-1
@@ -9,7 +9,7 @@
9
"/info": {
10
"get": {
11
"summary": "Get netdata basic information",
12
- "description": "The info endpoint returns basic information about netdata. It provides:\n* netdata version\n* netdata unique id\n* list of hosts mirrored (includes itself)\n* Operating System, Virtualization, K8s nodes and Container technology information\n* List of active collector plugins and modules\n* number of alarms in the host\n * number of alarms in normal state\n * number of alarms in warning state\n * number of alarms in critical state\n",
12
+ "description": "The info endpoint returns basic information about netdata. It provides:\n* netdata version\n* netdata unique id\n* list of hosts mirrored (includes itself)\n* Operating System, Virtualization, K8s nodes and Container technology information\n* List of active collector plugins and modules\n* Streaming information\n* number of alarms in the host\n * number of alarms in normal state\n * number of alarms in warning state\n * number of alarms in critical state\n",
13
"responses": {
14
"200": {
15
"description": "netdata basic information.",
@@ -1220,6 +1220,11 @@
1220
"description": "Container technology detection method.",
1221
"example": "dockerenv"
1222
},
1223
+ "stream_compression": {
1224
+ "type": "boolean",
1225
+ "description": "Stream transmission compression method.",
1226
+ "example": "true"
1227
+ },
1228
"labels": {
1229
"type": "object",
1230
"description": "List of host labels.",
web/api/netdata-swagger.yaml
+5
@@ -14,6 +14,7 @@ paths:
14
* list of hosts mirrored (includes itself)
15
* Operating System, Virtualization, K8s nodes and Container technology information
16
* List of active collector plugins and modules
17
+ * Streaming information
18
* number of alarms in the host
19
* number of alarms in normal state
20
* number of alarms in warning state
@@ -984,6 +985,10 @@ components:
985
type: string
986
description: Container technology detection method.
987
example: dockerenv
988
+ stream_compression:
989
+ type: boolean
990
+ description: Stream transmission compression method.
991
+ example: true
992
labels:
993
type: object
994
description: List of host labels.
web/api/web_api_v1.c
+8
-4
@@ -1050,11 +1050,15 @@ inline int web_client_api_request_v1_info_fill_buffer(RRDHOST *host, BUFFER *wb)
1050
buffer_strcat(wb, ",\n");
1051
1052
#ifdef ENABLE_COMPRESSION
1053
- buffer_strcat(wb, "\t\"stream-compression\": ");
1054
- buffer_strcat(wb, (host->sender->rrdpush_compression ? "\"enabled\"" : "\"disabled\""));
1055
- buffer_strcat(wb, ",\n");
1053
+ if(host->sender){
1054
+ buffer_strcat(wb, "\t\"stream-compression\": ");
1055
+ buffer_strcat(wb, (host->sender->rrdpush_compression ? "true" : "false"));
1056
+ buffer_strcat(wb, ",\n");
1057
+ }else{
1058
+ buffer_strcat(wb, "\t\"stream-compression\": null,\n");
1059
+ }
1060
#else
1057
- buffer_strcat(wb, "\t\"stream-compression\": \"N/A\",\n");
1061
+ buffer_strcat(wb, "\t\"stream-compression\": null,\n");
1062
#endif //ENABLE_COMPRESSION
1063
1064
buffer_strcat(wb, "\t\"hosts-available\": ");