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`.
* 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
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>
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.
* 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>
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.