Enables log sampling by default for Sourcegraph components that use the new internal logging library - the first 100 identical log entries per second will always be output, but thereafter only every 100th identical message will be output. It can be configured for each service using the environment variables SRC_LOG_SAMPLING_INITIAL and SRC_LOG_SAMPLING_THEREAFTER, and if SRC_LOG_SAMPLING_INITIAL is set to 0 or -1 the sampling will be disabled entirely.
We extend internal/tracer to support a new tracer type, "opentelemetry", that sends everything in OpenTelemetry format using the OpenTracing bridge. See https://github.com/sourcegraph/sourcegraph/pull/37984 for more details.
This enables other tooling to take advantage of nice formatting, and also means we can integrate with some internal features, such as color toggling and terminal width detection.
Now we can also use go1.18 features in lib package. The main consumer of
lib outside of the monorepo is src-lib. I have sent a PR to update it to
use go1.18. Otherwise other uses of lib haven't updated in a long time.
Test Plan: go test
This introduces a new logging library we plan to enforce as the standard for logging at Sourcegraph - see https://github.com/sourcegraph/sourcegraph/issues/33192 for more details.
Co-authored-by: Eric Fritz <eric@eric-fritz.com>
Wholesale migration away from go-multierror into a custom multierror implementation that is fully compatible with cockroachdb/errors, prints all errors, can be introspected with Is, As, and friends, and more. The new MultiError type is only available as an interface.
Co-authored-by: Camden Cheek <camden@ccheek.com>
This commit is large because it also adds a new DSL for testing LSIF behavior. Previously, it was difficult to write minimized examples that reproduce bugs related to code navigations. We typically implemented new LSIF features directly with a heavy-duty indexer like lsif-go or lsif-java. Now, we can implement new LSIF features with the testing DSL instead, which (hopefully) increases the development velocity at which we can iterate on new LSIF features.
grafana/regexp's speedup branch contains the stdlib regexp with multiple
patches applied to speed up regexp. The benchmark improvements are quite
impressive across the board. The series of patches are being considered
for inclusion in golang. I took a look over them, and they look legit
enough for us to start using it.
This commit replaces all uses of regexp with grafana/regexp. This
replacement was done via a simple string replace on
^\s*"regexp"
Followed by goimports -w across the repository. I then manually
inspected each result to ensure it was on an import.
Ran on all sub gomodules as well
find . -name go.mod -exec dirname '{}' \; | while read -r d; do
pushd $d;
go get -u -t ./...;
go mod tidy;
popd;
done
Additionally had to make a code change to the extsv/auth pkg.
jwt.StandardClaims is deprecated and suggests using this struct instead.
Using this struct means we no longer pass in a unix timestamp, but
instead a timestamp controlled by the jwt package. This should have the
same behaviour.
Actually ran it over all our submodules:
find . -name go.mod -exec dirname '{}' \; | while read -r d; do
pushd $d;
go get -u -t ./...;
go mod tidy;
popd;
done
Just updating a subset of our dependencies.
We also need to revert "ci: determine which tests to run by diffing with
previous builds" since it was breaking CI for this change. This reverts
commit 65012a0b36.
In this commit, along with moving to
github.com/cockroachdb/errors, we update a few tests and some
error checks in non-test code.
List of files that have code changes apart from changes in the
error package import:
enterprise/internal/batches/sources/gitlab.go
enterprise/internal/batches/sources/gitlab_test.go
internal/conf/client.go
internal/store/store_test.go
Co-authored-by: ᴜɴᴋɴᴡᴏɴ <joe@sourcegraph.com>
This PR refactors `ChangesetSource` to live in the recently introduced `sources` package, because it has essentially nothing to do with `internal/repos`. Also, this means that we don't need to use a `repos.Sourcer` to get a `RepoSource` and then try to cast it to a `ChangesetSource`. All logic that someone else at Sourcegraph might want to utilize in the future is still accessible, as methods on the `internal/extsvc` client implementations. This is _just an abstraction layer_ to use those clients for predefined actions in Batch Changes. This also removes the need for an open source package for our types, so say hello to the `types` package (Yes, Adam's scheduler code can stay our precious enterprise code now!)
90% of the diff is just renaming `batches` to `btypes` and moving the sources methods into the `sources` package. The main magic is that no major changes needed to be done to any of our packages.
Also, some types that were in the store package (for no reason other than "shouldn't be in OSS" are moved into the `types` package now, for consistency)
Follow-up tasks (when we get to it):
- Rename `Source` to something that we think this _really_ is - the name is just borrowed
- We can potentially refactor the setup of the sources a bit
- Once we have it: Don't use external services in this whole package at all, just code host configs, when the code host RFC is implemented (shiny future-talk, I know)