From 649823941b4d2ba80b500a5c94f9cc76dca0c921 Mon Sep 17 00:00:00 2001 From: Dan Gottlieb Date: Mon, 18 Nov 2024 10:53:27 -0500 Subject: [PATCH] appease the linter? no longer runs locally --- rpc/server.go | 45 ++++++++++++++++++++++++--------------------- rpc/wrtc_server.go | 1 + 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/rpc/server.go b/rpc/server.go index 0d4ce43e..fde48419 100644 --- a/rpc/server.go +++ b/rpc/server.go @@ -152,13 +152,16 @@ type simpleServer struct { // authIssuer is the JWT issuer (iss) that will be used for our service. authIssuer string + // counters are for reporting FTDC metrics. A `simpleServer` sets up both a grpc server wrapping + // a standard http2 over TCP connection. And it also sets up grpc services for webrtc + // PeerConnections. These counters are specifically for requests coming in over TCP. counters struct { - TcpGrpcRequestsStarted atomic.Int64 - TcpGrpcWebRequestsStarted atomic.Int64 - TcpOtherRequestsStarted atomic.Int64 - TcpGrpcRequestsCompleted atomic.Int64 - TcpGrpcWebRequestsCompleted atomic.Int64 - TcpOtherRequestsCompleted atomic.Int64 + TCPpGrpcRequestsStarted atomic.Int64 + TCPpGrpcWebRequestsStarted atomic.Int64 + TCPpOtherRequestsStarted atomic.Int64 + TCPpGrpcRequestsCompleted atomic.Int64 + TCPpGrpcWebRequestsCompleted atomic.Int64 + TCPpOtherRequestsCompleted atomic.Int64 } } @@ -735,19 +738,19 @@ func (ss *simpleServer) ServeHTTP(w http.ResponseWriter, r *http.Request) { r = requestWithHost(r) switch ss.getRequestType(r) { case requestTypeGRPC: - ss.counters.TcpGrpcRequestsStarted.Add(1) + ss.counters.TCPpGrpcRequestsStarted.Add(1) ss.grpcServer.ServeHTTP(w, r) - ss.counters.TcpGrpcRequestsCompleted.Add(1) + ss.counters.TCPpGrpcRequestsCompleted.Add(1) case requestTypeGRPCWeb: - ss.counters.TcpGrpcWebRequestsStarted.Add(1) + ss.counters.TCPpGrpcWebRequestsStarted.Add(1) ss.grpcWebServer.ServeHTTP(w, r) - ss.counters.TcpGrpcWebRequestsCompleted.Add(1) + ss.counters.TCPpGrpcWebRequestsCompleted.Add(1) case requestTypeNone: fallthrough default: - ss.counters.TcpOtherRequestsStarted.Add(1) + ss.counters.TCPpOtherRequestsStarted.Add(1) ss.grpcGatewayHandler.ServeHTTP(w, r) - ss.counters.TcpOtherRequestsCompleted.Add(1) + ss.counters.TCPpOtherRequestsCompleted.Add(1) } } @@ -882,11 +885,11 @@ func (ss *simpleServer) Stop() error { } type SimpleServerStats struct { - TcpGrpcStats TcpGrpcStats + TCPpGrpcStats TCPpGrpcStats WebRTCGrpcStats WebRTCGrpcStats } -type TcpGrpcStats struct { +type TCPpGrpcStats struct { RequestsStarted int64 WebRequestsStarted int64 OtherRequestsStarted int64 @@ -897,13 +900,13 @@ type TcpGrpcStats struct { func (ss *simpleServer) Stats() any { return SimpleServerStats{ - TcpGrpcStats: TcpGrpcStats{ - RequestsStarted: ss.counters.TcpGrpcRequestsStarted.Load(), - WebRequestsStarted: ss.counters.TcpGrpcWebRequestsStarted.Load(), - OtherRequestsStarted: ss.counters.TcpOtherRequestsStarted.Load(), - RequestsCompleted: ss.counters.TcpGrpcRequestsCompleted.Load(), - WebRequestsCompleted: ss.counters.TcpGrpcWebRequestsCompleted.Load(), - OtherRequestsCompleted: ss.counters.TcpOtherRequestsCompleted.Load(), + TCPpGrpcStats: TCPpGrpcStats{ + RequestsStarted: ss.counters.TCPpGrpcRequestsStarted.Load(), + WebRequestsStarted: ss.counters.TCPpGrpcWebRequestsStarted.Load(), + OtherRequestsStarted: ss.counters.TCPpOtherRequestsStarted.Load(), + RequestsCompleted: ss.counters.TCPpGrpcRequestsCompleted.Load(), + WebRequestsCompleted: ss.counters.TCPpGrpcWebRequestsCompleted.Load(), + OtherRequestsCompleted: ss.counters.TCPpOtherRequestsCompleted.Load(), }, WebRTCGrpcStats: ss.webrtcServer.Stats(), } diff --git a/rpc/wrtc_server.go b/rpc/wrtc_server.go index 74f5b384..344c8125 100644 --- a/rpc/wrtc_server.go +++ b/rpc/wrtc_server.go @@ -59,6 +59,7 @@ type webrtcServer struct { } } +// WebRTCGrpcStats are stats of the webrtc variety. type WebRTCGrpcStats struct { PeersConnected int64 PeersDisconnected int64