mirror of
https://github.com/apache/archiva.git
synced 2025-02-08 02:59:43 +00:00
[MRM-167] add the execution times to the report
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@441795 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
157f00698d
commit
ffded4338d
@ -32,6 +32,7 @@
|
|||||||
import org.apache.maven.archiva.indexer.record.IndexRecordExistsArtifactFilter;
|
import org.apache.maven.archiva.indexer.record.IndexRecordExistsArtifactFilter;
|
||||||
import org.apache.maven.archiva.indexer.record.RepositoryIndexRecordFactory;
|
import org.apache.maven.archiva.indexer.record.RepositoryIndexRecordFactory;
|
||||||
import org.apache.maven.archiva.reporting.ReportExecutor;
|
import org.apache.maven.archiva.reporting.ReportExecutor;
|
||||||
|
import org.apache.maven.archiva.reporting.ReportingDatabase;
|
||||||
import org.apache.maven.archiva.reporting.ReportingMetadataFilter;
|
import org.apache.maven.archiva.reporting.ReportingMetadataFilter;
|
||||||
import org.apache.maven.archiva.reporting.ReportingStoreException;
|
import org.apache.maven.archiva.reporting.ReportingStoreException;
|
||||||
import org.apache.maven.archiva.scheduler.TaskExecutionException;
|
import org.apache.maven.archiva.scheduler.TaskExecutionException;
|
||||||
@ -153,6 +154,11 @@ private void execute( Configuration configuration, File indexPath )
|
|||||||
boolean includeSnapshots = repositoryConfiguration.isIncludeSnapshots();
|
boolean includeSnapshots = repositoryConfiguration.isIncludeSnapshots();
|
||||||
|
|
||||||
ArtifactRepository repository = repoFactory.createRepository( repositoryConfiguration );
|
ArtifactRepository repository = repoFactory.createRepository( repositoryConfiguration );
|
||||||
|
ReportingDatabase reporter = reportExecutor.getReportDatabase( repository );
|
||||||
|
|
||||||
|
// keep original value in case there is another process under way
|
||||||
|
long origStartTime = reporter.getStartTime();
|
||||||
|
reporter.setStartTime( System.currentTimeMillis() );
|
||||||
|
|
||||||
// Discovery process
|
// Discovery process
|
||||||
String layoutProperty = repositoryConfiguration.getLayout();
|
String layoutProperty = repositoryConfiguration.getLayout();
|
||||||
@ -196,8 +202,7 @@ private void execute( Configuration configuration, File indexPath )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MetadataFilter metadataFilter =
|
MetadataFilter metadataFilter = new ReportingMetadataFilter( reporter );
|
||||||
new ReportingMetadataFilter( reportExecutor.getReportDatabase( repository ) );
|
|
||||||
|
|
||||||
MetadataDiscoverer metadataDiscoverer =
|
MetadataDiscoverer metadataDiscoverer =
|
||||||
(MetadataDiscoverer) metadataDiscoverers.get( layoutProperty );
|
(MetadataDiscoverer) metadataDiscoverers.get( layoutProperty );
|
||||||
@ -211,6 +216,8 @@ private void execute( Configuration configuration, File indexPath )
|
|||||||
// run the reports
|
// run the reports
|
||||||
reportExecutor.runMetadataReports( metadata, repository );
|
reportExecutor.runMetadataReports( metadata, repository );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reporter.setStartTime( origStartTime );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,6 +99,8 @@ public ReportingDatabase getReportsFromStore( ArtifactRepository repository )
|
|||||||
public void storeReports( ReportingDatabase database, ArtifactRepository repository )
|
public void storeReports( ReportingDatabase database, ArtifactRepository repository )
|
||||||
throws ReportingStoreException
|
throws ReportingStoreException
|
||||||
{
|
{
|
||||||
|
database.updateTimings();
|
||||||
|
|
||||||
ReportingXpp3Writer writer = new ReportingXpp3Writer();
|
ReportingXpp3Writer writer = new ReportingXpp3Writer();
|
||||||
|
|
||||||
File file = new File( repository.getBasedir(), "report-database.xml" );
|
File file = new File( repository.getBasedir(), "report-database.xml" );
|
||||||
@ -120,5 +122,4 @@ public void storeReports( ReportingDatabase database, ArtifactRepository reposit
|
|||||||
IOUtil.close( fileWriter );
|
IOUtil.close( fileWriter );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
|
import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -47,6 +48,8 @@ public class ReportingDatabase
|
|||||||
|
|
||||||
private boolean inProgress;
|
private boolean inProgress;
|
||||||
|
|
||||||
|
private long startTime;
|
||||||
|
|
||||||
public ReportingDatabase()
|
public ReportingDatabase()
|
||||||
{
|
{
|
||||||
this( new Reporting(), null );
|
this( new Reporting(), null );
|
||||||
@ -78,6 +81,7 @@ public void addFailure( Artifact artifact, String reason )
|
|||||||
ArtifactResults results = getArtifactResults( artifact );
|
ArtifactResults results = getArtifactResults( artifact );
|
||||||
results.addFailure( createResults( reason ) );
|
results.addFailure( createResults( reason ) );
|
||||||
numFailures++;
|
numFailures++;
|
||||||
|
updateTimings();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addWarning( Artifact artifact, String reason )
|
public void addWarning( Artifact artifact, String reason )
|
||||||
@ -85,6 +89,7 @@ public void addWarning( Artifact artifact, String reason )
|
|||||||
ArtifactResults results = getArtifactResults( artifact );
|
ArtifactResults results = getArtifactResults( artifact );
|
||||||
results.addWarning( createResults( reason ) );
|
results.addWarning( createResults( reason ) );
|
||||||
numWarnings++;
|
numWarnings++;
|
||||||
|
updateTimings();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ArtifactResults getArtifactResults( Artifact artifact )
|
private ArtifactResults getArtifactResults( Artifact artifact )
|
||||||
@ -145,6 +150,7 @@ public void addFailure( RepositoryMetadata metadata, String reason )
|
|||||||
MetadataResults results = getMetadataResults( metadata, System.currentTimeMillis() );
|
MetadataResults results = getMetadataResults( metadata, System.currentTimeMillis() );
|
||||||
results.addFailure( createResults( reason ) );
|
results.addFailure( createResults( reason ) );
|
||||||
numFailures++;
|
numFailures++;
|
||||||
|
updateTimings();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addWarning( RepositoryMetadata metadata, String reason )
|
public void addWarning( RepositoryMetadata metadata, String reason )
|
||||||
@ -152,6 +158,7 @@ public void addWarning( RepositoryMetadata metadata, String reason )
|
|||||||
MetadataResults results = getMetadataResults( metadata, System.currentTimeMillis() );
|
MetadataResults results = getMetadataResults( metadata, System.currentTimeMillis() );
|
||||||
results.addWarning( createResults( reason ) );
|
results.addWarning( createResults( reason ) );
|
||||||
numWarnings++;
|
numWarnings++;
|
||||||
|
updateTimings();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initMetadataMap()
|
private void initMetadataMap()
|
||||||
@ -289,6 +296,11 @@ public boolean isInProgress()
|
|||||||
public void setInProgress( boolean inProgress )
|
public void setInProgress( boolean inProgress )
|
||||||
{
|
{
|
||||||
this.inProgress = inProgress;
|
this.inProgress = inProgress;
|
||||||
|
|
||||||
|
if ( inProgress )
|
||||||
|
{
|
||||||
|
startTime = System.currentTimeMillis();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clear()
|
public void clear()
|
||||||
@ -302,5 +314,28 @@ public void clear()
|
|||||||
|
|
||||||
reporting.getArtifacts().clear();
|
reporting.getArtifacts().clear();
|
||||||
reporting.getMetadata().clear();
|
reporting.getMetadata().clear();
|
||||||
|
|
||||||
|
updateTimings();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartTime( long startTime )
|
||||||
|
{
|
||||||
|
this.startTime = startTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getStartTime()
|
||||||
|
{
|
||||||
|
return startTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateTimings()
|
||||||
|
{
|
||||||
|
long startTime = getStartTime();
|
||||||
|
Date endTime = new Date();
|
||||||
|
if ( startTime > 0 )
|
||||||
|
{
|
||||||
|
getReporting().setExecutionTime( endTime.getTime() - startTime );
|
||||||
|
}
|
||||||
|
getReporting().setLastModified( endTime );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,16 @@
|
|||||||
<multiplicity>*</multiplicity>
|
<multiplicity>*</multiplicity>
|
||||||
</association>
|
</association>
|
||||||
</field>
|
</field>
|
||||||
|
<field xml.attribute="true">
|
||||||
|
<name>lastModified</name>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<type>Date</type>
|
||||||
|
</field>
|
||||||
|
<field xml.attribute="true">
|
||||||
|
<name>executionTime</name>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<type>long</type>
|
||||||
|
</field>
|
||||||
</fields>
|
</fields>
|
||||||
</class>
|
</class>
|
||||||
<class>
|
<class>
|
||||||
|
@ -16,11 +16,13 @@
|
|||||||
|
|
||||||
<%@ taglib prefix="ww" uri="/webwork" %>
|
<%@ taglib prefix="ww" uri="/webwork" %>
|
||||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||||
|
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||||
|
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Repository Health</title>
|
<%-- TODO! change the name --%>
|
||||||
|
<title>Report: Repository Health</title>
|
||||||
<ww:head/>
|
<ww:head/>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@ -30,7 +32,7 @@
|
|||||||
|
|
||||||
<div id="contentArea">
|
<div id="contentArea">
|
||||||
|
|
||||||
<ww:actionerror/>
|
<%-- TODO!: select report, repository and filter --%>
|
||||||
|
|
||||||
<ww:set name="databases" value="databases"/>
|
<ww:set name="databases" value="databases"/>
|
||||||
<c:forEach items="${databases}" var="database">
|
<c:forEach items="${databases}" var="database">
|
||||||
@ -64,6 +66,13 @@
|
|||||||
${database.numFailures}
|
${database.numFailures}
|
||||||
<img src="<c:url value="/images/icon_warning_sml.gif"/>" width="15" height="15" alt=""/>
|
<img src="<c:url value="/images/icon_warning_sml.gif"/>" width="15" height="15" alt=""/>
|
||||||
${database.numWarnings}
|
${database.numWarnings}
|
||||||
|
|
||||||
|
<span style="font-size: x-small">
|
||||||
|
<%-- TODO! use better formatting here --%>
|
||||||
|
Last updated: ${database.reporting.lastModified},
|
||||||
|
execution time: <fmt:formatNumber maxFractionDigits="0" value="${database.reporting.executionTime / 60000}"/> minutes
|
||||||
|
<fmt:formatNumber maxFractionDigits="0" value="${(database.reporting.executionTime / 1000) % 60}"/> seconds
|
||||||
|
</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<%-- TODO need to protect iterations against concurrent modification exceptions by cloning the lists synchronously --%>
|
<%-- TODO need to protect iterations against concurrent modification exceptions by cloning the lists synchronously --%>
|
||||||
|
@ -51,10 +51,6 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<p>
|
|
||||||
<span style="font-size: x-small">Report finished: 12 Jun 2006 10:11:12, execution time: 10 minutes 15 seconds
|
|
||||||
</span>
|
|
||||||
</p>
|
|
||||||
<div>
|
<div>
|
||||||
<div style="float: right">
|
<div style="float: right">
|
||||||
<a href="#">Repair all</a>
|
<a href="#">Repair all</a>
|
||||||
@ -69,6 +65,8 @@
|
|||||||
2
|
2
|
||||||
<img src="images/icon_warning_sml.gif" width="15" height="15" alt=""/>
|
<img src="images/icon_warning_sml.gif" width="15" height="15" alt=""/>
|
||||||
1
|
1
|
||||||
|
<span style="font-size: x-small">Report finished: 12 Jun 2006 10:11:12, execution time: 10 minutes 15 seconds
|
||||||
|
</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h3>Artifacts</h3>
|
<h3>Artifacts</h3>
|
||||||
@ -136,6 +134,8 @@
|
|||||||
2
|
2
|
||||||
<img src="images/icon_warning_sml.gif" width="15" height="15" alt=""/>
|
<img src="images/icon_warning_sml.gif" width="15" height="15" alt=""/>
|
||||||
0
|
0
|
||||||
|
<span style="font-size: x-small">Report finished: 12 Jun 2006 10:11:12, execution time: 10 minutes 15 seconds
|
||||||
|
</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h3>Artifacts</h3>
|
<h3>Artifacts</h3>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user