Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metrics: add an example Grafana dashboard #4559

Merged
merged 2 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 11 additions & 20 deletions metrics/dashboards/README.md
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:https://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:https://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.
Loading
Loading