Browse Source

log channel readiness and eventloop for debugging (#676)

Johannes Weiss 6 years ago
parent
commit
a7cb9834bd

+ 1 - 1
Sources/GRPC/ClientConnection.swift

@@ -275,7 +275,7 @@ extension ClientConnection {
       return configuration.eventLoopGroup.next().makeFailedFuture(GRPCStatus.processingError)
     }
 
-    logger.debug("attempting to connect to \(configuration.target)")
+    logger.debug("attempting to connect to \(configuration.target) on \(eventLoop)")
     connectivity.state = .connecting
     let timeoutAndBackoff = backoffIterator?.next()
 

+ 3 - 0
Sources/GRPC/SettingsObservingHandler.swift

@@ -39,6 +39,9 @@ class InitialSettingsObservingHandler: ChannelInboundHandler, RemovableChannelHa
       self.logger.debug("observed initial settings frame on the root stream")
       self.connectivityStateMonitor.state = .ready
 
+      let remoteAddressDescription = context.channel.remoteAddress.map { "\($0)" } ?? "n/a"
+      self.logger.info("gRPC connection to \(remoteAddressDescription) on \(context.eventLoop) ready")
+
       // We're no longer needed at this point, remove ourselves from the pipeline.
       self.logger.debug("removing 'InitialSettingsObservingHandler' from the channel")
       context.pipeline.removeHandler(self, promise: nil)