-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #154 from fivetran/bugfix/remianing-sla-issues
Bugfix/remianing sla issues
- Loading branch information
Showing
16 changed files
with
246 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
name: 'zendesk' | ||
version: '0.15.0' | ||
version: '0.16.0' | ||
|
||
|
||
config-version: 2 | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
packages: | ||
- local: ../ | ||
- local: ../ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
dbt-snowflake>=1.3.0,<2.0.0 | ||
dbt-bigquery>=1.3.0,<2.0.0 | ||
dbt-redshift>=1.3.0,<2.0.0 | ||
dbt-postgres>=1.3.0,<2.0.0 | ||
dbt-spark>=1.3.0,<2.0.0 | ||
dbt-spark[PyHive]>=1.3.0,<2.0.0 | ||
dbt-databricks>=1.6.0,<2.0.0 | ||
dbt-snowflake>=1.3.0,<1.8.0 | ||
dbt-bigquery>=1.3.0,<1.8.0 | ||
dbt-redshift>=1.3.0,<1.8.0 | ||
dbt-postgres>=1.3.0,<1.8.0 | ||
dbt-spark>=1.3.0,<1.8.0 | ||
dbt-spark[PyHive]>=1.3.0,<1.8.0 | ||
dbt-databricks>=1.6.0,<1.8.0 |
47 changes: 47 additions & 0 deletions
47
integration_tests/tests/consistency/consistency_sla_policies.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
|
||
{{ config( | ||
tags="fivetran_validations", | ||
enabled=var('fivetran_validation_tests_enabled', false) | ||
) }} | ||
|
||
with prod as ( | ||
select | ||
ticket_id, | ||
metric, | ||
sla_applied_at, | ||
sla_elapsed_time, | ||
is_sla_breach | ||
from {{ target.schema }}_zendesk_prod.zendesk__sla_policies | ||
), | ||
|
||
dev as ( | ||
select | ||
ticket_id, | ||
metric, | ||
sla_applied_at, | ||
sla_elapsed_time, | ||
is_sla_breach | ||
from {{ target.schema }}_zendesk_dev.zendesk__sla_policies | ||
), | ||
|
||
final as ( | ||
select | ||
prod.ticket_id, | ||
prod.metric, | ||
prod.sla_applied_at, | ||
prod.sla_elapsed_time as prod_sla_elapsed_time, | ||
dev.sla_elapsed_time as dev_sla_elapsed_time, | ||
prod.is_sla_breach as prod_is_sla_breach, | ||
dev.is_sla_breach as dev_is_sla_breach | ||
from prod | ||
full outer join dev | ||
on dev.ticket_id = prod.ticket_id | ||
and dev.metric = prod.metric | ||
and dev.sla_applied_at = prod.sla_applied_at | ||
) | ||
|
||
select * | ||
from final | ||
where (abs(prod_sla_elapsed_time - dev_sla_elapsed_time) >= 5 | ||
or prod_is_sla_breach != dev_is_sla_breach) | ||
{{ "and prod.ticket_id not in " ~ var('fivetran_consistency_sla_policies_exclusion_tickets',[]) ~ "" if var('fivetran_consistency_sla_policies_exclusion_tickets',[]) }} |
35 changes: 35 additions & 0 deletions
35
integration_tests/tests/consistency/consistency_sla_policy_count.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
|
||
{{ config( | ||
tags="fivetran_validations", | ||
enabled=var('fivetran_validation_tests_enabled', false) | ||
) }} | ||
|
||
with prod as ( | ||
select | ||
1 as join_key, | ||
count(*) as total_slas | ||
from {{ target.schema }}_zendesk_prod.zendesk__sla_policies | ||
group by 1 | ||
), | ||
|
||
dev as ( | ||
select | ||
1 as join_key, | ||
count(*) as total_slas | ||
from {{ target.schema }}_zendesk_dev.zendesk__sla_policies | ||
group by 1 | ||
), | ||
|
||
final as ( | ||
select | ||
prod.join_key, | ||
prod.total_slas as prod_sla_total, | ||
dev.total_slas as dev_sla_total | ||
from prod | ||
full outer join dev | ||
on dev.join_key = prod.join_key | ||
) | ||
|
||
select * | ||
from final | ||
where prod_sla_total != dev_sla_total |
39 changes: 39 additions & 0 deletions
39
integration_tests/tests/consistency/consistency_ticket_metrics.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
{{ config( | ||
tags="fivetran_validations", | ||
enabled=var('fivetran_validation_tests_enabled', false) | ||
) }} | ||
|
||
with prod as ( | ||
select | ||
ticket_id, | ||
first_reply_time_business_minutes, | ||
first_reply_time_calendar_minutes | ||
from {{ target.schema }}_zendesk_prod.zendesk__ticket_metrics | ||
), | ||
|
||
dev as ( | ||
select | ||
ticket_id, | ||
first_reply_time_business_minutes, | ||
first_reply_time_calendar_minutes | ||
from {{ target.schema }}_zendesk_dev.zendesk__ticket_metrics | ||
), | ||
|
||
final as ( | ||
select | ||
prod.ticket_id, | ||
prod.first_reply_time_business_minutes as prod_first_reply_time_business_minutes, | ||
dev.first_reply_time_business_minutes as dev_first_reply_time_business_minutes, | ||
prod.first_reply_time_calendar_minutes as prod_first_reply_time_calendar_minutes, | ||
dev.first_reply_time_calendar_minutes as dev_first_reply_time_calendar_minutes | ||
from prod | ||
full outer join dev | ||
on dev.ticket_id = prod.ticket_id | ||
) | ||
|
||
select * | ||
from final | ||
where (abs(prod_first_reply_time_business_minutes - dev_first_reply_time_business_minutes) >= 5 | ||
or abs(prod_first_reply_time_calendar_minutes - dev_first_reply_time_calendar_minutes) >= 5) | ||
{{ "and ticket_id not in " ~ var('fivetran_consistency_ticket_metrics_exclusion_tickets',[]) ~ "" if var('fivetran_consistency_ticket_metrics_exclusion_tickets',[]) }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
|
||
{{ config( | ||
tags="fivetran_validations", | ||
enabled=var('fivetran_validation_tests_enabled', false) | ||
) }} | ||
|
||
-- The necessary source and source_filter adjustments used below originate from the int_zendesk__sla_policy_applied model | ||
with source as ( | ||
select | ||
*, | ||
case when field_name = 'first_reply_time' then row_number() over (partition by ticket_id, field_name order by valid_starting_at desc) else 1 end as latest_sla | ||
from {{ ref('stg_zendesk__ticket_field_history') }} | ||
), | ||
|
||
source_filter as ( | ||
select | ||
ticket_id, | ||
count(*) as source_row_count | ||
from source | ||
where field_name in ('next_reply_time', 'first_reply_time', 'agent_work_time', 'requester_wait_time') | ||
and value is not null | ||
and latest_sla = 1 | ||
group by 1 | ||
), | ||
|
||
sla_policies as ( | ||
select | ||
ticket_id, | ||
count(*) as end_model_row_count | ||
from {{ ref('zendesk__sla_policies') }} | ||
group by 1 | ||
), | ||
|
||
match_check as ( | ||
select | ||
sla_policies.ticket_id, | ||
end_model_row_count, | ||
source_row_count | ||
from sla_policies | ||
full outer join source_filter | ||
on source_filter.ticket_id = sla_policies.ticket_id | ||
) | ||
|
||
select * | ||
from match_check | ||
where end_model_row_count != source_row_count | ||
{{ "and ticket_id not in " ~ var('fivetran_integrity_sla_count_match_tickets',[]) ~ "" if var('fivetran_integrity_sla_count_match_tickets',[]) }} |
36 changes: 36 additions & 0 deletions
36
integration_tests/tests/integrity/sla_first_reply_time_match.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
{{ config( | ||
tags="fivetran_validations", | ||
enabled=var('fivetran_validation_tests_enabled', false) | ||
) }} | ||
|
||
with ticket_metrics as ( | ||
select | ||
ticket_id, | ||
first_reply_time_business_minutes | ||
from {{ ref('zendesk__ticket_metrics') }} | ||
), | ||
|
||
sla_policies as ( | ||
select | ||
ticket_id, | ||
sla_elapsed_time | ||
from {{ ref('zendesk__sla_policies') }} | ||
where metric = 'first_reply_time' | ||
and in_business_hours | ||
), | ||
|
||
match_check as ( | ||
select | ||
ticket_metrics.ticket_id, | ||
ticket_metrics.first_reply_time_business_minutes, | ||
sla_policies.sla_elapsed_time | ||
from ticket_metrics | ||
full outer join sla_policies | ||
on ticket_metrics.ticket_id = sla_policies.ticket_id | ||
) | ||
|
||
select * | ||
from match_check | ||
where abs(round(first_reply_time_business_minutes,0) - round(sla_elapsed_time,0)) >= 2 | ||
{{ "and ticket_id not in " ~ var('fivetran_integrity_sla_first_reply_time_exclusion_tickets',[]) ~ "" if var('fivetran_integrity_sla_first_reply_time_exclusion_tickets',[]) }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters