This PR aims to craft the /internal/tenant package for use by all Sourcegraph cluster-internal services to properly scope data visibility to the correct requesting tenant.
For now, we only expose methods we know we will DEFINITELY need.
This PR also adds the required middlewares so we can start to tinker with it in implementations.
## Test plan
CI passes. We don't enforce anything for now except not passing unparseable tenant IDs, which should be fine.
There were a bunch of rules put in before this old top-level rule. For
example internal/workerutil was assigned as owned by Stephen, even
though we had a rule for it to be owned by Eric. This was because that
rule was before this catch all rule.
* rcache: Add options param to TryAcquireMutex
* leader: Add a leader package
A small helper package that wraps our Redis based mutex to allow only a
single instance of a function to run concurrently.
* Update CODEOWNERS
* Update internal/rcache/mutex_test.go
Co-authored-by: Asdine El Hrychy <asdine.elhrychy@gmail.com>
* No need for release func
The outler leader loop can release when the worker function returns
* Add jitter and respect ctx during sleep
* Make worker fn to last parameter
Makes it easier to use especially when fn is anonymous
* Improve test
Co-authored-by: Asdine El Hrychy <asdine.elhrychy@gmail.com>
Cloud currently is the codeowner of many files that are modified by
people all over Sourcegraph. As such our whole team is added to code
reviews where our input really isn't required.
There is discussions about removing code owners entirely. This is a step
in that direction for the more egregerious examples of it for cloud. If
you thought it was important the reviewed you did on something I removed
ownership on, please add your own name (instead of team) to the
corresponding directory.
The more specific directives in the campaigns section were overwritten by
the more generalized ones for core-services. Moving them below should fix it.
* internal cmd: GHE repo feeder
* feeder.db and split into files
* org generator
* add loggers
* rate limiter
* complete flow
* save orgs in db
* retry for push and clean up cloned dirs
* more flags instead of hardcoded
* more flags
* metrics and timeouts
* upping timeout
* fix merge conflict
* better metrics
* inc error metric
* process failed on subsequent runs
* custom err
* resume metrics
* metric fix
* clean up cloned dir in all cases
* fix terminal progress bar calculation
* ghe feeder dashboard
* accomodate dave input
* accept dirs when computing work
* rate limit cloning to avoid triggering an abuse detection mechanism
* ability to skip ahead in input and record error type
* golangci-lint
* prettier over dashboard json
* documentation for worker
* pump documentation
* documentation for sqlite feeder DB
* README
* README 2
* doc fixes
* readme prettier
* Update internal/cmd/ghe-feeder/progress.go
Co-authored-by: ᴜɴᴋɴᴡᴏɴ <joe@sourcegraph.com>
* code review joe
* readme explain resume and dashboard
* prettier readme
Co-authored-by: Dave Try <dave@sourcegraph.com>
Co-authored-by: ᴜɴᴋɴᴡᴏɴ <joe@sourcegraph.com>
* a new GQL endpoint, `site.monitoringStatistics`
* just returns alerts for now
* render monitoring statistics in bug report page
* adjust wording in bug report page and link directly to bug report template
Co-authored-by: Stephen Gutekanst <stephen.gutekanst@gmail.com>