diff --git a/services/libs/tinybird/pipes/issues_average_resolve_velocity.pipe b/services/libs/tinybird/pipes/issues_average_resolve_velocity.pipe index ba8728b13e..b2c3e55ff5 100644 --- a/services/libs/tinybird/pipes/issues_average_resolve_velocity.pipe +++ b/services/libs/tinybird/pipes/issues_average_resolve_velocity.pipe @@ -4,8 +4,11 @@ DESCRIPTION > - Only includes issues that have been closed (`isNotNull(closedAt)`) to ensure accurate velocity calculations. - Queries `issues_analyzed` directly for optimal performance using sorting key on `segmentId, channel, openedAt`. - Primary use case: displaying average issue resolution time metrics in development health dashboards. + - The pipe scopes data either to a single project (via `segments_filtered`) or to every project in a + collection (via `segments_filtered_by_collection`). Exactly one of `project`/`collectionSlug` must be given. - Parameters: - - `project`: Required string for project slug (e.g., 'k8s', 'tensorflow') - inherited from `segments_filtered` + - `project`: Project slug (e.g., 'k8s', 'tensorflow') - inherited from `segments_filtered`. Required unless `collectionSlug` is given. + - `collectionSlug`: Collection slug (e.g., 'cncf') - inherited from `segments_filtered_by_collection`. Required unless `project` is given. - `repos`: Optional array of repository URLs for filtering (e.g., ['https://github.com/kubernetes/kubernetes']) - `startDate`: Optional DateTime filter for issues opened after timestamp (e.g., '2024-01-01 00:00:00') - `endDate`: Optional DateTime filter for issues opened before timestamp (e.g., '2024-12-31 23:59:59') @@ -17,7 +20,10 @@ SQL > SELECT round(avg(closedInSeconds)) AS "averageIssueResolveVelocitySeconds" FROM issues_analyzed WHERE - segmentId = (SELECT segmentId FROM segments_filtered) AND isNotNull(closedAt) + {% if defined(collectionSlug) %} + segmentId IN (SELECT segmentId FROM segments_filtered_by_collection) + {% else %} segmentId = (SELECT segmentId FROM segments_filtered) + {% end %} AND isNotNull(closedAt) {% if defined(repos) %} AND channel IN {{ Array(repos, 'String', description="Filter activity repo list", required=False) }} diff --git a/services/libs/tinybird/pipes/pull_requests_average_resolve_velocity.pipe b/services/libs/tinybird/pipes/pull_requests_average_resolve_velocity.pipe index 35f4eeced1..0abe59e0f6 100644 --- a/services/libs/tinybird/pipes/pull_requests_average_resolve_velocity.pipe +++ b/services/libs/tinybird/pipes/pull_requests_average_resolve_velocity.pipe @@ -5,8 +5,11 @@ DESCRIPTION > - Excludes Gerrit platform as it uses a different workflow model. - Queries `pull_requests_analyzed` directly for optimal performance using sorting key on `segmentId, channel, openedAt`. - Primary use case: displaying average PR resolution time metrics in development health dashboards. + - The pipe scopes data either to a single project (via `segments_filtered`) or to every project in a + collection (via `segments_filtered_by_collection`). Exactly one of `project`/`collectionSlug` must be given. - Parameters: - - `project`: Required string for project slug (e.g., 'k8s', 'tensorflow') - inherited from `segments_filtered` + - `project`: Project slug (e.g., 'k8s', 'tensorflow') - inherited from `segments_filtered`. Required unless `collectionSlug` is given. + - `collectionSlug`: Collection slug (e.g., 'cncf') - inherited from `segments_filtered_by_collection`. Required unless `project` is given. - `repos`: Optional array of repository URLs for filtering (e.g., ['https://github.com/kubernetes/kubernetes']) - `startDate`: Optional DateTime filter for PRs opened after timestamp (e.g., '2024-01-01 00:00:00') - `endDate`: Optional DateTime filter for PRs opened before timestamp (e.g., '2024-12-31 23:59:59') @@ -18,10 +21,10 @@ SQL > SELECT round(avg(resolvedInSeconds)) AS "averagePullRequestResolveVelocitySeconds" FROM pull_requests_analyzed WHERE - segmentId = (SELECT segmentId FROM segments_filtered) - AND isNotNull(resolvedAt) - AND resolvedInSeconds > 0 - AND platform != 'gerrit' + {% if defined(collectionSlug) %} + segmentId IN (SELECT segmentId FROM segments_filtered_by_collection) + {% else %} segmentId = (SELECT segmentId FROM segments_filtered) + {% end %} AND isNotNull(resolvedAt) AND resolvedInSeconds > 0 AND platform != 'gerrit' {% if defined(repos) %} AND channel IN {{ Array(repos, 'String', description="Filter activity repo list", required=False) }} diff --git a/services/libs/tinybird/pipes/repositories_populated_copy.pipe b/services/libs/tinybird/pipes/repositories_populated_copy.pipe index 263eb455ee..9c43af99af 100644 --- a/services/libs/tinybird/pipes/repositories_populated_copy.pipe +++ b/services/libs/tinybird/pipes/repositories_populated_copy.pipe @@ -9,7 +9,11 @@ SQL > NODE repositories_populated_copy_contributor_org_counts DESCRIPTION > - Calculate contributor and organization counts per repository (channel) + Calculate contributor and organization counts per repository (channel). + Excludes 'star' and 'fork' activity: stargazers/forkers are engagement, not contributors, + and counting them inflated contributorCount massively for popular repos (e.g. OpenClaw showed + 483K where the true contributor count is ~46K - 404K of those were stargazers). This mirrors + the "contributions only" semantics the widget pipes use via onlyContributions/activityTypes_filtered. SQL > SELECT @@ -17,6 +21,7 @@ SQL > uniq(CASE WHEN memberId != '' THEN memberId ELSE NULL END) AS contributorCount, uniq(CASE WHEN organizationId != '' THEN organizationId ELSE NULL END) AS organizationCount FROM activityRelations_deduplicated_cleaned_bucket_union + WHERE type NOT IN ('star', 'fork') GROUP BY channel NODE repositories_populated_copy_first_commit