Skip to content

Commit

Permalink
testing contributor activity metrics in SQL mesh (#2031)
Browse files Browse the repository at this point in the history
  • Loading branch information
ccerv1 authored Sep 3, 2024
1 parent 1c1529b commit 107d9b5
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 2 deletions.
12 changes: 11 additions & 1 deletion warehouse/metrics_mesh/models/measures_factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,23 @@
"developer_active_days": MetricQuery(
ref="active_days.sql",
vars={
"activity_event_type": "COMMIT_CODE",
"activity_event_types": "('COMMIT_CODE')",
},
),
"developer_classifications": MetricQuery(
ref="developer_activity_classification.sql",
vars={"full_time_days": 10},
),
"contributor_active_days": MetricQuery(
ref="active_days.sql",
vars={
"activity_event_types": "('COMMIT_CODE', 'ISSUE_OPENED', 'PULL_REQUEST_OPENED')",
},
),
"contributor_classifications": MetricQuery(
ref="contributor_activity_classification.sql",
vars={"full_time_days": 10},
),
},
trailing_days=30,
)
2 changes: 1 addition & 1 deletion warehouse/metrics_mesh/oso_metrics/active_days.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ select
@metric_name as metric,
COUNT(DISTINCT events.bucket_day) amount,
from metrics.int_events_daily_to_artifact as events
where event_type = @activity_event_type and
where event_type in @activity_event_types and
events.bucket_day BETWEEN (@end_date - INTERVAL @trailing_days DAY) AND @end_date
group by
1,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
select
active.bucket_day,
active.event_source,
active.to_artifact_id,
'' as from_artifact_id,
'full_time_contributors' as metric,
COUNT(DISTINCT active.from_artifact_id) as amount
from peer.contributor_active_days as active
where active.amount >= @full_time_days
group by
metric,
from_artifact_id,
to_artifact_id,
event_source,
bucket_day
union all
select
active.bucket_day,
active.event_source,
active.to_artifact_id,
'' as from_artifact_id,
'part_time_contributors' as metric,
COUNT(DISTINCT active.from_artifact_id) as amount
from peer.contributor_active_days as active
where active.amount < @full_time_days
group by
metric,
from_artifact_id,
to_artifact_id,
event_source,
bucket_day
union all
select
active.bucket_day,
active.event_source,
active.to_artifact_id,
'' as from_artifact_id,
'active_contributors' as metric,
COUNT(DISTINCT active.from_artifact_id) as amount
from peer.contributor_active_days as active
group by
metric,
from_artifact_id,
to_artifact_id,
event_source,
bucket_day

0 comments on commit 107d9b5

Please sign in to comment.