Report QUIC capacity in smoke

This commit is contained in:
2026-05-16 12:50:51 +03:00
parent 49bc003193
commit 8feb6d58fe
2 changed files with 18 additions and 10 deletions
@@ -45,6 +45,7 @@ type smokeReport struct {
FabricVPNPacketFanout int `json:"fabric_vpn_packet_fanout"` FabricVPNPacketFanout int `json:"fabric_vpn_packet_fanout"`
FabricQUICAccepted bool `json:"fabric_quic_accepted"` FabricQUICAccepted bool `json:"fabric_quic_accepted"`
FabricQUICEndpoint string `json:"fabric_quic_endpoint"` FabricQUICEndpoint string `json:"fabric_quic_endpoint"`
FabricQUICPressure int `json:"fabric_quic_capacity_pressure_percent"`
FabricSessionLatencyMS int64 `json:"fabric_session_latency_ms"` FabricSessionLatencyMS int64 `json:"fabric_session_latency_ms"`
FabricSessionEndpoint string `json:"fabric_session_endpoint"` FabricSessionEndpoint string `json:"fabric_session_endpoint"`
PeerEndpoints map[string]any `json:"peer_endpoints"` PeerEndpoints map[string]any `json:"peer_endpoints"`
@@ -145,7 +146,7 @@ func run(ctx context.Context) (smokeReport, error) {
if err != nil { if err != nil {
return smokeReport{}, fmt.Errorf("fabric vpn packet session smoke: %w", err) return smokeReport{}, fmt.Errorf("fabric vpn packet session smoke: %w", err)
} }
fabricQUICAccepted, fabricQUICEndpoint, err := smokeQUICFabricSession(ctx) fabricQUICAccepted, fabricQUICEndpoint, fabricQUICPressure, err := smokeQUICFabricSession(ctx)
if err != nil { if err != nil {
return smokeReport{}, fmt.Errorf("fabric quic smoke: %w", err) return smokeReport{}, fmt.Errorf("fabric quic smoke: %w", err)
} }
@@ -167,6 +168,7 @@ func run(ctx context.Context) (smokeReport, error) {
FabricVPNPacketFanout: fabricVPNPacketFanout, FabricVPNPacketFanout: fabricVPNPacketFanout,
FabricQUICAccepted: fabricQUICAccepted, FabricQUICAccepted: fabricQUICAccepted,
FabricQUICEndpoint: fabricQUICEndpoint, FabricQUICEndpoint: fabricQUICEndpoint,
FabricQUICPressure: fabricQUICPressure,
FabricSessionLatencyMS: fabricSessionLatency.Milliseconds(), FabricSessionLatencyMS: fabricSessionLatency.Milliseconds(),
FabricSessionEndpoint: nodeB.URL + "/mesh/v1/fabric/session/ws", FabricSessionEndpoint: nodeB.URL + "/mesh/v1/fabric/session/ws",
PeerEndpoints: map[string]any{ PeerEndpoints: map[string]any{
@@ -177,17 +179,20 @@ func run(ctx context.Context) (smokeReport, error) {
}, nil }, nil
} }
func smokeQUICFabricSession(ctx context.Context) (bool, string, error) { func smokeQUICFabricSession(ctx context.Context) (bool, string, int, error) {
server, err := mesh.StartQUICFabricServer(ctx, mesh.QUICFabricServerConfig{ server, err := mesh.StartQUICFabricServer(ctx, mesh.QUICFabricServerConfig{
ListenAddr: "127.0.0.1:0", ListenAddr: "127.0.0.1:0",
TLSConfig: smokeQUICTLSConfig(), TLSConfig: smokeQUICTLSConfig(),
}) })
if err != nil { if err != nil {
return false, "", err return false, "", 0, err
} }
defer server.Close() defer server.Close()
endpoint := server.Addr().String() endpoint := server.Addr().String()
session, err := mesh.NewQUICFabricTransport(nil).Connect(ctx, mesh.FabricTransportTarget{ transport := mesh.NewQUICFabricTransport(nil)
defer transport.Close()
session, err := transport.Connect(ctx, mesh.FabricTransportTarget{
PeerID: "node-b",
Endpoint: endpoint, Endpoint: endpoint,
TLSConfig: &tls.Config{ TLSConfig: &tls.Config{
InsecureSkipVerify: true, InsecureSkipVerify: true,
@@ -198,7 +203,7 @@ func smokeQUICFabricSession(ctx context.Context) (bool, string, error) {
ErrorBuffer: 4, ErrorBuffer: 4,
}) })
if err != nil { if err != nil {
return false, endpoint, err return false, endpoint, 0, err
} }
defer session.Close() defer session.Close()
if err := session.Send(ctx, fabricproto.Frame{ if err := session.Send(ctx, fabricproto.Frame{
@@ -206,20 +211,21 @@ func smokeQUICFabricSession(ctx context.Context) (bool, string, error) {
Sequence: uint64(time.Now().UnixNano()), Sequence: uint64(time.Now().UnixNano()),
Payload: []byte("mesh-live-smoke-quic"), Payload: []byte("mesh-live-smoke-quic"),
}); err != nil { }); err != nil {
return false, endpoint, err return false, endpoint, 0, err
} }
timer := time.NewTimer(3 * time.Second) timer := time.NewTimer(3 * time.Second)
defer timer.Stop() defer timer.Stop()
for { for {
select { select {
case frame := <-session.Frames(): case frame := <-session.Frames():
return frame.Type == fabricproto.FramePong && string(frame.Payload) == "mesh-live-smoke-quic", endpoint, nil snapshot := transport.Snapshot()
return frame.Type == fabricproto.FramePong && string(frame.Payload) == "mesh-live-smoke-quic", endpoint, snapshot.CapacityPressurePercent, nil
case err := <-session.Errors(): case err := <-session.Errors():
return false, endpoint, err return false, endpoint, 0, err
case <-timer.C: case <-timer.C:
return false, endpoint, fmt.Errorf("timed out waiting for quic pong") return false, endpoint, 0, fmt.Errorf("timed out waiting for quic pong")
case <-ctx.Done(): case <-ctx.Done():
return false, endpoint, ctx.Err() return false, endpoint, 0, ctx.Err()
} }
} }
} }
@@ -421,6 +421,8 @@ connection count, and capacity pressure percentage next to stream limit rejects.
Closed cached QUIC connections discovered during snapshot generation now update Closed cached QUIC connections discovered during snapshot generation now update
the transport's cumulative eviction counters, keeping successive heartbeats the transport's cumulative eviction counters, keeping successive heartbeats
consistent. consistent.
`mesh-live-smoke` reports QUIC fabric capacity-pressure percentage from the
transport snapshot, verifying that the capacity fields are populated.
Endpoint ranking treats `capacity_limited` observations as a soft pressure Endpoint ranking treats `capacity_limited` observations as a soft pressure
penalty instead of a hard recent failure, enabling load spreading without penalty instead of a hard recent failure, enabling load spreading without
marking the carrier unhealthy. marking the carrier unhealthy.