From ddbfbdb8122450aa53c0e24eb39f7dca37e51ff1 Mon Sep 17 00:00:00 2001 From: Carl Cervone <42869436+ccerv1@users.noreply.github.com> Date: Sun, 26 May 2024 22:30:16 -0400 Subject: [PATCH] add: power user metric (#1534) * add: power user metric * chore: add metric to consolidate model * fix: linting in new metric * chore: update rf4 metrics blog post --- .../2024-05-16-impact-metrics-rf4/index.md | 8 +++- .../metrics/rf4_power_user_addresses.sql | 43 +++++++++++++++++++ .../rf4_impact_metrics_by_project.sql | 10 ++++- .../rf4_impact_metrics_by_project__schema.yml | 7 ++- 4 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 warehouse/dbt/models/marts/superchain/metrics/rf4_power_user_addresses.sql diff --git a/apps/docs/blog/2024-05-16-impact-metrics-rf4/index.md b/apps/docs/blog/2024-05-16-impact-metrics-rf4/index.md index b6e8352cf..2b2b71d7e 100644 --- a/apps/docs/blog/2024-05-16-impact-metrics-rf4/index.md +++ b/apps/docs/blog/2024-05-16-impact-metrics-rf4/index.md @@ -26,7 +26,7 @@ The round is expected to receive applications from hundreds of projects building At Open Source Observer, our objective is to help the Optimism community arrive at up to 20 credible impact metrics that can be applied to projects with contracts on the Superchain. -This page explains where the metrics come from and includes a working list of all metrics under consideration for badgeholders. We will update it regularly, at least until the start of voting (June 23), to reflect the evolution of metrics. The first version metrics was released on 2024-05-16 and the most recent version (below) was released on 2024-05-22. +This page explains where the metrics come from and includes a working list of all metrics under consideration for badgeholders. We will update it regularly, at least until the start of voting (June 23), to reflect the evolution of metrics. The first version metrics was released on 2024-05-16 and the most recent version (below) was released on 2024-05-26. @@ -180,3 +180,9 @@ Recurring addresses are a proxy for recurring users. It is especially relevant t Count of trusted users who have interacted with the project in at least 3 separate months over the RF4 scope period (October 2023 - June 2024). Many crypto natives are curious to try out new protocols. But churn and user retention are major issues. Recurring users represent the most loyal and committed segment of a project's user base. This metric considers users who have interacted with a project over the course of at least three distinct calendar months during the RF4 scope period. Thus, it is intended to reflect sustained interest and ongoing engagement over time. A high count of recurring users signals strong project loyalty and a good user experience, and helps separate the fads from the future. + +### Power User Addresses + +Count of 'power user' addresses that have interacted with the project over the RF4 scope period (October 2023 - June 2024). + +This metric reflects the degree which a project has attracted attention from the most active and engaged users on the Superchain. A `power user` is defined as an address that has made at least 100 transactions, across at least 10 different projects, on at least 30 days, over the RF4 scope period. A project is counted by this metric if has at least one interaction from a power user. Power users are critical early adopters for the ecosystem. diff --git a/warehouse/dbt/models/marts/superchain/metrics/rf4_power_user_addresses.sql b/warehouse/dbt/models/marts/superchain/metrics/rf4_power_user_addresses.sql new file mode 100644 index 000000000..5d557dcf6 --- /dev/null +++ b/warehouse/dbt/models/marts/superchain/metrics/rf4_power_user_addresses.sql @@ -0,0 +1,43 @@ +with txns as ( + select + project_id, + from_artifact_name, + bucket_day, + amount + from {{ ref('rf4_events_daily_to_project') }} + where + event_type = 'CONTRACT_INVOCATION_SUCCESS_DAILY_COUNT' + and bucket_day >= '2023-10-01' +), + +address_stats as ( + select + from_artifact_name, + COUNT(distinct bucket_day) as days_count, + COUNT(distinct project_id) as project_count, + SUM(amount) as txns_count + from txns + group by + from_artifact_name +), + +power_users as ( + select from_artifact_name + from address_stats + where + days_count >= 30 + and project_count >= 10 + and txns_count >= 100 +) + +select + txns.project_id, + 'power_user_addresses' as metric, + COUNT(distinct txns.from_artifact_name) as amount +from txns +left join power_users + on txns.from_artifact_name = power_users.from_artifact_name +where + power_users.from_artifact_name is not null +group by + txns.project_id diff --git a/warehouse/dbt/models/marts/superchain/rf4_impact_metrics_by_project.sql b/warehouse/dbt/models/marts/superchain/rf4_impact_metrics_by_project.sql index a9668fb0b..33410d64b 100644 --- a/warehouse/dbt/models/marts/superchain/rf4_impact_metrics_by_project.sql +++ b/warehouse/dbt/models/marts/superchain/rf4_impact_metrics_by_project.sql @@ -24,6 +24,8 @@ with metrics as ( select * from {{ ref('rf4_trusted_recurring_users') }} union all select * from {{ ref('rf4_recurring_addresses') }} + union all + select * from {{ ref('rf4_power_user_addresses') }} ), pivot_metrics as ( @@ -61,7 +63,10 @@ pivot_metrics as ( ) as trusted_recurring_users, MAX( case when metric = 'recurring_addresses' then amount else 0 end - ) as recurring_addresses + ) as recurring_addresses, + MAX( + case when metric = 'power_user_addresses' then amount else 0 end + ) as power_user_addresses from metrics group by project_id ) @@ -83,7 +88,8 @@ select pivot_metrics.monthly_active_addresses, pivot_metrics.trusted_monthly_active_users, pivot_metrics.recurring_addresses, - pivot_metrics.trusted_recurring_users + pivot_metrics.trusted_recurring_users, + pivot_metrics.power_user_addresses from pivot_metrics left join {{ ref('projects_v1') }} on pivot_metrics.project_id = projects_v1.project_id diff --git a/warehouse/dbt/models/marts/superchain/rf4_impact_metrics_by_project__schema.yml b/warehouse/dbt/models/marts/superchain/rf4_impact_metrics_by_project__schema.yml index 393dc4f35..3aaddde5d 100644 --- a/warehouse/dbt/models/marts/superchain/rf4_impact_metrics_by_project__schema.yml +++ b/warehouse/dbt/models/marts/superchain/rf4_impact_metrics_by_project__schema.yml @@ -32,7 +32,7 @@ models: **Event Type**: A label for the type of event that has been aggregated. Examples include: `CONTRACT_INVOCATION_DAILY_COUNT`, `CONTRACT_INVOCATION_SUCCESS_DAILY_COUNT`, `CONTRACT_INVOCATION_DAILY_L2_GAS_USED`. - name: amount description: > - **Amount**: The amount or value associated with teh event. This is a count or sum depending on the event type. + **Amount**: The amount or value associated with the event. This is a count or sum depending on the event type. - name: trusted_user_id description: > **Trusted User ID**: A unique identifier for a trusted user (generated by OSO). If the `from_artifact_name` is not a trusted user, this field will be null. @@ -106,3 +106,8 @@ models: **Trusted Recurring Users**: Count of trusted users who have interacted with the project in at least 3 separate months over the RF4 scope period (October 2023 - June 2024). Many crypto natives are curious to try out new protocols. But churn and user retention are major issues. Recurring users represent the most loyal and committed segment of a project's user base. This metric considers users who have interacted with a project over the course of at least three distinct calendar months during the RF4 scope period. Thus, it is intended to reflect sustained interest and ongoing engagement over time. A high count of recurring users signals strong project loyalty and a good user experience, and helps separate the fads from the future. + - name: power_user_addresses + description: > + **Power User Addresses**: Count of 'power user' addresses that have interacted with the project over the RF4 scope period (October 2023 - June 2024). + + This metric reflects the degree which a project has attracted attention from the most active and engaged users on the Superchain. A `power user` is defined as an address that has made at least 100 transactions, across at least 10 different projects, on at least 30 days, over the RF4 scope period. A project is counted by this metric if has at least one interaction from a power user. Power users are critical early adopters for the ecosystem.