forked from quic-go/quic-go
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
metrics: add an example Grafana dashboard (quic-go#4559)
* metrics: add an example Grafana dashboard * metrics: rename Handshake Duration to Handshake Latency Co-authored-by: sukun <[email protected]> --------- Co-authored-by: sukun <[email protected]>
- Loading branch information
1 parent
0c84297
commit 4d0562d
Showing
2 changed files
with
739 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,24 @@ | ||
# quic-go Prometheus / Grafana setup | ||
# quic-go Prometheus / Grafana Local Development Setup | ||
|
||
Expose a Grafana endpoint on `http://localhost:5001/prometheus`: | ||
For local development and debugging, it can be useful to spin up a local Prometheus and Grafana instance. | ||
|
||
Please refer to the [documentation](https://quic-go.net/docs/quic/metrics/) for how to configure quic-go to expose Prometheus metrics. | ||
|
||
The configuration files in this directory assume that the application exposes the Prometheus endpoint at `http://localhost:5001/prometheus`: | ||
```go | ||
import "github.com/prometheus/client_golang/prometheus/promhttp" | ||
|
||
go func() { | ||
http.Handle("/prometheus", promhttp.Handler()) | ||
log.Fatal(http.ListenAndServe(":5001", nil)) | ||
log.Fatal(http.ListenAndServe("localhost:5001", nil)) | ||
}() | ||
``` | ||
|
||
Set a metrics tracer on the `Transport`: | ||
```go | ||
quic.Transport{ | ||
Tracer: metrics.NewTracer(), | ||
} | ||
``` | ||
|
||
When using multiple `Transport`s, it is recommended to use the metrics tracer struct for all of them. | ||
|
||
|
||
Set a metrics connection tracer on the `Config`: | ||
```go | ||
quic.Config{ | ||
Tracer: metrics.DefaultConnectionTracer, | ||
} | ||
``` | ||
Prometheus and Grafana can be started using Docker Compose: | ||
|
||
Running: | ||
```shell | ||
docker-compose up | ||
docker compose up | ||
``` | ||
|
||
[quic-go.json](./quic-go.json) contains the JSON model of an example Grafana dashboard. |
Oops, something went wrong.