Closed
Description
Inspired by what Netty currently does.
To assist with debug logging - particularly in the context of asynchronous I/O, HTTP upgrade and HTTP/2 - it would be helpful if the Servlet API exposed some form of tracking ID to help track the following:
- network connection
- identify requests that shared a connection (HTTP keep-alive, HTTP upgrade)
- request within a connection
- particularly for async requests that move between threads, link activity associated with the same request
- must be unique for the current OS process when combined with the network connection ID
- may have additional uniqueness properties
- protocol specific IDs
- HTTP/2 connection and stream
- WebSocket sesison ID
- local address and port
- for correlation with network dumps, other processes
- remote address and port
- for correlation with network dumps, other processes
- container specific
- is there a requirement for this?
The intention is that the ID would correlate with container specific logging, assumming the container uses the same IDs for its internal logging.
"request within a connection" and "protocol specific" look to be equivalent.
The network address and port info could be relatively expensive to obtain. Container specific solutions often have short and long IDs. The would give us:
- getShortID(), returns <connectionID>-<requestID>
- getLongID(), returns <connectionID>-<requestID>-<localAddressAndPort>-<remoteAddressAndPort>[-<customContainer>]
Where:
- connectionID is 8 hex digits (hash code of appropriate object as hex - avoids negative hashCodes as I want to use "-" as the separator)
- requestID depends on protocol
- HTTP - simple counter for the connection
- HTTP/2 - connectionID:streamID
- WebSocket - session ID
- Other - "NONE" or protocol dependent
- localAddressAndPort is IP:port in same format as URL
- remoteAddressAndPort is IP:port in same format as URL
- customContainer
- optional
On ServletRequest or HttpServletRequest? I'm leaning towards ServletRequest.
Metadata
Metadata
Assignees
Labels
No labels