Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give wiggle room for selecting SLA policy names if timestamps are off by milliseconds #174

Merged
merged 4 commits into from
Oct 24, 2024

Conversation

fivetran-jamie
Copy link
Contributor

@fivetran-jamie fivetran-jamie commented Oct 21, 2024

PR Overview

This PR will address the following Issue/Feature:
Customer has reported seeing records in zendesk__sla_policies with null sla_policy_name values when they should not be null. We've isolated this problem to this join. It turns out that some records can come from Zendesk in the wrong order by a margin of a couple of milliseconds, which our current join logic is too strict to include.

This PR will result in the following new package version:

v0.18.1

Please provide the finalized CHANGELOG entry which details the relevant changes included in this PR:

Bug Fix

  • Addressed an issue in which some records in zendesk__sla_policies might erroneously have a null sla_policy_name due to system-generated millisecond-long gaps in timestamps. The package now compares timestamps to the nearest second when selecting valid SLA policy names in int_zendesk__sla_policy_applied.

Under the Hood

  • Updated consistency_sla_policies data validation test to account for the above change.
  • Updated logic in sla_count_match data validation test.

PR Checklist

Basic Validation

Please acknowledge that you have successfully performed the following commands locally:

  • dbt run –full-refresh && dbt test
  • dbt run (if incremental models are present) && dbt test

Before marking this PR as "ready for review" the following have been applied:

  • [n/a] The appropriate issue has been linked, tagged, and properly assigned
  • All necessary documentation and version upgrades have been applied
  • docs were regenerated (unless this PR does not include any code or yml updates)
  • BuildKite integration tests are passing
  • Detailed validation steps have been provided below

Detailed Validation

Please share any and all of your validation steps:

Added fivetran_integrity_sla_count_match_tickets exclusion tickets related to #175 and validation tests are passing using both the testing and prod schemas:
image

Regarding the add_exceptions CTE I added to the consistency_sla_policies test - I added the name_was_null_prior clause because there were ~5K tickets in our internal dataset that had their null SLA policy names updated by my fix.

If you had to summarize this PR in an emoji, which would it be?

🪟

@fivetran-jamie fivetran-jamie self-assigned this Oct 21, 2024
@fivetran-jamie fivetran-jamie marked this pull request as ready for review October 22, 2024 22:43
Copy link
Contributor

@fivetran-joemarkiewicz fivetran-joemarkiewicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fivetran-jamie thanks for working so quick to address this issue. I tested these changes and they look good to me. I do have a suggestion to make some adjustments to the validation tests to ensure the either don't run or ignore the business metrics when the using_schedules variable is disabled.

If you could make those updates so we could use these validations in the future that would be great. Once those are applied, you can move this forward to release review. Thanks again!

CHANGELOG.md Outdated
- Addressed an issue in which some records in `zendesk__sla_policies` might erroneously have a null `sla_policy_name` due to system-generated millisecond-long gaps in timestamps. The package now compares timestamps to the nearest `second` when selecting valid SLA policy names in [int_zendesk__sla_policy_applied](https://github.com/fivetran/dbt_zendesk/blob/main/models/sla_policy/int_zendesk__sla_policy_applied.sql).

## Under the Hood
- Updated `consistency_sla_policies` data validation test to account for the above change.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can probably combine the two sentences here into one, I think they were both to account for the above changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

combined

max(sla_elapsed_time) over (partition by ticket_id, metric, sla_applied_at) as max_sla_elapsed_time,
min(sla_elapsed_time) over (partition by ticket_id, metric, sla_applied_at) as min_sla_elapsed_time,

{#
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminder to remove before merging!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

max_sla_elapsed_time - min_sla_elapsed_time > 2

{# Remove after v0.18.1 #}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminder to remove before merging!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

Copy link
Contributor

@fivetran-avinash fivetran-avinash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fivetran-jamie One question (see here) and a few minor comments before approving.

Copy link
Contributor

@fivetran-avinash fivetran-avinash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@fivetran-jamie fivetran-jamie merged commit 7fa81ff into main Oct 24, 2024
8 checks passed
@fivetran-jamie fivetran-jamie deleted the fix/expand-sla-policy-name-window branch October 24, 2024 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants