Pulsar Proxy is almost a gateway for all pulsar requests, it could be useful if it can record more details for the traffic, like source, target, session id, response time for each request, even for request message body. For request message body, we need a “switch” to enable/disable this, due to it could make proxy a bit slower.
Currently we have for proxy:
What we will have in proxy log for each request to Proxy from client:
And also a new config for enable/disable msg body
// Proxy log level, default is 0. // 0: Do not log any tcp channel info // 1: Parse and log any tcp channel info and command info without message bod // 2: Parse and log channel info, command info and message body proxyLogLevel=0
Log Example could be:
07:27:28.930 [pulsar-discovery-io-2-27] INFO org.apache.pulsar.proxy.server.ParserProxyHandler - frontendconn:[/clientip:port/proxyip:port] cmd:SEND msg:[11914] my-message 07:50:33.179 [pulsar-discovery-io-2-2] INFO org.apache.pulsar.proxy.server.ParserProxyHandler - backendconn:[/brokerip:port/proxyip:port] cmd:MESSAGE msg:[1396163] msg
Potential mainly change these codes:
ProxyConnection.java and ConnectionPool.java main logic for getting client info and keep it proxy, record the response time and get request msg boday when proxy send request to broker.
AdminProxyHandler.java enable/disable msg body output
ProxyService.java new metrics process