/// key=value pairs returned from URL rewrite/redirect helper
NotePairs::Pointer notes;
+ /// The total number of finished attempts to establish a connection.
+ /// Excludes discarded HappyConnOpener attempts. Includes failed
+ /// HappyConnOpener attempts and [always successful] persistent connection
+ /// reuse. See %request_attempts.
+ int requestAttempts = 0;
+
/// see ConnStateData::proxyProtocolHeader_
ProxyProtocol::HeaderPointer proxyProtocolHeader;
transportWait.finish();
- Must(n_tries <= answer.n_tries); // n_tries cannot decrease
- n_tries = answer.n_tries;
+ updateAttempts(answer.n_tries);
ErrorState *error = nullptr;
if ((error = answer.error.get())) {
al->hier.resetPeerNotes(server, host);
}
+/// sets n_tries to the given value (while keeping ALE, if any, in sync)
+void
+FwdState::updateAttempts(const int newValue)
+{
+ Assure(n_tries <= newValue); // n_tries cannot decrease
+
+ // Squid probably creates at most one FwdState/TunnelStateData object per
+ // ALE, but, unlike an assignment would, this increment logic works even if
+ // Squid uses multiple such objects for a given ALE in some esoteric cases.
+ if (al)
+ al->requestAttempts += (newValue - n_tries);
+
+ n_tries = newValue;
+ debugs(17, 5, n_tries);
+}
+
/**
* Called after forwarding path selection (via peer select) has taken place
* and whenever forwarding needs to attempt a new connection (routing failover).
return;
}
- ++n_tries;
+ updateAttempts(n_tries + 1);
+
request->flags.pinned = true;
assert(connManager);
/// whether we have used up all permitted forwarding attempts
bool exhaustedTries() const;
+ void updateAttempts(int);
/// \returns the time left for this connection to become connected or 1 second if it is less than one second left
time_t connectingTimeout(const Comm::ConnectionPointer &conn) const;
* unfinished Happy Eyeballs connection attempts (prevented by setting
happy_eyeballs_connect_limit to 0)
- See also: forward_timeout and connect_retries.
+ See also: forward_timeout, connect_retries, and %request_attempts.
DOC_END
COMMENT_START
Ss Squid request status (TCP_MISS etc)
Sh Squid hierarchy status (DEFAULT_PARENT etc)
+ [http::]request_attempts Number of request forwarding attempts
+
+ See forward_max_tries documentation that details what Squid counts
+ as a forwarding attempt. Pure cache hits log zero, but cache hits
+ that triggered HTTP cache revalidation log the number of attempts
+ made when sending an internal revalidation request. DNS, ICMP,
+ ICP, HTCP, ESI, ICAP, eCAP, helper, and other secondary requests
+ sent by Squid as a part of a master transaction do not increment
+ the counter logged for the received request.
+
SSL-related format codes:
ssl::bump_mode SslBump decision for the transaction:
LFT_SQUID_ERROR,
LFT_SQUID_ERROR_DETAIL,
LFT_SQUID_HIERARCHY,
+ LFT_SQUID_REQUEST_ATTEMPTS,
LFT_MIME_TYPE,
LFT_TAG,
out = hier_code_str[al->hier.code];
break;
+ case LFT_SQUID_REQUEST_ATTEMPTS:
+ outint = al->requestAttempts;
+ doint = 1;
+ break;
+
case LFT_MIME_TYPE:
out = al->http.content_type;
break;
TokenTableEntry(">handshake", LFT_CLIENT_HANDSHAKE),
TokenTableEntry("err_code", LFT_SQUID_ERROR ),
TokenTableEntry("err_detail", LFT_SQUID_ERROR_DETAIL ),
+ TokenTableEntry("request_attempts", LFT_SQUID_REQUEST_ATTEMPTS),
TokenTableEntry("note", LFT_NOTE ),
TokenTableEntry("credentials", LFT_CREDENTIALS),
TokenTableEntry("master_xaction", LFT_MASTER_XACTION),
void cancelStep(const char *reason);
bool exhaustedTries() const;
+ void updateAttempts(int);
public:
bool keepGoingAfterRead(size_t len, Comm::Flag errcode, int xerrno, Connection &from, Connection &to);
al->hier.resetPeerNotes(conn, origin);
}
+/// sets n_tries to the given value (while keeping ALE in sync)
+void
+TunnelStateData::updateAttempts(const int newValue)
+{
+ Assure(n_tries <= newValue); // n_tries cannot decrease
+
+ // Squid probably creates at most one FwdState/TunnelStateData object per
+ // ALE, but, unlike an assignment would, this increment logic works even if
+ // Squid uses multiple such objects for a given ALE in some esoteric cases.
+ al->requestAttempts += (newValue - n_tries);
+
+ n_tries = newValue;
+ debugs(26, 5, n_tries);
+}
+
int
TunnelStateData::Connection::debugLevelForError(int const xerrno) const
{
{
transportWait.finish();
- Assure(n_tries <= answer.n_tries); // n_tries cannot decrease
- n_tries = answer.n_tries;
+ updateAttempts(answer.n_tries);
ErrorState *error = nullptr;
if ((error = answer.error.get())) {
const auto serverConn = ConnStateData::BorrowPinnedConnection(request.getRaw(), al);
debugs(26, 7, "pinned peer connection: " << serverConn);
- ++n_tries;
+ updateAttempts(n_tries + 1);
// Set HttpRequest pinned related flags for consistency even if
// they are not really used by tunnel.cc code.