summaryrefslogtreecommitdiffstats
path: root/aclk
diff options
context:
space:
mode:
authorTimotej S <6674623+underhood@users.noreply.github.com>2023-03-31 05:11:53 +0700
committerGitHub <noreply@github.com>2023-03-31 01:11:53 +0300
commitc09dbb224aded790c591e0ce3aa0d717264da908 (patch)
tree6622da475e07d5d4eb3c7614ac7536c62520c96c /aclk
parentec5c038f2ca3f665490887f6c690445e93c27a33 (diff)
minor - add capability signifying this agent can speak apiv2 (#14817)
* capa apiv2 * build new cancellation proto * commited on wrong branch :D Revert "build new cancellation proto" This reverts commit 8290422de4074b9c383e29ad10e041668056679a. * use common source of truth for capas in apiv2 * fix for possible races
Diffstat (limited to 'aclk')
-rw-r--r--aclk/aclk_capas.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/aclk/aclk_capas.c b/aclk/aclk_capas.c
index 290e7d8f4d..e25088e231 100644
--- a/aclk/aclk_capas.c
+++ b/aclk/aclk_capas.c
@@ -7,13 +7,14 @@
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 = "ctx", .version = 1, .enabled = 1 },
- { .name = "funcs", .version = 1, .enabled = 1 },
- { .name = NULL, .version = 0, .enabled = 0 }
+ { .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 = "ctx", .version = 1, .enabled = 1 },
+ { .name = "funcs", .version = 1, .enabled = 1 },
+ { .name = "http_api_v2", .version = 1, .enabled = 1 },
+ { .name = NULL, .version = 0, .enabled = 0 }
};
agent_capabilities[2].version = ml_capable() ? 1 : 0;
agent_capabilities[2].enabled = ml_enabled(localhost);
@@ -27,21 +28,24 @@ const struct capability *aclk_get_agent_capas()
struct capability *aclk_get_node_instance_capas(RRDHOST *host)
{
struct capability ni_caps[] = {
- { .name = "proto", .version = 1, .enabled = 1 },
- { .name = "ml", .version = ml_capable(), .enabled = ml_enabled(host) },
+ { .name = "proto", .version = 1, .enabled = 1 },
+ { .name = "ml", .version = ml_capable(), .enabled = ml_enabled(host) },
{ .name = "mc",
.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 = NULL, .version = 0, .enabled = 0 }
+ { .name = "ctx", .version = 1, .enabled = 1 },
+ { .name = "funcs", .version = 0, .enabled = 0 },
+ { .name = "http_api_v2", .version = 1, .enabled = 1 },
+ { .name = NULL, .version = 0, .enabled = 0 }
};
- if (host == localhost || (host->receiver && stream_has_capability(host->receiver, STREAM_CAP_FUNCTIONS))) {
- ni_caps[4].version = 1;
- ni_caps[4].enabled = 1;
- }
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;
}