Add connected agents metric
What does this MR do and why?
Adds a new metric to count the number of currently connected agents.
Query changes
The following queries are generated by distinct_count
. All queries are able to use the existing index_cluster_agent_tokens_on_agent_id_status_last_used_at
:
Min - explain:
SELECT
MIN(
"cluster_agent_tokens"."agent_id"
)
FROM
"cluster_agent_tokens"
WHERE
"cluster_agent_tokens"."status" = 0
AND (
last_used_at > '2023-08-07 02:13:14.220756'
)
Max - explain:
SELECT
MAX(
"cluster_agent_tokens"."agent_id"
)
FROM
"cluster_agent_tokens"
WHERE
"cluster_agent_tokens"."status" = 0
AND (
last_used_at > '2023-08-07 02:13:14.220756'
)
Batch - explain:
SELECT
COUNT(
"cluster_agent_tokens"."agent_id"
)
FROM
"cluster_agent_tokens"
WHERE
"cluster_agent_tokens"."status" = 0
AND (
last_used_at > '2023-08-22 03:10:04'
)
AND "cluster_agent_tokens"."agent_id" >= 0
AND "cluster_agent_tokens"."agent_id" < 10000
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to https://gitlab.com/gitlab-org/configure/general/-/issues/297
Edited by Tiger Watson