GraphQL API should return runner total counter stats for instance/group/project
Description
Currently, we display one basic metric about the state of runners in our Runner Admin UI:
This concept could be extended to return this information about the count of different amounts of runners.
Example Metrics
- Active runners
- Inactive runners
Scopes
- Instance
- Group
- Project
Solution description
Specs for this are still TBD
The implementation will require:
-
As far as the GraphQL part is concerned, this should be just a question of changing the connection_type
forCi::RunnerType
to beTypes::CountableConnectionType
. This will add acount
property to the connection.Patch
diff --git a/app/graphql/types/ci/runner_type.rb b/app/graphql/types/ci/runner_type.rb index e62a2b8672f..254d8b7bb29 100644 --- a/app/graphql/types/ci/runner_type.rb +++ b/app/graphql/types/ci/runner_type.rb @@ -4,6 +4,7 @@ module Types module Ci class RunnerType < BaseObject edge_type_class(RunnerWebUrlEdge) + connection_type_class(Types::CountableConnectionType) graphql_name 'CiRunner' authorize :read_runner present_using ::Ci::RunnerPresenter
-
Index the active
column so that therunners(active:true)
query performs well. This will likely have an impact on theindex_ci_runners_on_contacted_at_and_id_where_inactive
partial index.
Edited by Pedro Pombeiro