-
Notifications
You must be signed in to change notification settings - Fork 528
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
Improve YAML compliance of mgr:jobs report #1794
base: master
Are you sure you want to change the base?
Conversation
Current master output: job5:
type: 'Http1::Server'
status: [ job5]
job6:
type: 'ClientHttpRequest'
status: [ job6]
started: false
job4:
type: 'Comm::TcpAcceptor'
status: FD 15, [::] [ job4] notice the unnecessary indent, and confusing array for most "status" fields Proposed output: job6:
type: ClientHttpRequest
started: No
job5:
type: Http1::Server
started: Yes
job4:
type: Comm::TcpAcceptor
status: FD 15, [::]
started: Yes |
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.
This PR requires a lot more work.
src/base/AsyncJob.cc
Outdated
if (job->stopReason) | ||
os << indent << indent << "stopped: '" << job->stopReason << "'\n"; | ||
os << job->id << ":\n"; | ||
os << indent << "type: " << job->typeName << '\n'; |
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.
You may want to review discussions that led to this recently added code. Did we make a mistake when deciding that typeName should be quoted?
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.
In yaml, quoting is optional unless there's a risk of
misinterpreting the element's type. I removed the quotes
as I don't think there is such a risk, but I can just add it back
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.
added back
{ | ||
static MemBuf buf; | ||
buf.reset(); | ||
|
||
buf.append(" [", 2); |
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.
A PR changing many (all?) AsyncJob::status() implementations should fix that API to allow for compounded base+kid+gradkid status reports. We probably want to split that API into two because the current status() is used in many debugs() messages where output requirements are rather different (this PR probably breaks some of those use cases).
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.
It is possible that it breaks some use cases by missing out on spacing, I've fixed what I could find.
I'm not convinced that it's necessary to have two different functions to report status, in the end the only difference is formatting, isn't it?
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.
the only difference is formatting, isn't it?
No, it is not, not for any reasonable definition of "formatting" in this context.
debugs() status():
- target audience: developers (that can easily decipher cryptic output by reading Squid code)
- should be very compact -- often added to many (already long) debugs() lines
- should be fairly fast -- used often when debugging at level 3+
job state reported inside a mgr:jobs report:
- target audience: admins (humans that do not read Squid code) and their tools
- output size is not a concern; new lines and such are very useful for readability
- output speed is not a significant concern
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.
@yadij requested your review on: Improve YAML compliance of mgr:jobs report.
I am not sure why my re-review was requested before any attempt to address my change request. FWIW, until this change request is addressed, polishing minor PR changes is likely to result in quite a few wasted cycles because at least some of that polishing will need to be redone after this change request is addressed.
If there is interest, I can suggest a way to reshape this PR to avoid modifying existing status() implementations (which triggers status() API change requests and other complications) while still providing YAML-compliant mgr:jobs reports.
I think all outstanding requests for change are addressed |
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.
just some polish now.
@@ -133,12 +133,12 @@ BodyPipe::BodyPipe(Producer *aProducer): theBodySize(-1), | |||
// TODO: teach MemBuf to start with zero minSize | |||
// TODO: limit maxSize by theBodySize, when known? | |||
theBuf.init(2*1024, MaxCapacity); | |||
debugs(91,7, "created BodyPipe" << status()); | |||
debugs(91,7, "created BodyPipe " << status()); |
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 take advantage of the touch to make this produce the log pattern detected by the scripts/find-alive.pl
:
debugs(91,7, "created BodyPipe " << status()); | |
debugs(91,7, "construct, this=" << static_cast<void*>(this) << ", " << status()); |
} | ||
|
||
BodyPipe::~BodyPipe() | ||
{ | ||
debugs(91,7, "destroying BodyPipe" << status()); | ||
debugs(91,7, "destroying BodyPipe " << status()); |
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 take advantage of the touch to make this produce the log pattern detected by the scripts/find-alive.pl
:
debugs(91,7, "destroying BodyPipe " << status()); | |
debugs(91,7, "destruct, this=" << static_cast<void*>(this) << ", " << status()); |
@@ -708,7 +708,7 @@ void Adaptation::Icap::ModXact::bypassFailure() | |||
reuseConnection = false; // be conservative | |||
cancelRead(); // may not work; and we cannot stop connecting either | |||
if (!doneWithIo()) | |||
debugs(93, 7, "Warning: bypass failed to stop I/O" << status()); | |||
debugs(93, 7, "Warning: bypass failed to stop I/O " << status()); |
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.
debugs(93, 7, "Warning: bypass failed to stop I/O " << status()); | |
debugs(93, 7, "WARNING: bypass failed to stop I/O " << status()); |
@@ -1292,7 +1292,7 @@ Adaptation::Icap::ModXact::~ModXact() | |||
// internal cleanup | |||
void Adaptation::Icap::ModXact::swanSong() | |||
{ | |||
debugs(93, 5, "swan sings" << status()); | |||
debugs(93, 5, "swan sings " << status()); |
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.
method name "swanSong" makes the content text redundant.
debugs(93, 5, "swan sings " << status()); | |
debugs(93, 5, status()); |
if (job->stopReason) | ||
os << indent << indent << "stopped: '" << job->stopReason << "'\n"; | ||
os << indent << "stopped: \'" << job->stopReason << "'\n"; |
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.
single quote should not need to be escaped within double-quoted string:
os << indent << "stopped: \'" << job->stopReason << "'\n"; | |
os << indent << "stopped: '" << job->stopReason << "'\n"; |
{ | ||
static MemBuf buf; | ||
buf.reset(); | ||
|
||
buf.append(" [", 2); |
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.
@yadij requested your review on: Improve YAML compliance of mgr:jobs report.
I am not sure why my re-review was requested before any attempt to address my change request. FWIW, until this change request is addressed, polishing minor PR changes is likely to result in quite a few wasted cycles because at least some of that polishing will need to be redone after this change request is addressed.
If there is interest, I can suggest a way to reshape this PR to avoid modifying existing status() implementations (which triggers status() API change requests and other complications) while still providing YAML-compliant mgr:jobs reports.
Improve the report's schema and formatting