Add kubernetes_agents usage metric
What does this MR do?
Related issue: #219716 (closed)
SQL:
[1] pry(main)> Gitlab::UsageData.count(::Clusters::Agent)
(4.1ms) SELECT MIN("cluster_agents"."id") FROM "cluster_agents"
(0.3ms) SELECT MAX("cluster_agents"."id") FROM "cluster_agents"
(0.2ms) SELECT COUNT("cluster_agents"."id") FROM "cluster_agents" WHERE "cluster_agents"."id" BETWEEN $1 AND $2 [["id", 1], ["id", 100000]]
=> 1
#database-lab
plan:
explain SELECT COUNT("cluster_agents"."id") FROM "cluster_agents" WHERE "cluster_agents"."id" BETWEEN 1 AND 100000;
Aggregate (cost=7.74..7.75 rows=1 width=8) (actual time=0.044..0.044 rows=1 loops=1)
Buffers: shared hit=4
-> Index Only Scan using cluster_agents_pkey on public.cluster_agents (cost=0.15..7.73 rows=4 width=8) (actual time=0.040..0.040 rows=0 loops=1)
Index Cond: ((cluster_agents.id >= 1) AND (cluster_agents.id <= 100000))
Heap Fetches: 0
Buffers: shared hit=4
Time: 0.290 ms
- planning: 0.131 ms
- execution: 0.159 ms
- I/O read: 0.000 ms
- I/O write: 0.000 ms
Shared buffers:
- hits: 4 (~32.00 KiB) from the buffer pool
- reads: 0 from the OS file cache, including disk I/O
- dirtied: 0
- writes: 0
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry - [-] Documentation (if required)
-
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides - [-] Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process.
Edited by Thong Kuah