Skip to content

Commit

Permalink
appease the linter? no longer runs locally
Browse files Browse the repository at this point in the history
  • Loading branch information
dgottlieb committed Nov 18, 2024
1 parent 820b67a commit 6498239
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 21 deletions.
45 changes: 24 additions & 21 deletions rpc/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down Expand Up @@ -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)
}
}

Expand Down Expand Up @@ -882,11 +885,11 @@ func (ss *simpleServer) Stop() error {
}

type SimpleServerStats struct {

Check failure on line 887 in rpc/server.go

View workflow job for this annotation

GitHub Actions / Build and Test

exported: exported type SimpleServerStats should have comment or be unexported (revive)
TcpGrpcStats TcpGrpcStats
TCPpGrpcStats TCPpGrpcStats
WebRTCGrpcStats WebRTCGrpcStats
}

type TcpGrpcStats struct {
type TCPpGrpcStats struct {

Check failure on line 892 in rpc/server.go

View workflow job for this annotation

GitHub Actions / Build and Test

exported: exported type TCPpGrpcStats should have comment or be unexported (revive)
RequestsStarted int64
WebRequestsStarted int64
OtherRequestsStarted int64
Expand All @@ -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(),
}
Expand Down
1 change: 1 addition & 0 deletions rpc/wrtc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ type webrtcServer struct {
}
}

// WebRTCGrpcStats are stats of the webrtc variety.
type WebRTCGrpcStats struct {
PeersConnected int64
PeersDisconnected int64
Expand Down

0 comments on commit 6498239

Please sign in to comment.