Metrics
Using dbt Metrics with PipeRider
From dbt 1.6, support for the dbt_metrics package was deprecated and replaced by the Semantic Layer. Likewise, from version 0.33.0 of PipeRider, support for the legacy metric config has also been discontinued. Metrics defined using the old configuration will now be automatically skipped by PipeRider.
PipeRider supports querying dbt metrics and analyzing the impact on metrics between two branches.
How to use
Define semantic models and metrics in your dbt project
Validate metric configuration
Run PipeRider
1. Define semantic models and metrics
For full details on how to define metrics, please refer to the official dbt documentation on the semantic model and creating metrics.
The following serves as a basic example on how to define a metric. Here, we define a metric revenue, which is the sum of the amount column with a status of completed.
2. Validate metric configuration
The fastest way to validate the configuration of your dbt project is the dbt-parse command:
dbt has also released a powerful tool, MetricFlow CLI that, among other features, can also validate your metric configuration:
MetricFlow CLI can also query the metric to ensure it is functional:
3. Run PipeRider
Once your metrics are correctly configured, run PipeRider:
View metrics in your PipeRider Report by selecting the metrics
page form the project sidebar:
More about metric queries
How PipeRider queries the dbt metric
PipeRider can run daily, monthly, and yearly queries for your metrics. If the time_granularity is defined, the queries will adhere to these settings. For example, if the time_granularity
is month
, then PipeRider only run the monthly and yearly queries.
For each time grains, PipeRider only queries the last n periods
time_grain | metric query |
---|---|
day | daily result for last 30 days |
month | monthly result for last 12 months |
year | yearly result for last 10 years |
The behavior is identical to the following command in MetricFlow.
Limited Support of DBT Metrics
PipeRider no longer supports metric specification prior to dbt v1.6. dbt provides official documentation on how to migrate metrics configs to the new spec.
PipeRider doesn't support metrics that use measures with
agg
, such assum_boolean
,median
, andpercentile
PipeRider doesn't support metrics that use filters with jinja macros other than
Dimension
PipeRider doesn't support metrics that use filters with
Dimension
macros that require joins. Referencing the above metrics example:{{ Dimension('order_id__status') }} = 'completed'
is supported becauseorder_id
is type ofprimary
{{ Dimension('customer__type') }} = 'vip'
is not supported becausecustomer
is type offoreign
, and so requires additional join
PipeRider doesn't support derived metrics with
offset_window
PipeRider doesn't support cumulative metrics.
Query single metric
When developing a new metric, it is time-consuming to run through all the piperider run to test the metric result. PipeRider support dbt node selection to run on single metric
Compare metrics
With PipeRider's compare feature, you're also able to compare metrics between reports, which is particularly useful when analyzing the impact of data model or metric definition changes.
Last updated