Repository: dbt-labs/dbt-core

Issue:
[Bug] v.1.0.0-rc1 doesn't count metrics
### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current Behavior

I'm experimenting with metrics, and noticed that after creating one and running `dbt compile` that it was not being counted. 


### Expected Behavior

`Found 477 models, [...], 1 metric`

### Steps To Reproduce

Create this file:
```yml
#/models/metrics/metrics_definitions.yml
version: 2 
metrics:
    - name: slack_joiners
      label: Members of Community Slack
      model: ref('dim_slack_users')

      type: count
      timestamp: joined_at
      time_grains: [day, week, month] #does it make sense to have num weekly active members over a month?

      dimensions:
        - has_messaged
        - is_active_past_quarter
```

then run `dbt compile`

### Relevant log output

```shell
(dbt-preprod) joel@Joel-Labes internal-analytics % dbt compile
17:19:10 | [ info  ] | Running with dbt=1.0.0-rc1
17:19:10 | [ warn  ] | * Deprecation Warning: The `source-paths` config has been deprecated in favor of
`model-paths`. Please update your `dbt_project.yml` configuration to reflect
this change.
17:19:10 | [ info  ] | Found 477 models, 732 tests, 4 snapshots, 5 analyses, 572 macros, 1 operation, 19 seed files, 719 sources, 7 exposures, 0 metrics
17:19:10 | [ info  ] | 
17:19:10 | [ error ] | Encountered an error:
Database Error
  250001 (08001): Failed to connect to DB: kw27752.snowflakecomputing.com:443. IP 151.210.160.244 is not allowed to access Snowflake.  Contact your local security administrator.

^^ I wasn't on the VPN, but the node enumeration happens without that
```


### Environment

```markdown
- OS: macOS 11.6.1
- Python: Python 3.8.10
- dbt: installed version: 1.0.0-rc1
Plugins:
  - snowflake: 1.0.0rc1
  - postgres: 1.0.0rc1
```


### What database are you using dbt with?

snowflake

### Additional Context

manifest.json contains the metric:


```
{
  "metric.fishtown_internal_analytics.slack_joiners": {
    "fqn": [
      "fishtown_internal_analytics",
      "metrics",
      "slack_joiners"
    ],
    "unique_id": "metric.fishtown_internal_analytics.slack_joiners",
    "package_name": "fishtown_internal_analytics",
    "root_path": "/Users/joel/Documents/GitHub/internal-analytics",
    "path": "metrics/metrics_definitions.yml",
    "original_file_path": "models/metrics/metrics_definitions.yml",
    "model": "ref('dim_slack_users')",
    "name": "slack_joiners",
    "description": "",
    "label": "Members of Community Slack",
    "type": "count",
    "sql": null,
    "timestamp": "joined_at",
    "filters": [],
    "time_grains": [
      "day",
      "week",
      "month"
    ],
    "dimensions": [
      "has_messaged",
      "is_active_past_quarter"
    ],
    "resource_type": "metric",
    "meta": {},
    "tags": [],
    "sources": [],
    "depends_on": {
      "macros": [],
      "nodes": [
        "model.fishtown_internal_analytics.dim_slack_users"
      ]
    },
    "refs": [
      [
        "dim_slack_users"
      ]
    ],
    "created_at": 1637122496
  }
}```


Discussion:
@joellabes Nice catch!! Metrics are missing here:

https://github.com/dbt-labs/dbt-core/blob/719b2026ab847ab887d3638c81a351b0f6f96158/core/dbt/compilation.py#L84-L96

We need this to include:

```python
    for metric in manifest.metrics.values():
        stats[metric.resource_type] += 1
```

Then I get:
```
06:52:38 | [ info  ] | Found 1 model, 2 tests, 0 snapshots, 0 analyses, 353 macros, 0 operations, 0 seed files, 0 sources, 0 exposures, 1 metric
```

Resolving patch:
diff --git a/core/dbt/compilation.py b/core/dbt/compilation.py
--- a/core/dbt/compilation.py
+++ b/core/dbt/compilation.py
@@ -91,6 +91,8 @@ def _generate_stats(manifest: Manifest):
         stats[source.resource_type] += 1
     for exposure in manifest.exposures.values():
         stats[exposure.resource_type] += 1
+    for metric in manifest.metrics.values():
+        stats[metric.resource_type] += 1
     for macro in manifest.macros.values():
         stats[macro.resource_type] += 1
     return stats


Test patch: