-
Notifications
You must be signed in to change notification settings - Fork 73
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
Fixes #6059: Graphes in home page take ages to display #755
Merged
ncharles
merged 1 commit into
Normation:branches/rudder/3.0
from
fanf:bug_6059/graphes_in_home_page_take_ages_to_display
Dec 31, 2014
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
rudder-core/src/main/scala/com/normation/rudder/domain/logger/TimingDebugLogger.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
************************************************************************************* | ||
* Copyright 2012 Normation SAS | ||
************************************************************************************* | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* In accordance with the terms of section 7 (7. Additional Terms.) of | ||
* the GNU Affero GPL v3, the copyright holders add the following | ||
* Additional permissions: | ||
* Notwithstanding to the terms of section 5 (5. Conveying Modified Source | ||
* Versions) and 6 (6. Conveying Non-Source Forms.) of the GNU Affero GPL v3 | ||
* licence, when you create a Related Module, this Related Module is | ||
* not considered as a part of the work and may be distributed under the | ||
* license agreement of your choice. | ||
* A "Related Module" means a set of sources files including their | ||
* documentation that, without modification of the Source Code, enables | ||
* supplementary functions or services in addition to those offered by | ||
* the Software. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/agpl.html>. | ||
* | ||
************************************************************************************* | ||
*/ | ||
|
||
package com.normation.rudder.domain.logger | ||
|
||
import org.slf4j.LoggerFactory | ||
import net.liftweb.common.Logger | ||
|
||
/** | ||
* Applicative log of interest for Rudder ops. | ||
*/ | ||
object TimingDebugLogger extends Logger { | ||
override protected def _logger = LoggerFactory.getLogger("debug_timing") | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,6 +57,7 @@ import bootstrap.liftweb.RudderConfig | |
import com.normation.rudder.web.components.DateFormaterService | ||
import com.normation.rudder.reports.execution.RoReportsExecutionRepository | ||
import com.normation.rudder.reports.execution.AgentRun | ||
import com.normation.rudder.domain.logger.TimingDebugLogger | ||
|
||
/** | ||
* Very much like the NodeGrid, but with the new WB and without ldap information | ||
|
@@ -139,35 +140,42 @@ class SrvGrid( | |
, callback : Option[String => JsCmd] | ||
) = { | ||
|
||
val lines = (for { | ||
lastReports <- roAgentRunsRepository.getNodesLastRun(nodes.map(_.id).toSet) | ||
} yield { | ||
nodes.map(node => NodeLine(node,lastReports.get(node.id), callback)) | ||
}) match { | ||
case eb: EmptyBox => | ||
val msg = "Error when trying to get nodes info" | ||
val e = eb ?~! msg | ||
logger.error(e.messageChain) | ||
e.rootExceptionCause.foreach(ex => logger.error(ex) ) | ||
Nil | ||
case Full(lines) => lines.toList | ||
} | ||
|
||
JsTableData(lines) | ||
val now = System.currentTimeMillis | ||
val runs = roAgentRunsRepository.getNodesLastRun(nodes.map(_.id).toSet) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. did you remove this from the for only to get the timing ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes |
||
|
||
if(TimingDebugLogger.isDebugEnabled) { | ||
TimingDebugLogger.debug(s"Get all last run date time: ${System.currentTimeMillis - now}ms") | ||
} | ||
|
||
val lines = (for { | ||
lastReports <- runs | ||
} yield { | ||
nodes.map(node => NodeLine(node,lastReports.get(node.id), callback)) | ||
}) match { | ||
case eb: EmptyBox => | ||
val msg = "Error when trying to get nodes info" | ||
val e = eb ?~! msg | ||
logger.error(e.messageChain) | ||
e.rootExceptionCause.foreach(ex => logger.error(ex) ) | ||
Nil | ||
case Full(lines) => lines.toList | ||
} | ||
|
||
JsTableData(lines) | ||
} | ||
|
||
def refreshData ( | ||
refreshNodes : () => Seq[NodeInfo] | ||
, callback : Option[String => JsCmd] | ||
, tableId: String | ||
) = { | ||
val ajaxCall = SHtml.ajaxCall(JsNull, (s) => { | ||
val nodes = refreshNodes() | ||
val data = getTableData(nodes,callback) | ||
JsRaw(s"""refreshTable("${tableId}",${data.json.toJsCmd});""") | ||
} ) | ||
val ajaxCall = SHtml.ajaxCall(JsNull, (s) => { | ||
val nodes = refreshNodes() | ||
val data = getTableData(nodes,callback) | ||
JsRaw(s"""refreshTable("${tableId}",${data.json.toJsCmd});""") | ||
} ) | ||
|
||
AnonFunc("",ajaxCall) | ||
AnonFunc("",ajaxCall) | ||
} | ||
|
||
/** | ||
|
@@ -231,4 +239,4 @@ case class NodeLine ( | |
} | ||
|
||
val json = baseFields +* JsObj(optCallback.toSeq:_*) | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
will you have also the policy server with this ?
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.
yes