diff options
Diffstat (limited to 'aclk/aclk_capas.c')
-rw-r--r-- | aclk/aclk_capas.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/aclk/aclk_capas.c b/aclk/aclk_capas.c index b38a928a..e8d85a2b 100644 --- a/aclk/aclk_capas.c +++ b/aclk/aclk_capas.c @@ -4,17 +4,19 @@ #include "ml/ml.h" +#define HTTP_API_V2_VERSION 6 + const struct capability *aclk_get_agent_capas() { static struct capability agent_capabilities[] = { { .name = "json", .version = 2, .enabled = 0 }, { .name = "proto", .version = 1, .enabled = 1 }, - { .name = "ml", .version = 0, .enabled = 0 }, - { .name = "mc", .version = 0, .enabled = 0 }, + { .name = "ml", .version = 0, .enabled = 0 }, // index 2, below + { .name = "mc", .version = 0, .enabled = 0 }, // index 3, below { .name = "ctx", .version = 1, .enabled = 1 }, { .name = "funcs", .version = 1, .enabled = 1 }, - { .name = "http_api_v2", .version = 3, .enabled = 1 }, - { .name = "health", .version = 1, .enabled = 0 }, + { .name = "http_api_v2", .version = HTTP_API_V2_VERSION, .enabled = 1 }, + { .name = "health", .version = 1, .enabled = 0 }, // index 7, below { .name = "req_cancel", .version = 1, .enabled = 1 }, { .name = NULL, .version = 0, .enabled = 0 } }; @@ -31,6 +33,8 @@ const struct capability *aclk_get_agent_capas() struct capability *aclk_get_node_instance_capas(RRDHOST *host) { + bool functions = (host == localhost || (host->receiver && stream_has_capability(host->receiver, STREAM_CAP_FUNCTIONS))); + struct capability ni_caps[] = { { .name = "proto", .version = 1, .enabled = 1 }, { .name = "ml", .version = ml_capable(), .enabled = ml_enabled(host) }, @@ -38,8 +42,8 @@ struct capability *aclk_get_node_instance_capas(RRDHOST *host) .version = enable_metric_correlations ? metric_correlations_version : 0, .enabled = enable_metric_correlations }, { .name = "ctx", .version = 1, .enabled = 1 }, - { .name = "funcs", .version = 0, .enabled = 0 }, - { .name = "http_api_v2", .version = 3, .enabled = 1 }, + { .name = "funcs", .version = functions ? 1 : 0, .enabled = functions ? 1 : 0 }, + { .name = "http_api_v2", .version = HTTP_API_V2_VERSION, .enabled = 1 }, { .name = "health", .version = 1, .enabled = host->health.health_enabled }, { .name = "req_cancel", .version = 1, .enabled = 1 }, { .name = NULL, .version = 0, .enabled = 0 } @@ -48,10 +52,5 @@ struct capability *aclk_get_node_instance_capas(RRDHOST *host) struct capability *ret = mallocz(sizeof(ni_caps)); memcpy(ret, ni_caps, sizeof(ni_caps)); - if (host == localhost || (host->receiver && stream_has_capability(host->receiver, STREAM_CAP_FUNCTIONS))) { - ret[4].version = 1; - ret[4].enabled = 1; - } - return ret; } |