Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions analysis/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Jira Analysis
> Note: The compiled sql within the analysis folder references the final model [jira__issue_status_transitions](https://github.com/fivetran/dbt_jira/blob/master/models/jira__issue_status_transitions.sql). As such, prior to
Comment thread
fivetran-savage marked this conversation as resolved.
Outdated
compiling the provided sql to analyze issue status category metrics, you must first execute `dbt run`.


## Analysis SQL
| **sql** | **description** |
| ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| [jira__daily_issue_status_category_analysis](https://github.com/fivetran/dbt_jira/blob/master/analysis/jira__daily_issue_status_category_analysis.sql) | The output of the compiled sql will generate daily metrics for issue status categories by joining status transitions with field history data. The analysis aggregates data by date, project, team, and status category to provide: count of distinct issues in each status category, average days spent in status category, and counts of issues that started work, completed work, or reopened work. The SQL references the `jira__issue_status_transitions` and `jira__timestamp_issue_field_history` models. Aggregation granularity can be adjusted by adding/removing field names in the `issue_field_history_columns` var in your dbt project.yml. `status` can be used in place of `status_category` if desired by modifying the model accordingly. |
Comment thread
fivetran-savage marked this conversation as resolved.
Outdated




Comment thread
fivetran-savage marked this conversation as resolved.
Outdated
## SQL Compile Instructions
Leveraging the above sql is made possible by the [analysis functionality of dbt](https://docs.getdbt.com/docs/building-a-dbt-project/analyses/). In order to
compile the sql, you will perform the following steps:
- Execute `dbt run` to create the package models.
- Execute `dbt compile` to generate the target specific sql.
- Navigate to your project's `/target/compiled/jira/analysis` directory.
- Copy the `jira__daily_issue_status_category_analysis` code and run in your data warehouse.
- Confirm the issue status category metrics match your expected workflow patterns.
- Analyze the daily counts, cumulative flow, and completion metrics to identify trends and bottlenecks in your development process.


Comment thread
fivetran-savage marked this conversation as resolved.
## Contributions
Don't see a compiled sql statement you would have liked to be included? Notice any bugs when compiling
and running the analysis sql? If so, we highly encourage and welcome contributions to this package!
Please create issues or open PRs against `master`. Check out [this post](https://discourse.getdbt.com/t/contributing-to-a-dbt-package/657) on the best workflow for contributing to a package.


Comment thread
fivetran-savage marked this conversation as resolved.
Outdated
## Database Support
This package has been tested on BigQuery, Snowflake and Redshift.
Comment thread
fivetran-savage marked this conversation as resolved.
Outdated


Comment thread
fivetran-savage marked this conversation as resolved.
Outdated
## Are there any resources available?
- If you have questions or want to reach out for help, see the [GitHub Issue](https://github.com/fivetran/dbt_jira/issues/new/choose) section to find the right avenue of support for you.
- If you would like to provide feedback to the dbt package team at Fivetran or would like to request a new dbt package, fill out our [Feedback Form](https://www.surveymonkey.com/r/DQ7K7WW).

Comment thread
fivetran-savage marked this conversation as resolved.
66 changes: 66 additions & 0 deletions analysis/jira__daily_issue_status_category_analysis.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
-- grab non hard-coded issue_field_history columns
{% set issue_field_history_columns = var('issue_field_history_columns', []) %}
Comment thread
fivetran-savage marked this conversation as resolved.
Outdated


with field_history as (
select *
from {{ ref('jira__timestamp_issue_field_history') }}
),

status_transitions as (
select *
from {{ ref('jira__issue_status_transitions') }}
),

---if you prefer to keep anayltics at the status level,substitute 'status' for 'status_category' throughout this model
Comment thread
fivetran-savage marked this conversation as resolved.
Outdated
joined as (
select
transitions.transition_at,
transitions.issue_id,
transitions.status_category_name,
transitions.minutes_in_status / 1440.0 as days_in_status,
transitions.started_work,
transitions.completed_work,
transitions.reopened_work,
-- edit field_history columns as desired based on the issue_field_history_columns var for your dbt project
-- project and team have been chosen for this example
field_history.team,
field_history.project
from status_transitions as transitions
join field_history
on transitions.issue_id = field_history.issue_id
and transitions.transition_at = field_history.valid_from
),

---roll up to daily for reporing
daily_rollup as (
select
cast(transition_at as date) as status_category_date,
project,
team,
status_category_name as status_category,
count(distinct issue_id) as issues_in_status_category,
Comment thread
fivetran-savage marked this conversation as resolved.
Outdated
round(avg(days_in_status),2) as avg_days_in_status_category,
sum(started_work) as issues_started_work,
sum(completed_work) as issues_completed_work,
sum(reopened_work) as issues_reopened_work
from joined
group by 1,2,3,4
Comment thread
fivetran-savage marked this conversation as resolved.
Outdated
)
--add cumuliative flow calculation
Comment thread
fivetran-savage marked this conversation as resolved.
Outdated
select
status_category_date,
project,
team,
status_category,
issues_in_status_category,
sum(issues_in_status_category) over (
partition by project, team, status_category
order by status_category_date
rows unbounded preceding
) as cumulative_issues_in_status_category,
avg_days_in_status_category,
issues_started_work,
issues_completed_work,
issues_reopened_work
from daily_rollup
8 changes: 8 additions & 0 deletions dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ vars:
version: "{{ source('jira', 'version') }}"
jira_issue_history_buffer: 1

analysis-paths: ["analysis"]
clean-targets:
- target
- dbt_modules
- dbt_packages

Comment thread
fivetran-savage marked this conversation as resolved.

models:
jira:
Expand All @@ -36,3 +42,5 @@ models:
staging:
+materialized: view
+schema: jira_source


Comment thread
fivetran-savage marked this conversation as resolved.
10 changes: 7 additions & 3 deletions integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ version: '1.1.0'
config-version: 2
profile: 'integration_tests'

vars:
# Comment out the below when generating docs
issue_field_history_columns: ['summary', 'components', 'team'] # @docs-ignore

Comment thread
fivetran-savage marked this conversation as resolved.
vars:
jira_using_components: false
Comment thread
fivetran-savage marked this conversation as resolved.
Outdated

Comment thread
fivetran-savage marked this conversation as resolved.
Outdated
# Comment out the below when generating docs
issue_field_history_columns: ['summary', 'components','team' ,'project'] # @docs-ignore
Comment thread
fivetran-savage marked this conversation as resolved.
Outdated

jira:
jira_schema: jira_integrations_tests_42
Expand All @@ -32,6 +35,7 @@ vars:
jira_version_identifier: "version"
jira_team_identifier: "team"


Comment thread
fivetran-savage marked this conversation as resolved.
models:
jira:
+schema: "{{ 'jira_integrations_tests_sqlw' if target.name == 'databricks-sql' else 'jira' }}"
Expand Down