Skip to content
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

[JENKINS-42556] Improved logging for Queue #2791

Merged
merged 1 commit into from
Mar 11, 2017

Conversation

jglick
Copy link
Member

@jglick jglick commented Mar 9, 2017

Logging improvements useful in the course of developing a fix for JENKINS-42556.

@reviewbybees

snapshot = new Snapshot(waitingList, blockedProjects, buildables, pendings);
Snapshot revised = new Snapshot(waitingList, blockedProjects, buildables, pendings);
if (LOGGER.isLoggable(Level.FINEST)) {
LOGGER.log(Level.FINEST, "{0} → {1}; leftItems={2}", new Object[] {snapshot, revised, leftItems.asMap()});
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally handy to know when the state of the queue changes, for whatever reason.

@@ -1443,9 +1447,11 @@ public void maintain() {
}
// pending -> buildable
for (BuildableItem p: lostPendings) {
LOGGER.log(Level.FINE,
if (LOGGER.isLoggable(Level.FINE)) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid computing getFullDisplayName if we do not have to.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that there are more cases of this optimization that could be done; I just picked some sample cases.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -1464,7 +1470,7 @@ public void maintain() {
Collections.sort(blockedItems, QueueSorter.DEFAULT_BLOCKED_ITEM_COMPARATOR);
}
for (BlockedItem p : blockedItems) {
String taskDisplayName = p.task.getFullDisplayName();
String taskDisplayName = LOGGER.isLoggable(Level.FINEST) ? p.task.getFullDisplayName() : null;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommended @christ66 do this in #1863 but he did not. Turns out this had a far worse consequence than wasting a bit of CPU time, which will become clearer in another PR.

@ghost
Copy link

ghost commented Mar 9, 2017

This pull request originates from a CloudBees employee. At CloudBees, we require that all pull requests be reviewed by other CloudBees employees before we seek to have the change accepted. If you want to learn more about our process please see this explanation.

@aheritier
Copy link
Member

🐝

Copy link
Member

@oleg-nenashev oleg-nenashev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐝

@oleg-nenashev oleg-nenashev added needs-more-reviews Complex change, which would benefit from more eyes ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback and removed needs-more-reviews Complex change, which would benefit from more eyes labels Mar 10, 2017
@oleg-nenashev
Copy link
Member

@reviewbybees done. I consider merging it since any performance optimization of the queue is useful

@daniel-beck daniel-beck merged commit 13d85fb into jenkinsci:master Mar 11, 2017
@jglick jglick deleted the Queue-logging-JENKINS-42556 branch March 14, 2017 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants