mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 18:51:59 +00:00
Our first usage of [the recently stabilized OpenTelemetry metrics](https://opentelemetry.io/docs/specs/otel/metrics/) 😁 Currently this is Cody-Gateway-specific, nothing is added for Sourcegraph as a whole. We add the following: - If a GCP project is configured, we set up a GCP exporter that pushes metrics periodically and on shutdown. It's important this is push-based as Cloud Run instances are ephemeral. - Otherwise, we set up a Prometheus exporter that works the same as using the Prometheus SDK, where metrics are exported in `/metrics` (set up by debugserver) and Prometheus scrapes periodically. To start off I've added a simple gauge that records concurrent ongoing requests to upstream Cody Gateway services - see test plan below. Closes https://github.com/sourcegraph/sourcegraph/issues/53775 ## Test plan I've only tested the Prometheus exporter. Hopefully the GCP one will "just work" - the configuration is very similar to the one used in the tracing equivalent, and that one "just worked". ``` sg start dotcom sg run prometheus ``` See target picked up: <img width="1145" alt="Screenshot 2023-07-19 at 7 09 31 PM" src="https://github.com/sourcegraph/sourcegraph/assets/23356519/c9aa4c06-c817-400e-9086-c8ed6997844e"> Talk to Cody aggressively: <img width="1705" alt="image" src="https://github.com/sourcegraph/sourcegraph/assets/23356519/fbda23c7-565f-4a11-ae1b-1bdd8fbceca1"> |
||
|---|---|---|
| .. | ||
| oteldefaults | ||
| BUILD.bazel | ||
| CODENOTIFY | ||
| conf.go | ||
| doc.go | ||
| logged_otel.go | ||
| otel_should_trace.go | ||
| otel.go | ||
| tracer.go | ||
| watch_test.go | ||
| watch.go | ||