From 32706fd1d016f7581e376100344bee53b3b5f03a Mon Sep 17 00:00:00 2001 From: catalintomai <56169943+catalintomai@users.noreply.github.com> Date: Fri, 11 Oct 2024 18:48:17 +0100 Subject: [PATCH] Chore: surface full server version info to the nps models (#1630) --- .../intermediate/product/nps/_nps__models.yml | 8 ++++---- .../product/nps/int_nps_feedback.sql | 6 ++---- .../product/nps/int_nps_score.sql | 10 ++++------ .../nps/int_nps_server_version_spined.sql | 6 +++--- .../models/marts/product/nps/_nps__models.yml | 20 ++++++++++++++----- .../marts/product/nps/fct_nps_feedback.sql | 3 ++- .../marts/product/nps/fct_nps_score.sql | 2 +- .../_mattermost_nps__models.yml | 14 +------------ .../stg_mattermost_nps__nps_feedback.sql | 5 +---- .../stg_mattermost_nps__nps_score.sql | 3 --- .../_mm_plugin_prod__models.yml | 16 ++------------- .../stg_mm_plugin_prod__nps_feedback.sql | 3 --- .../stg_mm_plugin_prod__nps_score.sql | 3 --- 13 files changed, 35 insertions(+), 64 deletions(-) diff --git a/transform/mattermost-analytics/models/intermediate/product/nps/_nps__models.yml b/transform/mattermost-analytics/models/intermediate/product/nps/_nps__models.yml index 3f99d0f6d..dfa53867b 100644 --- a/transform/mattermost-analytics/models/intermediate/product/nps/_nps__models.yml +++ b/transform/mattermost-analytics/models/intermediate/product/nps/_nps__models.yml @@ -19,8 +19,8 @@ models: description: The date the event was sent. - name: timestamp description: Timestamp registered by Rudderstack & Segment when the event occurred refactored to clients clock skew. - - name: server_version - description: The server's version. + - name: server_version_full + description: Full server version. - name: feedback description: NPS feedback submitted. - name: user_role @@ -48,8 +48,8 @@ models: description: The date the event was sent. - name: timestamp description: Timestamp registered by Rudderstack & Segment when the event occurred refactored to clients clock skew. - - name: server_version - description: The server's version. + - name: server_version_full + description: Full server version. - name: score description: NPS score submitted. - name: user_role diff --git a/transform/mattermost-analytics/models/intermediate/product/nps/int_nps_feedback.sql b/transform/mattermost-analytics/models/intermediate/product/nps/int_nps_feedback.sql index b84633748..69fd16596 100644 --- a/transform/mattermost-analytics/models/intermediate/product/nps/int_nps_feedback.sql +++ b/transform/mattermost-analytics/models/intermediate/product/nps/int_nps_feedback.sql @@ -5,8 +5,7 @@ select , license_id as license_id , event_date as event_date , timestamp as timestamp - -- server_version only contains major and minor - , server_version_major || '.' || server_version_minor as server_version + , server_version_full , feedback as feedback , user_role as user_role , received_at as feedback_received_at @@ -22,8 +21,7 @@ select , license_id as license_id , event_date as event_date , timestamp as timestamp - -- server_version only contains major and minor - , server_version_major || '.' || server_version_minor as server_version + , server_version_full , feedback as feedback , user_role as user_role , received_at as feedback_received_at diff --git a/transform/mattermost-analytics/models/intermediate/product/nps/int_nps_score.sql b/transform/mattermost-analytics/models/intermediate/product/nps/int_nps_score.sql index 33d93c547..7b5d7626d 100644 --- a/transform/mattermost-analytics/models/intermediate/product/nps/int_nps_score.sql +++ b/transform/mattermost-analytics/models/intermediate/product/nps/int_nps_score.sql @@ -5,8 +5,7 @@ select , license_id as license_id , event_date as event_date , timestamp as timestamp - -- server_version only contains major and minor - , server_version_major || '.' || server_version_minor as server_version + , server_version_full , score as score , user_role as user_role , received_at as score_received_at @@ -20,8 +19,7 @@ select , license_id as license_id , event_date as event_date , timestamp as timestamp - -- server_version only contains major and minor - , server_version_major || '.' || server_version_minor as server_version + , server_version_full , score as score , user_role as user_role , received_at as score_received_at @@ -33,7 +31,7 @@ select server_id , license_id , event_date , timestamp - , server_version + , server_version_full , score , user_role , score_received_at @@ -44,7 +42,7 @@ select server_id , license_id , event_date , timestamp - , server_version + , server_version_full , score , user_role , score_received_at diff --git a/transform/mattermost-analytics/models/intermediate/product/nps/int_nps_server_version_spined.sql b/transform/mattermost-analytics/models/intermediate/product/nps/int_nps_server_version_spined.sql index 0b9d63b3c..aedb8b19b 100644 --- a/transform/mattermost-analytics/models/intermediate/product/nps/int_nps_server_version_spined.sql +++ b/transform/mattermost-analytics/models/intermediate/product/nps/int_nps_server_version_spined.sql @@ -17,7 +17,7 @@ server_version_cte AS ( SELECT sp.activity_date, sp.server_id, - nps_score.server_version AS server_version + nps_score.server_version_full as server_version_full FROM spined sp LEFT JOIN {{ ref('int_nps_score') }} nps_score ON sp.server_id = nps_score.server_id AND sp.activity_date = nps_score.event_date @@ -27,10 +27,10 @@ server_version_cte AS ( SELECT activity_date, server_id, - FIRST_VALUE(server_version IGNORE NULLS) OVER ( + FIRST_VALUE(server_version_full IGNORE NULLS) OVER ( PARTITION BY server_id ORDER BY activity_date DESC ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING - ) AS server_version + ) AS server_version_full FROM server_version_cte ORDER BY ACTIVITY_DATE DESC \ No newline at end of file diff --git a/transform/mattermost-analytics/models/marts/product/nps/_nps__models.yml b/transform/mattermost-analytics/models/marts/product/nps/_nps__models.yml index de6088ef7..5d14ba5d1 100644 --- a/transform/mattermost-analytics/models/marts/product/nps/_nps__models.yml +++ b/transform/mattermost-analytics/models/marts/product/nps/_nps__models.yml @@ -24,12 +24,17 @@ models: description: NPS feedback submitted. - name: score description: NPS score submitted. - - name: server_version - description: The server's version. + - name: version_id + description: The id of the server's version for the given date. + tests: + - not_null + - relationships: + to: ref('dim_version') + field: version_id - name: user_role description: The role of the user who submitted feedback. - name: feedback_date - description: The date the feedback event was sent. + description: The date the feedback event was sent. - name: score_date description: The date the score event was sent. - name: feedback_timestamp @@ -59,8 +64,13 @@ models: description: The ID of the server the NPS score event originated from. tests: - not_null - - name: server_version - description: The server's version. + - name: version_id + description: The id of the server's version for the given date. + tests: + - not_null + - relationships: + to: ref('dim_version') + field: version_id - name: daily_server_id description: A unique identifier for the nps score generated from server_id, activity_date. tests: diff --git a/transform/mattermost-analytics/models/marts/product/nps/fct_nps_feedback.sql b/transform/mattermost-analytics/models/marts/product/nps/fct_nps_feedback.sql index 792dff9c3..970285a50 100644 --- a/transform/mattermost-analytics/models/marts/product/nps/fct_nps_feedback.sql +++ b/transform/mattermost-analytics/models/marts/product/nps/fct_nps_feedback.sql @@ -4,7 +4,8 @@ select {{ dbt_utils.generate_surrogate_key(['nf.server_id', 'nf.user_id', 'nf.fe , nf.license_id as license_id , nf.feedback as feedback , ns.score as score - , nf.server_version as server_version + , coalesce(nf.server_version_full, ns.server_version_full) as all_server_version_full + , {{ dbt_utils.generate_surrogate_key(['all_server_version_full']) }} AS version_id , nf.user_role as user_role , nf.event_date as feedback_date , ns.event_date as score_date diff --git a/transform/mattermost-analytics/models/marts/product/nps/fct_nps_score.sql b/transform/mattermost-analytics/models/marts/product/nps/fct_nps_score.sql index 036cf208d..8977dfc64 100644 --- a/transform/mattermost-analytics/models/marts/product/nps/fct_nps_score.sql +++ b/transform/mattermost-analytics/models/marts/product/nps/fct_nps_score.sql @@ -80,7 +80,7 @@ with user_metrics as ( ) SELECT a.*, {{ dbt_utils.generate_surrogate_key(['a.activity_date', 'a.server_id']) }} AS daily_server_id, - b.server_version AS server_version, + {{ dbt_utils.generate_surrogate_key(['b.server_version_full']) }} AS version_id, a.count_user_promoters_daily + a.count_team_admin_promoters_daily + a.count_system_admin_promoters_daily AS count_promoters_daily, a.count_user_detractors_daily + a.count_team_admin_detractors_daily + a.count_system_admin_detractors_daily AS count_detractors_daily, a.count_user_passives_daily + a.count_team_admin_passives_daily + a.count_system_admin_passives_daily AS count_passives_daily, diff --git a/transform/mattermost-analytics/models/staging/mattermost_nps/_mattermost_nps__models.yml b/transform/mattermost-analytics/models/staging/mattermost_nps/_mattermost_nps__models.yml index 1b2d4686b..fa6a04083 100644 --- a/transform/mattermost-analytics/models/staging/mattermost_nps/_mattermost_nps__models.yml +++ b/transform/mattermost-analytics/models/staging/mattermost_nps/_mattermost_nps__models.yml @@ -34,12 +34,6 @@ models: description: Server installation date. - name: server_version description: The full version string of the server's semver. - - name: server_version_major - description: The major version of the server at the time the event was submitted. - - name: server_version_minor - description: The minor version of the server at the time the event was submitted. - - name: server_version_patch - description: The patch version of the server at the time the event was submitted. - name: context_library_version description: The version of Segment library used to send this event. - name: context_library_name @@ -84,14 +78,8 @@ models: inclusive: true - name: server_install_date description: Server installation date. - - name: server_version + - name: server_version_full description: The full version string of the server's semver. - - name: server_version_major - description: The major version of the server at the time the event was submitted. - - name: server_version_minor - description: The minor version of the server at the time the event was submitted. - - name: server_version_patch - description: The patch version of the server at the time the event was submitted. - name: context_library_version description: The version of Segment library used to send this event. - name: context_library_name diff --git a/transform/mattermost-analytics/models/staging/mattermost_nps/stg_mattermost_nps__nps_feedback.sql b/transform/mattermost-analytics/models/staging/mattermost_nps/stg_mattermost_nps__nps_feedback.sql index acf35b6ea..ef3da5b67 100644 --- a/transform/mattermost-analytics/models/staging/mattermost_nps/stg_mattermost_nps__nps_feedback.sql +++ b/transform/mattermost-analytics/models/staging/mattermost_nps/stg_mattermost_nps__nps_feedback.sql @@ -19,10 +19,7 @@ with source as ( , feedback as feedback , server_install_date as server_install_date , server_version as server_version_full - , split_part(server_version, '.', 1) as server_version_major - , split_part(server_version, '.', 2) as server_version_minor - , split_part(server_version, '.', 3) as server_version_patch - + -- Metadata from Segment , context_library_version as context_library_version , context_library_name as context_library_name diff --git a/transform/mattermost-analytics/models/staging/mattermost_nps/stg_mattermost_nps__nps_score.sql b/transform/mattermost-analytics/models/staging/mattermost_nps/stg_mattermost_nps__nps_score.sql index 90d2021bf..8a4e77972 100644 --- a/transform/mattermost-analytics/models/staging/mattermost_nps/stg_mattermost_nps__nps_score.sql +++ b/transform/mattermost-analytics/models/staging/mattermost_nps/stg_mattermost_nps__nps_score.sql @@ -19,9 +19,6 @@ with source as ( , score as score , server_install_date as server_install_date , server_version as server_version_full - , split_part(server_version, '.', 1) as server_version_major - , split_part(server_version, '.', 2) as server_version_minor - , split_part(server_version, '.', 3) as server_version_patch -- Metadata from Segment , context_library_version as context_library_version diff --git a/transform/mattermost-analytics/models/staging/mm_plugin_prod/_mm_plugin_prod__models.yml b/transform/mattermost-analytics/models/staging/mm_plugin_prod/_mm_plugin_prod__models.yml index 63f58eb0b..fb171eaf4 100644 --- a/transform/mattermost-analytics/models/staging/mm_plugin_prod/_mm_plugin_prod__models.yml +++ b/transform/mattermost-analytics/models/staging/mm_plugin_prod/_mm_plugin_prod__models.yml @@ -62,14 +62,8 @@ models: tags: [pii] - name: plugin_id description: The ID of the plugin. - - name: server_version + - name: server_version_full description: The full version string of the server's semver. - - name: server_version_major - description: The major version of the server at the time the event was submitted. - - name: server_version_minor - description: The minor version of the server at the time the event was submitted. - - name: server_version_patch - description: The patch version of the server at the time the event was submitted. - name: plugin_version description: The plugin's version. - name: context_library_version @@ -118,14 +112,8 @@ models: description: Server installation date. - name: plugin_id description: The ID of the plugin. - - name: server_version + - name: server_version_full description: The full version string of the server's semver. - - name: server_version_major - description: The major version of the server at the time the event was submitted. - - name: server_version_minor - description: The minor version of the server at the time the event was submitted. - - name: server_version_patch - description: The patch version of the server at the time the event was submitted. - name: plugin_version description: The plugin's version. - name: context_library_version diff --git a/transform/mattermost-analytics/models/staging/mm_plugin_prod/stg_mm_plugin_prod__nps_feedback.sql b/transform/mattermost-analytics/models/staging/mm_plugin_prod/stg_mm_plugin_prod__nps_feedback.sql index 7584b51ad..d2d985fc0 100644 --- a/transform/mattermost-analytics/models/staging/mm_plugin_prod/stg_mm_plugin_prod__nps_feedback.sql +++ b/transform/mattermost-analytics/models/staging/mm_plugin_prod/stg_mm_plugin_prod__nps_feedback.sql @@ -36,9 +36,6 @@ renamed as ( -- Same as useractualid above , COALESCE(pluginid, plugin_id) as plugin_id , COALESCE(serverversion, server_version) as server_version_full - , split_part(COALESCE(serverversion, server_version), '.', 1) as server_version_major - , split_part(COALESCE(serverversion, server_version), '.', 2) as server_version_minor - , split_part(COALESCE(serverversion, server_version), '.', 3) as server_version_patch , COALESCE(pluginversion, plugin_version) as plugin_version -- Metadata from Rudderstack diff --git a/transform/mattermost-analytics/models/staging/mm_plugin_prod/stg_mm_plugin_prod__nps_score.sql b/transform/mattermost-analytics/models/staging/mm_plugin_prod/stg_mm_plugin_prod__nps_score.sql index affaed48b..9fdc7e63d 100644 --- a/transform/mattermost-analytics/models/staging/mm_plugin_prod/stg_mm_plugin_prod__nps_score.sql +++ b/transform/mattermost-analytics/models/staging/mm_plugin_prod/stg_mm_plugin_prod__nps_score.sql @@ -35,9 +35,6 @@ renamed as ( -- Same as useractualid above , COALESCE(pluginid, plugin_id) as plugin_id , COALESCE(serverversion, server_version) as server_version_full - , split_part(COALESCE(serverversion, server_version), '.', 1) as server_version_major - , split_part(COALESCE(serverversion, server_version), '.', 2) as server_version_minor - , split_part(COALESCE(serverversion, server_version), '.', 3) as server_version_patch , COALESCE(pluginversion, plugin_version) as plugin_version -- Metadata from Rudderstack