Add a new agent status when connecting to the cloud (#19564)
Add a new status "connecting" to the cloud
Stelios Fragkakis committed
Feb 3, 2025 at 19:22 UTC
a8e1f3f0cde209414947f7c7d0f1e81e2954d827
2 files changed
+10
-2
src/claim/cloud-status.c
+9
-2
@@ -17,6 +17,9 @@ const char *cloud_status_to_string(CLOUD_STATUS status) {
17
case CLOUD_STATUS_ONLINE:
18
return "online";
19
20
+ case CLOUD_STATUS_CONNECTING:
21
+ return "connecting";
22
+
23
case CLOUD_STATUS_INDIRECT:
24
return "indirect";
25
}
@@ -26,8 +29,12 @@ CLOUD_STATUS cloud_status(void) {
29
if(unlikely(aclk_disable_runtime))
30
return CLOUD_STATUS_BANNED;
31
29
- if(likely(aclk_online()))
30
- return CLOUD_STATUS_ONLINE;
32
+ if(likely(aclk_online())) {
33
+ if (rrdhost_flag_check(localhost, RRDHOST_FLAG_ACLK_STREAM_CONTEXTS))
34
+ return CLOUD_STATUS_ONLINE;
35
+ else
36
+ return CLOUD_STATUS_CONNECTING;
37
+ }
38
39
if(localhost->sender &&
40
rrdhost_flag_check(localhost, RRDHOST_FLAG_STREAM_SENDER_READY_4_METRICS) &&
src/claim/cloud-status.h
+1
@@ -10,6 +10,7 @@ typedef enum __attribute__((packed)) {
10
CLOUD_STATUS_BANNED, // the agent has been banned from cloud
11
CLOUD_STATUS_OFFLINE, // the agent tries to connect to cloud, but cannot do it
12
CLOUD_STATUS_INDIRECT, // the agent is connected to cloud via a parent
13
+ CLOUD_STATUS_CONNECTING, // the agent is connecting
14
CLOUD_STATUS_ONLINE, // the agent is connected to cloud
15
} CLOUD_STATUS;
16