Commit Graph

9 Commits

Author SHA1 Message Date
Noah S-C
9b6ba7741e
bazel: transcribe test ownership to bazel tags (#62664) 2024-05-16 15:51:16 +01:00
Robert Lin
b28b962fba
sg: improve positional completions (#58569)
Improves positional completions added for `sg msp` in #58538 by checking for partial flag input (`-` and `--`), which now complete flags correctly, and also improving the way we build positional argument completions with a more robust helper, `completions.CompletePositionalArgs`.
2023-11-27 16:30:59 -08:00
William Bezuidenhout
1ae6cc6bfd
logger: update log lib and remove use of description (#57690)
* log: remove use of description paramter in Scoped

* temporarily point to sglog branch

* bazel configure + gazelle

* remove additional use of description param

* use latest versions of zoekt,log,mountinfo

* go.mod
2023-10-18 17:29:08 +02:00
Jean-Hadrien Chabran
bc5490c4bb
bazel: introduce build files for Go (#46770) 2023-01-23 14:00:01 +01:00
Robert Lin
40eedcac19
monitoring: extract into a submodule (#45786)
This change extracts `monitoring` into a submodule for import in `sourcegraph/controller` (https://github.com/sourcegraph/controller/pull/195) so that we can generate dashboards for Cloud instances. These steps were required:

1. Initialize a `go.mod` in `monitoring`
2. Extract `dev/sg/internal/cliutil` into `lib` to avoid illegal imports from `monitoring`
3. Add local replaces to both `sourcegraph/sourcegraph` and `monitoring`
4. `go mod tidy` on all submodules
5. Update `go generate ./monitoring` commands to use `sg`, since the `go generate` command no longer works
6. Update `grafana/build.sh`, `prometheus/build.sh` to build the submodule
7. Amend linters to check for multiple `go.mod` files and ban imports of `github.com/sourcegraph/sourcegraph`
8. Update `sg generate go` to run in directories rather than from root

The only caveat is that if you use VS code, you will now need to open `monitoring` in a separate workspace or similar, like with `lib`.

Co-authored-by: Joe Chen <joe@sourcegraph.com>
2022-12-19 17:49:25 +00:00
Robert Lin
0178f3333a
monitoring: make -multi-instance-groupings only generate multi-instance stuffs (#45012) 2022-12-01 20:08:27 +00:00
Robert Lin
79436af733
monitoring: add stub implementation for multi-instance dashboard (#44748)
Lays some groundwork for generating a new dashboard of panels that aggregate metrics per-instance across multiple instances. The result will be that engineers can opt-in their panel to be included on this multi-instance dashboard with `(Observable).MultiInstance`, upon which we:

- add `project_id` (via parameterized groupings) to all aggregation expressions on the observable panel
- add `- {{project_id}}` (via parameterized groupings) to all label templates on the observable panel
- add the observable panel to a row representing the dashboard in the multi-instance dashboard

The opt-in is mainly because many dashboards do not work well when aggregated per-Cloud-instance. For example, a per-gitserver-instance will have thousands of time series when aggregated per-Cloud-instance, and similarly for other high-dimensionality. This allows us to curate a set of dashboards that give useful cross-instance signals. Eventually, we want to add template variables to allow selecting by instance.

This feature is very much a work-in-progress, but merging to iterate in main.
2022-11-29 11:11:30 -08:00
Daniel Dides
09786101a1
sg: allow injecting custom headers to Grafana (#42461)
* sg: allow injecting custom headers to Grafana

* Update monitoring/monitoring/generator.go

Co-authored-by: Robert Lin <robert@bobheadxi.dev>

* Update monitoring/command/generate.go

Co-authored-by: Robert Lin <robert@bobheadxi.dev>

* sg: move RoundTripper to subpackage

* Update monitoring/monitoring/generator.go

Co-authored-by: Robert Lin <robert@bobheadxi.dev>

* sg: add "grafana.folder" argument to monitoring (#42542)

* sg: add "grafana.folder" argument to monitoring

* monitoring: support folders, streamline generation (#42545)

* sg monitoring: do not generate UIDs when folder is specified (#42603)

* sg: allow option to have grafana generate uid

* sg: use folder-dashboard as uid

* sg: add docs about dashboard uids

* lint

Co-authored-by: Robert Lin <robert@bobheadxi.dev>

* nit

* docs

Co-authored-by: Robert Lin <robert@bobheadxi.dev>
2022-10-07 14:43:25 -05:00
Robert Lin
401c851276
dev/sg: integrate monitoring generator with 'sg monitoring generate' (#41703)
As the complexity of the generator grows, it will be valuable to have some more structured control over the CLI, so we add a command that can be used to have 1:1 parity with the existing 'go run ./monitoring' while enabling more advanced options that can be enabled in sg, which now has the following commands:

  sg monitoring generate   # similar to `go generate ./monitoring`, with more options
  sg monitoring dashboards # misc command to show we can add more stuff like listing alerts in the future

This also adds the Grafana/Prometheus URLs as options to take advantage of having the self-documenting options, and also creates a new package dev/sg/cliutil to allow access to the completions utilities.
2022-09-21 09:00:16 -07:00