Commit Graph

41 Commits

Author SHA1 Message Date
Robert Lin
1f7e8d1fcf
log: add log sampling (#38451)
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.
2022-07-08 08:27:09 -07:00
Robert Lin
daa4e0e24c
internal/tracer: add OpenTelemetry tracer (#37984)
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.
2022-07-05 11:28:15 -07:00
Robert Lin
e873ba23b3
mod: update github.com/sourcegraph/log (#38186)
The main change included here is https://github.com/sourcegraph/log/pull/17
2022-07-04 18:51:54 +00:00
Jean-Hadrien Chabran
7f5437fe03
Bump sourcegraph/log (#38178) 2022-07-04 20:09:46 +02:00
Erik Seliger
a9e2810c52
Use latest version of log library (#37538) 2022-06-22 12:05:31 +02:00
Robert Lin
9ad9dc1982
output: add ReadPassword for securely reading password (#37162) 2022-06-15 18:28:34 +00:00
Robert Lin
0d0932c7c3
deps: upgrade github.com/sourcegraph/log (#37138)
This includes:

- https://github.com/sourcegraph/log/pull/2
- https://github.com/sourcegraph/log/pull/4
- https://github.com/sourcegraph/log/pull/3
2022-06-14 09:00:29 -07:00
Robert Lin
95c6946b9d
lib/log: migrate to github.com/sourcegraph/log (#36834)
This change migrates lib/log to https://github.com/sourcegraph/log in the hopes of easing adoption for other services.
2022-06-08 15:02:38 -07:00
Jean-Hadrien Chabran
9ea2cb7128
Add a logger sink to export errors to Sentry transparently (#35879)
Co-authored-by: Robert Lin <robert@bobheadxi.dev>
2022-06-07 16:29:03 +00:00
Robert Lin
b2779c2221
lib: remove all usages of log15 (#36259) 2022-05-30 17:53:05 -07:00
Andre Eleuterio
709793f1fb
Upgrading dependencies (#36185)
* upgrade golang dependencies

* go mod tidy

* go mod tidy

* bump eventsource

* bump goland tools

Co-authored-by: Dave Try <davetry@gmail.com>
2022-05-30 10:43:58 -03:00
Robert Lin
f96ffaaaad
lib/output: migrate WriteMarkdown to shared Output implementation (#35719)
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.
2022-05-19 16:40:44 +00:00
Keegan Carruthers-Smith
fbdeae5779
lib: use go1.18 as a minimum version (#35103)
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
2022-05-09 15:46:16 +02:00
Robert Lin
dfeb07ac1c
lib/log: initial implementation (#33956)
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>
2022-04-21 12:58:50 -07:00
Robert Lin
fe428b20e2
lib/errors: new MultiError error type and utilities (#31466)
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>
2022-02-18 11:07:02 -08:00
Ólafur Páll Geirsson
08efb1505a
LSIF Typed: add command-line tool to emit Graph (#30307)
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.
2022-02-18 09:08:48 +00:00
Keegan Carruthers-Smith
039b26201f
all: replace regexp with grafana/regexp (#30948)
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.
2022-02-14 09:08:21 +00:00
Thorsten Ball
bef1dd5e8b
sg: refactor process output piping to use errgroups (#31081) 2022-02-11 16:34:29 +00:00
Keegan Carruthers-Smith
970adc8cd7
go get -u -t ./... (#30628)
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.
2022-02-04 09:59:05 +02:00
Ólafur Páll Geirsson
b53853a339
RFC 519: Add LSIF typed schema (#29457) 2022-01-11 16:16:12 -06:00
Adam Harvey
6e51851fbb
batches: support multiple target branches (#28168) 2021-12-07 18:22:35 -08:00
Keegan Carruthers-Smith
1510f630ce
gomod: go get -u -t ./... (#28610) 2021-12-06 15:40:41 +02:00
Thorsten Ball
3f3feb72cd
Convert lsif-validate to use lib/output instead of pentimento (#27205) 2021-11-09 09:55:31 +00:00
Keegan Carruthers-Smith
b0963e0c9a
gomod: go get -u -t ./... (#27262)
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
2021-11-09 10:41:50 +02:00
Thorsten Ball
2b2516676f
Extract createChangesetSpecs from src-cli (#26997) 2021-11-04 10:35:37 +01:00
Keegan Carruthers-Smith
8246d01903
gomod: go get -u -t ./internal/search/... (#26275)
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.
2021-10-19 13:01:16 +00:00
Erik Seliger
648e35b48d
Move batch-change-utils into monorepo (#24926)
We've been sharing more and more code in here between src-cli and sourcegraph anyways, so I think this is a reasonable step.
2021-09-14 11:49:04 +02:00
Erik Seliger
71593bf836
Remove id and default branch from TemplatingRepository (#24553) 2021-09-02 23:54:18 +02:00
Erik Seliger
cc5a3f7fd2
src-cli: Move template package into lib (#24499) 2021-09-01 16:29:05 +02:00
Erik Seliger
5780c9c4b4
src-cli: Move git package to lib (#24498) 2021-09-01 15:26:14 +02:00
Erik Seliger
4e945b8aa8
Move types and parser for BatchSpec files into shared lib (#24207)
Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
2021-08-23 15:56:47 +02:00
Adam Harvey
68264e4ab3
lib/output: various tweaks to terminal handling (#22375)
Co-authored-by: Erik Seliger <erikseliger@me.com>
Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
2021-06-28 08:18:18 -07:00
Eric Fritz
17b794852a
chore: Update go-mockgen (#22076) 2021-06-15 08:10:55 -05:00
Indradhanush Gupta
a1075bf6b8
all: Replace github.com/pkg/errors with github.com/cockroachdb/errors (#21684)
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>
2021-06-11 13:49:21 +05:30
Noah S-C
1246e4353a
efritz/go-mockgen -> derision-test/go-mockgen (#21734) 2021-06-04 13:40:44 +01:00
Eric Fritz
520a2ae26a
codeintel: Refactor upload package (#21159) 2021-05-20 18:18:24 -05:00
Eric Fritz
4bea97972d
codeintel: Refactor inference code (#20993) 2021-05-17 18:33:49 +00:00
Eric Fritz
9158fdf0f4
codeintel: Move ./enterprise/lib to ./lib (#20969)
* Move enterprise/lib/codeintel/* to lib.
2021-05-13 19:17:14 -07:00
Thorsten Ball
926f80c224
Extract output pkg from src-cli into lib/output (#20348)
Extract `output` pkg from `src-cli` into `lib/output` and use it in `dev/sg`
2021-04-23 14:56:33 +00:00
Erik Seliger
18971e0131
Don't depend on repo package for batch changes (#19930)
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)
2021-04-14 16:17:52 +02:00
Eric Fritz
12bf303aa0
lib: Introduce non-enterprise lib directory (#18992) 2021-03-10 19:41:33 -06:00