Export a metric with connected agents versions
Option 1
Each kas instance should export an Int64UpDownCounter
(https://opentelemetry.io/docs/specs/otel/metrics/api/#updowncounter) that it increments and decrements when an agent connects. Agent version is put into an attribute. It'd be easiest to do it in the agent_configuration
module. Conceptually this metric represents a number per version per kas instance.
Option 2
If we want to provide this information as an API, then we'd do it in a different way: in the agent_registrar
module. In that case information should be persisted in Redis and eventually expired to clean it up. We can use a hash with versions + a hash per version. GC each of those + use HLEN to get the number of agents per version.
Store agent id
and pod id
as hash value. That way we can later build an API to get a list of outdated agents+pods (if some agent Pods are outdated).
Proposed solution
Option 2. That way we have both an API and a metric. API can come in handy later if we want to build an admin dashboard. This can be a instance-wide dashboard or group/project dashboard.