Prometheus Metrics

quic-go can expose metrics via Prometheus, providing a comprehensive overview of its operation. By leveraging the Tracer and ConnectionTracer interfaces, quic-go captures various events. These are the same interfaces used for qlog event logging.

Enabling Metrics Collection

In your application, expose a Grafana endpoint on http://localhost:5001/prometheus:

import ""

go func() {
    http.Handle("/prometheus", promhttp.Handler())
    log.Fatal(http.ListenAndServe("localhost:5001", nil))

Event that don’t belong to any QUIC connection, such as the sending of Version Negotiation packets, are captured on the Transport.Tracer:

	Tracer: metrics.NewTracer(),

Events belonging to a QUIC connection, such as the reason a connection was closed, are captured on the ConnectionTracer returned from Config.Tracer.

	Tracer: metrics.DefaultConnectionTracer,

πŸ“ Future Work

  • Define more metrics: #4554