Skip to content

Commit

Permalink
Consolidate change in developers
Browse files Browse the repository at this point in the history
  • Loading branch information
ravenac95 committed Dec 2, 2024
1 parent ae8671b commit c7c35d5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 37 deletions.
31 changes: 3 additions & 28 deletions warehouse/metrics_mesh/models/metrics_factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,36 +137,11 @@
# ),
# entity_types=["artifact", "project", "collection"],
# ),
"change_in_30_day_developer_activity": MetricQueryDef(
vars={
"comparison_interval": 30,
},
ref="change_in_developers.sql",
rolling=RollingConfig(
windows=[2],
unit="period",
cron="@daily",
),
),
"change_in_90_day_developer_activity": MetricQueryDef(
vars={
"comparison_interval": 90,
},
"change_in_developer_activity": MetricQueryDef(
ref="change_in_developers.sql",
rolling=RollingConfig(
windows=[2],
unit="period",
cron="@daily",
),
),
"change_in_180_day_developer_activity": MetricQueryDef(
vars={
"comparison_interval": 180,
},
ref="change_in_developers.sql",
rolling=RollingConfig(
windows=[2],
unit="period",
windows=[30, 90, 180],
unit="day",
cron="@daily",
),
),
Expand Down
16 changes: 8 additions & 8 deletions warehouse/metrics_mesh/oso_metrics/change_in_developers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ WITH latest AS (
classification.amount
FROM @metrics_peer_ref(
developer_classifications,
window := @comparison_interval,
unit := 'day',
window := @rolling_window,
unit := @rolling_unit,
) as classification
WHERE classification.metrics_sample_date = @relative_window_sample_date(
@metrics_end('DATE'),
@comparison_interval,
'day',
@rolling_window,
@rolling_unit,
0
)
),
Expand All @@ -31,13 +31,13 @@ previous AS (
classification.amount
FROM @metrics_peer_ref(
developer_classifications,
window := @comparison_interval,
unit := 'day'
window := @rolling_window,
unit := @rolling_unit
) as classification
WHERE classification.metrics_sample_date = @relative_window_sample_date(
@metrics_end('DATE'),
@comparison_interval,
'day',
@rolling_window,
@rolling_unit,
-1
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ test_change_in_30_day_developer_activity_to_artifact_over_2_period_window_full_t
# Tests rolling count of active days when the user is active 4 of the 5 days
# in the test interval
gateway: local
model: metrics.change_in_30_day_developer_activity_to_artifact_over_2_period_window
model: metrics.change_in_developer_activity_to_artifact_over_30_day_window
vars:
start: 2024-01-31
end: 2024-01-31
Expand Down

0 comments on commit c7c35d5

Please sign in to comment.