提交 54d88949 编写于 作者: K Kohsuke Kawaguchi

System information of slaves are now extension points.

Existing implementations are retrofitted to the new extension point.
上级 14f73760
......@@ -70,6 +70,7 @@ import javax.crypto.spec.SecretKeySpec;
import javax.servlet.RequestDispatcher;
import jenkins.model.Jenkins;
import jenkins.slaves.JnlpSlaveAgentProtocol;
import jenkins.slaves.systemInfo.SlaveSystemInfo;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.QueryParameter;
......@@ -774,6 +775,13 @@ public class SlaveComputer extends Computer {
return null;
}
/**
* Helper method for Jelly.
*/
public static List<SlaveSystemInfo> getSystemInfoExtensions() {
return SlaveSystemInfo.all();
}
private static class SlaveLogFetcher implements Callable<List<LogRecord>,RuntimeException> {
public List<LogRecord> call() {
return new ArrayList<LogRecord>(SLAVE_LOG_HANDLER.getView());
......
package jenkins.slaves.systemInfo;
import hudson.Extension;
/**
* @author Kohsuke Kawaguchi
*/
@Extension
public class ClassLoaderStatisticsSlaveInfo extends SlaveSystemInfo {
@Override
public String getDisplayName() {
return Messages.ClassLoaderStatisticsSlaveInfo_DisplayName();
}
}
package jenkins.slaves.systemInfo;
import hudson.Extension;
/**
* @author Kohsuke Kawaguchi
*/
@Extension
public class EnvVarsSlaveInfo extends SlaveSystemInfo {
@Override
public String getDisplayName() {
return Messages.EnvVarsSlaveInfo_DisplayName();
}
}
package jenkins.slaves.systemInfo;
import hudson.ExtensionList;
import hudson.ExtensionPoint;
import hudson.model.Computer;
import jenkins.model.Jenkins;
/**
* Extension point that contributes to the system information page of {@link Computer}.
*
* <h2>Views</h2>
* Subtypes must have <tt>systemInfo.groovy/.jelly</tt> view.
* This view will have the "it" variable that refers to {@link Computer} object, and "instance" variable
* that refers to {@link SlaveSystemInfo} object.
*
* @author Kohsuke Kawaguchi
* @since 1.559
*/
public abstract class SlaveSystemInfo implements ExtensionPoint {
/**
* Human readable name of this statistics.
*/
public abstract String getDisplayName();
public static ExtensionList<SlaveSystemInfo> all() {
return Jenkins.getInstance().getExtensionList(SlaveSystemInfo.class);
}
}
package jenkins.slaves.systemInfo;
import hudson.Extension;
/**
* @author Kohsuke Kawaguchi
*/
@Extension
public class SystemPropertySlaveInfo extends SlaveSystemInfo {
@Override
public String getDisplayName() {
return Messages.SystemPropertySlaveInfo_DisplayName();
}
}
package jenkins.slaves.systemInfo;
import hudson.Extension;
/**
* @author Kohsuke Kawaguchi
*/
@Extension
public class ThreadDumpSlaveInfo extends SlaveSystemInfo {
@Override
public String getDisplayName() {
return Messages.ThreadDumpSlaveInfo_DisplayName();
}
}
h1(_('Remote Class Loader Statistics'))
def fmt = new java.text.DecimalFormat("0.0")
def right = 'text-align: right'
table(class: 'bigtable') {
tr {
th _('Loading Type')
th _('Time (s)')
th _('Count')
}
tr {
td _('Classes')
td(style: right) {text(fmt.format(my.classLoadingTime / 1000000000))}
td(style: right) {
text(my.classLoadingCount)
def classLoadingPrefetchCacheCount = my.classLoadingPrefetchCacheCount;
if (classLoadingPrefetchCacheCount != -1) {
text(_(' (prefetch cache: '))
text(classLoadingPrefetchCacheCount)
text(_(')'))
}
}
}
tr {
td _('Resources')
td(style: right) {text(fmt.format(my.resourceLoadingTime / 1000000000))}
td(style: right) {text(my.resourceLoadingCount)}
}
}
......@@ -35,18 +35,11 @@ THE SOFTWARE.
<l:main-panel>
<l:hasPermission permission="${it.CONNECT}">
<h1>${it.oSDescription} slave, version ${it.slaveVersion}</h1>
<h1>${%System Properties}</h1>
<t:propertyTable items="${it.systemProperties}" />
<h1>${%Environment Variables}</h1>
<t:propertyTable items="${it.envVars}" />
<h1>${%Thread Dump}</h1>
<j:forEach var="t" items="${it.getThreadDump().entrySet()}">
<h2>${t.key}</h2>
<pre>${t.value}</pre>
<j:forEach var="instance" items="${it.systemInfoExtensions}">
<h1>${instance.displayName}</h1>
<st:include page="systemInfo" from="${instance}"/>
</j:forEach>
<j:if test="${it.channel != null}">
<st:include page="statistics.groovy"/>
</j:if>
</l:hasPermission>
</l:main-panel>
</l:layout>
......
import hudson.slaves.SlaveComputer
def fmt = new java.text.DecimalFormat("0.0")
def right = 'text-align: right'
if (my instanceof SlaveComputer) {
SlaveComputer c = my;
table(class: 'bigtable') {
tr {
th _('Loading Type')
th _('Time (s)')
th _('Count')
}
tr {
td _('Classes')
td(style: right) {text(fmt.format(c.classLoadingTime / 1000000000))}
td(style: right) {
text(c.classLoadingCount)
def classLoadingPrefetchCacheCount = c.classLoadingPrefetchCacheCount;
if (classLoadingPrefetchCacheCount != -1) {
text(_(' (prefetch cache: '))
text(classLoadingPrefetchCacheCount)
text(_(')'))
}
}
}
tr {
td _('Resources')
td(style: right) {text(fmt.format(c.resourceLoadingTime / 1000000000))}
td(style: right) {text(c.resourceLoadingCount)}
}
}
}
<!--
The MIT License
Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Seiji Sogabe
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<!--
Various system information for diagnostics.
TODO: merge this with Hudson/systemInfo.jelly
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<t:propertyTable items="${it.envVars}" />
</j:jelly>
\ No newline at end of file
# The MIT License
#
# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Eric Lefevre-Ardant
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
SystemPropertySlaveInfo.DisplayName=System Properties
EnvVarsSlaveInfo.DisplayName=Environment Variables
ThreadDumpSlaveInfo.DisplayName=Thread Dump
ClassLoaderStatisticsSlaveInfo.DisplayName=Remote Class Loader Statistics
......@@ -20,7 +20,6 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
System\ Information=Systeminformation
System\ Properties=Systemegenskaber
Environment\ Variables=Milj\u00f8variable
Thread\ Dump=Tr\u00e5ddump
SystemPropertySlaveInfo.DisplayName=Systemegenskaber
EnvVarsSlaveInfo.DisplayName=Milj\u00f8variable
ThreadDumpSlaveInfo.DisplayName=Tr\u00e5ddump
......@@ -20,7 +20,6 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
System\ Information=Systeminformationen
System\ Properties=Systemeigenschaften
Environment\ Variables=Umgebungsvariablen
Thread\ Dump=Thread Dump
SystemPropertySlaveInfo.DisplayName=Systemeigenschaften
EnvVarsSlaveInfo.DisplayName=Umgebungsvariablen
ThreadDumpSlaveInfo.DisplayName=Thread Dump
......@@ -20,8 +20,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
System\ Information=Información del sistema
System\ Properties=Propiedades del sistema
Environment\ Variables=Variables de entorno
Thread\ Dump=Volcado the los "threads"
SystemPropertySlaveInfo.DisplayName=Propiedades del sistema
EnvVarsSlaveInfo.DisplayName=Variables de entorno
ThreadDumpSlaveInfo.DisplayName=Volcado the los "threads"
......@@ -20,7 +20,6 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
System\ Information=Informations sur le système
System\ Properties=Propriétés du système
Environment\ Variables=Variables d''environnement
Thread\ Dump=Dump du thread
SystemPropertySlaveInfo.DisplayName=Propriétés du système
EnvVarsSlaveInfo.DisplayName=Variables d''environnement
ThreadDumpSlaveInfo.DisplayName=Dump du thread
......@@ -20,7 +20,6 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
System\ Information=\u30B7\u30B9\u30C6\u30E0\u60C5\u5831
System\ Properties=\u30B7\u30B9\u30C6\u30E0\u30D7\u30ED\u30D1\u30C6\u30A3
Environment\ Variables=\u74B0\u5883\u5909\u6570
Thread\ Dump=\u30B9\u30EC\u30C3\u30C9\u30C0\u30F3\u30D7
\ No newline at end of file
SystemPropertySlaveInfo.DisplayName=\u30B7\u30B9\u30C6\u30E0\u30D7\u30ED\u30D1\u30C6\u30A3
EnvVarsSlaveInfo.DisplayName=\u74B0\u5883\u5909\u6570
ThreadDumpSlaveInfo.DisplayName=\u30B9\u30EC\u30C3\u30C9\u30C0\u30F3\u30D7
\ No newline at end of file
# This file is under the MIT License by authors
Environment\ Variables=Aplinkos kintamieji
System\ Properties=Sistemos savyb\u0117s
EnvVarsSlaveInfo.DisplayName=Aplinkos kintamieji
SystemPropertySlaveInfo.DisplayName=Sistemos savyb\u0117s
# This file is under the MIT License by authors
Environment\ Variables=Vides main\u012Bgie
System\ Properties=Sist\u0113mas parametri
EnvVarsSlaveInfo.DisplayName=Vides main\u012Bgie
SystemPropertySlaveInfo.DisplayName=Sist\u0113mas parametri
......@@ -20,5 +20,5 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
Environment\ Variables=Omgevings variabelen
System\ Properties=Systeem eigenschappen
EnvVarsSlaveInfo.DisplayName=Omgevings variabelen
SystemPropertySlaveInfo.DisplayName=Systeem eigenschappen
......@@ -20,7 +20,6 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
System\ Information=Informa\u00e7t\u00e3o de sistema
System\ Properties=Propriedades do sistema
Thread\ Dump=Limpar Threads
Environment\ Variables=Vari\u00e1veis de ambiente
SystemPropertySlaveInfo.DisplayName=Propriedades do sistema
ThreadDumpSlaveInfo.DisplayName=Limpar Threads
EnvVarsSlaveInfo.DisplayName=Vari\u00e1veis de ambiente
......@@ -20,6 +20,6 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
Environment\ Variables=\u041F\u0435\u0440\u0435\u043C\u0435\u043D\u043D\u044B\u0435 \u0441\u0440\u0435\u0434\u044B
System\ Properties=\u0421\u0432\u043E\u0439\u0441\u0442\u0432\u0430 \u0441\u0438\u0441\u0442\u0435\u043C\u044B
Thread\ Dump=\u0414\u0430\u043C\u043F \u043F\u043E\u0442\u043E\u043A\u0430
EnvVarsSlaveInfo.DisplayName=\u041F\u0435\u0440\u0435\u043C\u0435\u043D\u043D\u044B\u0435 \u0441\u0440\u0435\u0434\u044B
SystemPropertySlaveInfo.DisplayName=\u0421\u0432\u043E\u0439\u0441\u0442\u0432\u0430 \u0441\u0438\u0441\u0442\u0435\u043C\u044B
ThreadDumpSlaveInfo.DisplayName=\u0414\u0430\u043C\u043F \u043F\u043E\u0442\u043E\u043A\u0430
......@@ -20,6 +20,6 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
Environment\ Variables=Milj\u00F6variabler
System\ Properties=Systemegenskaper
Thread\ Dump=Tr\u00E5dutskrift
EnvVarsSlaveInfo.DisplayName=Milj\u00F6variabler
SystemPropertySlaveInfo.DisplayName=Systemegenskaper
ThreadDumpSlaveInfo.DisplayName=Tr\u00E5dutskrift
......@@ -20,7 +20,6 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
System\ Information=\u7cfb\u7d71\u8cc7\u8a0a
System\ Properties=\u7cfb\u7d71\u5c6c\u6027
Environment\ Variables=\u74b0\u5883\u8b8a\u6578
Thread\ Dump=\u57f7\u884c\u7dd2\u50be\u5370
SystemPropertySlaveInfo.DisplayName=\u7cfb\u7d71\u5c6c\u6027
EnvVarsSlaveInfo.DisplayName=\u74b0\u5883\u8b8a\u6578
ThreadDumpSlaveInfo.DisplayName=\u57f7\u884c\u7dd2\u50be\u5370
<!--
The MIT License
Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Seiji Sogabe
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<!--
Various system information for diagnostics.
TODO: merge this with Hudson/systemInfo.jelly
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<t:propertyTable items="${it.systemProperties}" />
</j:jelly>
\ No newline at end of file
<!--
The MIT License
Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Seiji Sogabe
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<!--
Various system information for diagnostics.
TODO: merge this with Hudson/systemInfo.jelly
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<j:forEach var="t" items="${it.getThreadDump().entrySet()}">
<h2>${t.key}</h2>
<pre>${t.value}</pre>
</j:forEach>
</j:jelly>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册