Skip to content

Commit

Permalink
feat(jans-config-api): underlying server stats #275
Browse files Browse the repository at this point in the history
feat: underlying server stats
  • Loading branch information
yuriyz committed Feb 11, 2022
2 parents 9606239 + 0f36336 commit ae6f2d7
Show file tree
Hide file tree
Showing 17 changed files with 535 additions and 133 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
package io.jans.configapi.model.status;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({ "memoryfree", "swapfree", "hostname", "ipaddress", "uptime", "free_disk_space", "load_average" })
public class FacterData {

@JsonProperty("memoryfree")
private String memoryfree;

@JsonProperty("swapfree")
private String swapfree;

@JsonProperty("hostname")
private String hostname;

@JsonProperty("ipaddress")
private String ipaddress;

@JsonProperty("uptime")
private String uptime;

@JsonProperty("free_disk_space")
private String freeDiskSpace;

@JsonProperty("load_average")
private String loadAverage;


@JsonProperty("memoryfree")
public String getMemoryfree() {
return memoryfree;
}

@JsonProperty("memoryfree")
public void setMemoryfree(String memoryfree) {
this.memoryfree = memoryfree;
}

@JsonProperty("swapfree")
public String getSwapfree() {
return swapfree;
}

@JsonProperty("swapfree")
public void setSwapfree(String swapfree) {
this.swapfree = swapfree;
}

@JsonProperty("hostname")
public String getHostname() {
return hostname;
}

@JsonProperty("hostname")
public void setHostname(String hostname) {
this.hostname = hostname;
}

@JsonProperty("ipaddress")
public String getIpaddress() {
return ipaddress;
}

@JsonProperty("ipaddress")
public void setIpaddress(String ipaddress) {
this.ipaddress = ipaddress;
}

@JsonProperty("uptime")
public String getUptime() {
return uptime;
}

@JsonProperty("uptime")
public void setUptime(String uptime) {
this.uptime = uptime;
}

@JsonProperty("free_disk_space")
public String getFreeDiskSpace() {
return freeDiskSpace;
}

@JsonProperty("free_disk_space")
public void setFreeDiskSpace(String freeDiskSpace) {
this.freeDiskSpace = freeDiskSpace;
}

@JsonProperty("load_average")
public String getLoadAverage() {
return loadAverage;
}

@JsonProperty("load_average")
public void setLoadAverage(String loadAverage) {
this.loadAverage = loadAverage;
}

@Override
public String toString() {
return "FacterData [memoryfree=" + memoryfree + ", swapfree=" + swapfree + ", hostname=" + hostname
+ ", ipaddress=" + ipaddress + ", uptime=" + uptime + ", freeDiskSpace=" + freeDiskSpace
+ ", loadAverage=" + loadAverage + "]";
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package io.jans.configapi.model.status;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

import java.util.Date;

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({ "dbType", "lastUpdate", "facterData", })
public class StatsData {

@JsonProperty("dbType")
private String dbType;

@JsonProperty("lastUpdate")
private Date lastUpdate;

@JsonProperty("facterData")
private FacterData facterData;

public String getDbType() {
return dbType;
}

public void setDbType(String dbType) {
this.dbType = dbType;
}

public Date getLastUpdate() {
return lastUpdate;
}

public void setLastUpdate(Date lastUpdate) {
this.lastUpdate = lastUpdate;
}

public FacterData getFacterData() {
return facterData;
}

public void setFacterData(FacterData facterData) {
this.facterData = facterData;
}

@Override
public String toString() {
return "StatsData [dbType=" + dbType + ", lastUpdate=" + lastUpdate + ", facterData=" + facterData + "]";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ private ApiConstants() {}
public static final String STATISTICS = "/stat";
public static final String USER = "/user";
public static final String ORG = "/org";
public static final String SERVER_STAT = "/server-stat";

public static final String LIMIT = "limit";
public static final String START_INDEX = "startIndex";
Expand Down
69 changes: 64 additions & 5 deletions jans-config-api/docs/jans-config-api-swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ tags:
- name: OAuth - Scopes
- name: Statistics - User
- name: Health - Check
- name: Server Stats
- name: SCIM - User Management
- name: SCIM - Config Management
- name: Organization Configuration
Expand Down Expand Up @@ -2378,6 +2379,23 @@ paths:
$ref: '#/components/schemas/HealthStatusItem'
'500':
description: Internal Server Error

/jans-config-api/api/v1/health/server-stat:
get:
summary: Returns application server status.
description: Returns application server status.
operationId: get-server-stat
tags:
- Server Stats
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/StatsData'
'500':
description: Internal Server Error

/jans-config-api/scim/user:
get:
Expand Down Expand Up @@ -2807,7 +2825,7 @@ paths:
$ref: '#/components/schemas/ErrorResponse'
security:
- oauth2: [https://jans.io/oauth/config/scim/users.read https://jans.io/scim/users.read]

/jans-config-api/scim/config:
get:
summary: Retrieves SCIM App configuration.
Expand Down Expand Up @@ -2860,7 +2878,7 @@ paths:
$ref: '#/components/responses/Unauthorized'
'500':
$ref: '#/components/responses/InternalServerError'

/jans-config-api/api/v1/org:
get:
summary: Retrieves organization configuration.
Expand Down Expand Up @@ -2913,7 +2931,7 @@ paths:
$ref: '#/components/responses/Unauthorized'
'500':
$ref: '#/components/responses/InternalServerError'

/jans-config-api/api/v1/jans-auth-server/health:
get:
summary: Returns auth server health status.
Expand Down Expand Up @@ -6598,7 +6616,7 @@ components:
useLocalCache:
type: boolean
description: Boolean value specifying whether to enable local in-memory cache.

Organization:
type: object
properties:
Expand Down Expand Up @@ -6640,5 +6658,46 @@ components:
jsFaviconPath:
type: string
description: Path to organization favicon image


FacterData:
type: object
properties:
memoryfree:
type: string
description: Server free memory
swapfree:
type: string
description: Server swap free
hostname:
type: string
description: Server hostname
ipaddress:
type: string
description: Server ipaddress
uptime:
type: string
description: Server uptime
free_disk_space:
type: string
description: Server free disk space
load_average:
type: string
description: Server average load time


StatsData:
type: object
properties:
dbType:
type: string
description: Jans Server DB type
lastUpdate:
type: string
description: Stats update time
facterData:
type: object
$ref: '#/components/schemas/FacterData'
description: Underlying Server stats


7 changes: 0 additions & 7 deletions jans-config-api/plugins/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@

<dependencies>

<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency>

<!-- CDI -->
<dependency>
<groupId>javax.enterprise</groupId>
Expand Down
37 changes: 1 addition & 36 deletions jans-config-api/plugins/sample/demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -136,42 +136,7 @@
<version>${resteasy.version}</version>
</dependency>

<!-- Logging -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-1.2-api</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jul</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>


<!-- Othres -->
<dependency>
Expand Down
36 changes: 0 additions & 36 deletions jans-config-api/plugins/sample/helloworld/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -136,42 +136,6 @@
<version>${resteasy.version}</version>
</dependency>

<!-- Logging -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-1.2-api</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jul</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>

<!-- Othres -->
<dependency>
Expand Down
Loading

0 comments on commit ae6f2d7

Please sign in to comment.