-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Log davs:// https:// transfer stats in the logs #1536
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Justas!
Looks great! Thanks for the contribution! A few minor items, mostly on styling. I'm happy with the approach, of course, because it's quite similar to what is done in XrdTpc
.
Brian
src/XrdHttp/XrdHttpReq.cc
Outdated
prot->rec.paramsSet = true; | ||
prot->rec.filename = resource.c_str(); | ||
prot->rec.remote = prot->SecEntity.host; | ||
prot->rec.name = prot->SecEntity.name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SecEntity.name
is potentially a nullptr
. If it's an unauthenticated client (plain HTTP), this will segfault.
src/XrdHttp/XrdHttpReq.cc
Outdated
prot->SendSimpleResp(200, NULL, NULL, (char *) mydata->data, mydata->len, keepalive); | ||
reset(); | ||
return keepalive ? 1 : -1; | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please avoid non-essential whitespace movement in a commit with functional changes.... can you undo these and squash?
src/XrdHttp/XrdHttpProtocol.cc
Outdated
@@ -184,6 +184,7 @@ SecEntity(""), CurrentReq(this) { | |||
Addr_str = 0; | |||
Reset(); | |||
ishttps = imhttps; | |||
rec = LogRecord(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the reset of rec
be in the Reset()
function? That function is called whenever the XrdHttpProtocol
object is reused for future, unrelated requests.
src/XrdHttp/XrdHttpReq.cc
Outdated
// | ||
if (!prot->rec.paramsSet) { | ||
prot->rec.paramsSet = true; | ||
prot->rec.filename = resource.c_str(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What c_str()
here instead off the copy constructor?
// Do a Stat | ||
if (prot->doStat((char *) resourceplusopaque.c_str())) { | ||
XrdOucString errmsg = "Error stating"; | ||
errmsg += resource.c_str(); | ||
logTransferEvent(TRACE_STATSALL, 404,(char *) errmsg.c_str()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the const-cast here? That suggests maybe the definition of logTransferEvent
is wrong?
src/XrdHttp/XrdHttpReq.cc
Outdated
prot->rec.status = retval; | ||
std::stringstream ss; | ||
ss << "retval="<< prot->rec.status << ", filename=" << prot->rec.filename; | ||
ss << ", user=" << prot->rec.name << ", reqtype=" << prot->rec.reqtype; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we skip the user=
record when rec.name
is empty?
src/XrdHttp/XrdHttpReq.cc
Outdated
|
||
void XrdHttpReq::logTransferEvent(const int debug, const int retval, const char *message) | ||
{ | ||
if (retval != -1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we short circuit the creation of the std::stringstream
if all debugging is disabled?.
0abff3f
to
e4ab758
Compare
e4ab758
to
65a2cca
Compare
Before I merge this I will wait some comments about the issue I raised in pull request 1529 (i.e. using a monitoring stream for this level of detail) from you and Brian. |
@bbockelm Can you comment on this and can we get this finally merged, so it reaches 5.4 xrootd release? |
OK, so what we actually did, in keeping with xroot philosophy, is to report TPC details in the G-stream. The philosophy is that statistics are only to be reported in a monitoring stream. The log file is not to be used for such purposes (no matter how popular that seems to be in K8s). Hence, I am closing this pull request. |
This is what it will give in the logs (based on the http.trace flag
stats|statsall
:There might be need to change/add more TRACE - but this can be done later.
@bbockelm please review. Thanks!