Package org.microproxy
Interface FlowTracer
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
Telemetry
Traces the proxy's exchanges and flows: given with
HttpProxyServerBootstrap.withTracer(org.microproxy.FlowTracer),
it is asked for a FlowTrace when each request head arrives, and handed each exchange's
and flow's FlowRecord when it is over. The optional microproxy-otel module
implements it with OpenTelemetry's W3C Trace Context, B3 and Jaeger propagation and OTLP
export; the core only calls it.
Calls run on the exchange's thread and should be quick. NOOP, the default, costs
nothing: the proxy checks for it before calling.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault voidclose()Called once the proxy has stopped, after its exchanges ended: a last chance to flush.default voidflowEnded(FlowRecord record) Called once per finished exchange or flow, with the recordActivityTracker.flowEnded(org.microproxy.FlowRecord)gets:FlowRecord.trace()is the tracestartExchange(org.microproxy.FlowContext, org.microproxy.http.HttpRequest)made, orFlowTrace.NONEfor a flow that had no request of its own (a relayed transparent QUIC flow, a request a transport answered itself).default voidproxyStarted(HttpProxyServer server) Called once a proxy that uses this tracer has started, for instance to read itsstats.startExchange(FlowContext flow, HttpRequest request) Called when a request head arrives from the client, before trackers, authentication and filters see it, so that headers the tracer adds (anX-Request-Id) are seen by all of them and the access log.
-
Field Details
-
NOOP
Traces nothing.
-
-
Method Details
-
startExchange
Called when a request head arrives from the client, before trackers, authentication and filters see it, so that headers the tracer adds (anX-Request-Id) are seen by all of them and the access log. The request may also be aCONNECT(real, or made up for a SOCKS client or a transparent connection), which opens a tunnel or a flow.- Parameters:
flow- the exchange's contextrequest- the request head, which may be changed in place- Returns:
- the exchange's trace, or
FlowTrace.NONEto trace nothing
-
flowEnded
Called once per finished exchange or flow, with the recordActivityTracker.flowEnded(org.microproxy.FlowRecord)gets:FlowRecord.trace()is the tracestartExchange(org.microproxy.FlowContext, org.microproxy.http.HttpRequest)made, orFlowTrace.NONEfor a flow that had no request of its own (a relayed transparent QUIC flow, a request a transport answered itself).- Parameters:
record- the finished exchange or flow
-
proxyStarted
Called once a proxy that uses this tracer has started, for instance to read itsstats.- Parameters:
server- the running proxy
-
close
default void close()Called once the proxy has stopped, after its exchanges ended: a last chance to flush.- Specified by:
closein interfaceAutoCloseable
-