Skip to content

Commit

Permalink
KEYCLOAK-1542 - Server Info page extended by info about DB and MongoDB.
Browse files Browse the repository at this point in the history
Functional test for /serverinfo REST endpoint added.
  • Loading branch information
velias committed Jul 23, 2015
1 parent dfb871c commit 652b2fe
Show file tree
Hide file tree
Showing 10 changed files with 776 additions and 444 deletions.

Large diffs are not rendered by default.

@@ -1,9 +1,10 @@
package org.keycloak.connections.jpa;

import org.keycloak.provider.ProviderFactory;
import org.keycloak.provider.MonitorableProviderFactory;

/**
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
*/
public interface JpaConnectionProviderFactory extends ProviderFactory<JpaConnectionProvider> {
public interface JpaConnectionProviderFactory extends MonitorableProviderFactory<JpaConnectionProvider> {

}

Large diffs are not rendered by default.

@@ -1,9 +1,9 @@
package org.keycloak.connections.mongo;

import org.keycloak.provider.ProviderFactory;
import org.keycloak.provider.MonitorableProviderFactory;

/**
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
*/
public interface MongoConnectionProviderFactory extends ProviderFactory<MongoConnectionProvider> {
public interface MongoConnectionProviderFactory extends MonitorableProviderFactory<MongoConnectionProvider> {
}
@@ -1,21 +1,47 @@
<div class="col-md-12">
<h1>Server Info</h1>
<h1>Server Info</h1>

<table class="table table-striped table-bordered">
<tr>
<td>Version</td>
<td>{{serverInfo.version}}</td>
</tr>
<tr>
<td>Server Time</td>
<td>{{serverInfo.serverTime}} (<a style="cursor: pointer" data-ng-click="serverInfoUpdate()">update</a>)</td>
</tr>
<tr>
<td>Server Uptime</td>
<td>{{serverInfo.serverUptime}}</td>
</tr>
<table class="table table-striped table-bordered">
<tr>
<td width="20%">Keycloak Version</td>
<td>{{serverInfo.version}}</td>
</tr>
<tr>
<td>Server Time</td>
<td>{{serverInfo.serverTime}} (<a style="cursor: pointer" data-ng-click="serverInfoUpdate()">update</a>)</td>
</tr>
<tr>
<td>Server Uptime</td>
<td>{{serverInfo.serverUptime}}</td>
</tr>
</table>

<fieldset>
<legend>Java VM Memory Statistics</legend>
<div class="form-group">
<table class="table table-striped table-bordered" style="margin-top: 0px;">
<tr>
<td width="20%">Total Memory</td>
<td>{{serverInfo.memoryInfo.totalFormated}}</td>
</tr>
<tr>
<td>Free Memory</td>
<td>{{serverInfo.memoryInfo.freeFormated}} ({{serverInfo.memoryInfo.freePercentage}}%)</td>
</tr>
<tr>
<td>Used Memory</td>
<td>{{serverInfo.memoryInfo.usedFormated}}</td>
</tr>
</table>
</div>
</fieldset>

<fieldset>
<legend collapsed>System Info</legend>
<div class="form-group">
<table class="table table-striped table-bordered" style="margin-top: 0px;">
<tr>
<td>Current Working Directory</td>
<td width="20%">Current Working Directory</td>
<td>{{serverInfo.systemInfo.userDir}}</td>
</tr>
<tr>
Expand Down Expand Up @@ -66,23 +92,59 @@ <h1>Server Info</h1>
<td>OS Architecture</td>
<td>{{serverInfo.systemInfo.osArchitecture}}</td>
</tr>
</table>

<h3>Java VM Memory Statistics</h3>
<table class="table table-striped table-bordered">
<tr>
<td>Total Memory</td>
<td>{{serverInfo.memoryInfo.totalFormated}}</td>
</tr>
<tr>
<td>Free Memory</td>
<td>{{serverInfo.memoryInfo.freeFormated}} ({{serverInfo.memoryInfo.freePercentage}}%)</td>
</tr>
<tr>
<td>Used Memory</td>
<td>{{serverInfo.memoryInfo.usedFormated}}</td>
</tr>
</table>
</table>
</div>
</fieldset>


<fieldset ng-show="serverInfo.jpaInfo">
<legend collapsed>Database Info</legend>
<div class="form-group">
<table class="table table-striped table-bordered" style="margin-top: 0px;">
<tr>
<td width="20%">Database URL</td>
<td>{{serverInfo.jpaInfo.jdbcUrl}}</td>
</tr>
<tr>
<td>Database User</td>
<td>{{serverInfo.jpaInfo.databaseUser}}</td>
</tr>
<tr>
<td>Database Type</td>
<td>{{serverInfo.jpaInfo.databaseProduct}}</td>
</tr>
<tr>
<td>Database Driver</td>
<td>{{serverInfo.jpaInfo.databaseDriver}}</td>
</tr>
</table>
</div>
</fieldset>

<fieldset ng-show="serverInfo.mongoDbInfo">
<legend collapsed>Mongo DB Info</legend>
<div class="form-group">
<table class="table table-striped table-bordered" style="margin-top: 0px;">
<tr width="20%">
<td>Address</td>
<td>{{serverInfo.mongoDbInfo.address}}</td>
</tr>
<tr>
<td>Database</td>
<td>{{serverInfo.mongoDbInfo.database}}</td>
</tr>
<tr>
<td>User</td>
<td>{{serverInfo.mongoDbInfo.user}}</td>
</tr>
<tr>
<td>Driver Version</td>
<td>{{serverInfo.mongoDbInfo.driverVersion}}</td>
</tr>
</table>
</div>
</fieldset>

<fieldset>
<legend collapsed>Providers</legend>

Expand All @@ -93,7 +155,7 @@ <h3>Public SPIs</h3>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>SPI</th>
<th width="20%">SPI</th>
<th>Providers</th>
</tr>
</thead>
Expand All @@ -117,7 +179,7 @@ <h3>Internal SPIs</h3>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>SPI</th>
<th width="20%">SPI</th>
<th>Providers</th>
</tr>
</thead>
Expand Down
@@ -0,0 +1,18 @@
package org.keycloak.provider;

/**
* Provider factory for provider which is monitorable. It means some info about it can be shown on "Server Info" page or accessed over Operational monitoring endpoint.
*
* @author Vlastimil Elias (velias at redhat dot com)
*/
public interface MonitorableProviderFactory<T extends Provider> extends ProviderFactory<T> {

/**
* Get operational info about given provider. This info contains informations about providers configuration and operational conditions (eg. errors in connection to remote systems etc).
* Is used to be shown on "Server Info" page or in Operational monitoring endpoint.
*
* @return extendion of {@link ProviderOperationalInfo}
*/
public ProviderOperationalInfo getOperationalInfo();

}
@@ -0,0 +1,22 @@
package org.keycloak.provider;

import java.io.Serializable;

/**
* Operational info about given Provider.
* Contains info about Provider that can be shown on "Server Info" page or accessed over Operational monitoring endpoint.
*
* @author Vlastimil Elias (velias at redhat dot com)
* @see MonitorableProviderFactory
*/
public interface ProviderOperationalInfo extends Serializable {

/**
* Return true if provider is OK from operation point of view. It means it is able to perform necessary work.
* It can return false for example if remote DB of JPA provider is not available, or LDAP server of LDAP based user federation provider is not available.
*
* @return true if provider is OK to perform his operation.
*/
boolean isOk();

}
15 changes: 15 additions & 0 deletions services/pom.xml
Expand Up @@ -39,6 +39,21 @@
<artifactId>keycloak-connections-http-client</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-connections-jpa</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-connections-mongo</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-forms-common-freemarker</artifactId>
Expand Down

0 comments on commit 652b2fe

Please sign in to comment.