Skip to content

Commit

Permalink
Chore: surface full server version info to the nps models (#1630)
Browse files Browse the repository at this point in the history
  • Loading branch information
catalintomai authored Oct 11, 2024
1 parent e971d12 commit 32706fd
Show file tree
Hide file tree
Showing 13 changed files with 35 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -33,7 +31,7 @@ select server_id
, license_id
, event_date
, timestamp
, server_version
, server_version_full
, score
, user_role
, score_received_at
Expand All @@ -44,7 +42,7 @@ select server_id
, license_id
, event_date
, timestamp
, server_version
, server_version_full
, score
, user_role
, score_received_at
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 32706fd

Please sign in to comment.