feat: [IANDT-237] add active contributor emitter - #697
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
dfe3785 to
3a994a8
Compare
1894254 to
8796cbc
Compare
This comment has been minimized.
This comment has been minimized.
This comment was marked as outdated.
This comment was marked as outdated.
8796cbc to
daf8020
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment has been minimized.
This comment has been minimized.
daf8020 to
52dfb83
Compare
This comment has been minimized.
This comment has been minimized.
52dfb83 to
93074d8
Compare
This comment has been minimized.
This comment has been minimized.
93074d8 to
72ee3b2
Compare
This comment has been minimized.
This comment has been minimized.
4d48142 to
14a9d10
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
|
||
| if commit.Committer.When.Before(since) { | ||
| return storer.ErrStop | ||
| } |
There was a problem hiding this comment.
Committer stop skips author window
Medium Severity
Contributor collection stops the commit walk when commit.Committer.When is before the window, before evaluating commit.Author.When. Billing uses author dates, so commits with a recent author date and an older committer date are dropped entirely, under-reporting active contributors.
Reviewed by Cursor Bugbot for commit 14a9d10. Configure here.
14a9d10 to
5fd0317
Compare
This comment has been minimized.
This comment has been minimized.
5fd0317 to
cd645df
Compare
This comment has been minimized.
This comment has been minimized.
cd645df to
43fe465
Compare
PR Reviewer Guide 🔍
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 43fe465. Configure here.
| name := ref.Name() | ||
| if !name.IsBranch() && !name.IsRemote() { | ||
| return nil | ||
| } |
There was a problem hiding this comment.
Detached HEAD commits never scanned
Medium Severity
Reference iteration only follows local branches and remote-tracking refs. The HEAD ref is skipped, so commits that exist only on a detached HEAD (not on any branch or remote ref) are never walked and their authors are omitted from contributor reporting.
Reviewed by Cursor Bugbot for commit 43fe465. Configure here.


Description
This PR adds an API client for the public submit active contributors endpoint served by the entitlements-service (
internal/apiclients/contributors_ingest), a helper function to collect contributor data (contributors.go) from the Git repository the command is being run in, and an emitter object (emitter.go) which ties the two together, exposing anEmitfunction to perform the work.Checklist
make test)make generate)make lint)go get github.com/snyk/go-application-framework@YOUR_LATEST_GAF_COMMITin thecliv2directory.go.modto point to your local GAF code.go mod tidyin thecliv2directory.go.modandgo.sumchanges.Performance Investigation for counting contributors
Investigation into what % of CLI command runtime counting contributors would add.
Contributor timing =
BenchmarkCollectContributors(-benchtime 5x, avg ns/op) on local clones on my Macbook Pro (M5 Pro).Command timing = Datadog logs,
@analytics-service.runtime.performance.durationMs, 15-day window,service:analytics-servicefiltered to@analytics-service.interaction.target.id:pkg\:git/github.com/snyk/*and the category set per command.Count Contributors benchmark
OSS Monitor (30d, snyk/* targets)
Code --report (30d, snyk/* targets)
IaC --report (30d, snyk/* targets)
Secrets --report
Query restricted to snyk/* targets returns almost nothing (3 repos total, ≤238 samples). The global (all orgs, all targets) 15d stats are: n=2196, avg=13087ms, p50=11971ms, p90=15840ms, p99=32542ms. Contributor overhead against that global baseline:
Summary
This gives global % averages of: min 0.003%, median 0.088%, mean 0.182%, max 3.046%.
In Registry, the cominbation of IaC --report being fast and registry having a large git history means the contributor collection cost is proportionally largest there.
Next largest is deepcode on OSS Monitor at 1.167%, again via a combination of a relatively fast scan and large git history.
For every other repo/command combination, contributor collection is under 1% of command runtime.