dbt-labs / dbt-labs/metricflow
[Bug] `meta` field not added to the metric
- Dominant language
- Python
- Stars
- 1.8k
- Forks
- 202
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 14
Description
### Is this a new bug in metricflow?
- [X] I believe this is a new bug in metricflow
- [X] I have searched the existing issues, and I could not find an existing issue for this bug
### Current Behavior
Scavaging through the documentation, we found two ways of adding `metadata` for metrics
- [This](https://github.com/dbt-labs/dbt-core/discussions/7456) mentions that `meta` can be defined at the top-level with a metric. So, something like the following
```yaml
metrics:
- name: new_customers
type: SIMPLE
type_params:
measure: new_customers
label: "New Customer"
meta:
feature: customers
```
- [This](https://docs.getdbt.com/reference/resource-properties/config) mentions that `meta` can be added inside the `config` object. So, something like the following
```yaml
metrics:
- name: new_customers
type: SIMPLE
type_params:
measure: new_customers
label: "New Customer"
config:
meta:
feature: customers
```
We tried both syntaxes. But when `dbt compile` is run, neither the `semantic_manifest.json` nor the `output.json` has the value added to the `metadata` field. As a result, running `metricFlowEngine.list_metrics()` also does not return any metadata.
### Expected Behavior
The value should be added to the `metadata` field. So, the `semantic_manifest.json` should have the following.
```json
{
"name": "new_customers",
...
"metadata": {
"feature": "customers",
},
"label": "New Customer"
}
```
And `metricFlowEngine.list_metrics()` should return the value in `metadata` field as well.
### Steps To Reproduce
1. Create a metric with the `meta` field
```yaml
metrics:
- name: new_customers
type: SIMPLE
type_params:
measure: new_customers
label: "New Customer"
meta:
feature: customers
```
2. Run `dbt compile` and then check the `semantic_manifest.json` or run `metricFlowEngine.list_metrics()`.
3. The output won't have any value in `metadata` field.
### Relevant log output
_No response_
### Environment
```markdown
- OS: MacOS
- Python: 3.11.3
- dbt: 1.8.3
- metricflow: 0.7.1
```
### Which database are you using?
snowflake
### Additional Context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.