[GraphQL] Use lazy aggregation for epics healthStatus

When querying health status fields in epics using GraphQL we get an extra COUNT(*) query for each epic.

How to reproduce

  1. Visit an epic with multiple children (e.g: https://gitlab.com/groups/gitlab-org/plan-stage/frontend-engineers/-/epics/1)
  2. Use the Performance bar check for queries in groupEpics.
  3. There should be a SELECT COUNT(*)... query per child epic.
Screenshot

Screenshot_2022-08-30_at_14.20.48

Query
SELECT
    COUNT(*) AS count_all,
    "issues"."health_status" AS issues_health_status
FROM
    "issues"
    INNER JOIN "epic_issues" ON "epic_issues"."issue_id" = "issues"."id"
WHERE
    "epic_issues"."epic_id" IN ( WITH RECURSIVE "base_and_descendants" AS (
(
                SELECT
                    "epics".*
                FROM
                    "epics"
                WHERE
                    "epics"."id" = {ID})
            UNION (
                SELECT
                    "epics".*
                FROM
                    "epics",
                    "base_and_descendants"
                WHERE
                    "epics"."parent_id" = "base_and_descendants"."id"))
            SELECT
                "epics"."id"
            FROM
                "base_and_descendants" AS "epics")
        AND ("issues"."state_id" IN (1))
    AND "issues"."health_status" IS NOT NULL
GROUP BY
    "issues"."health_status"

Proposed solution

Use Gitlab::Graphql::Aggregations::Epics::LazyEpicAggregate to aggregate counts for health status too.