fixed monitoring for demo and ping indicator

This commit is contained in:
anhefti 2019-08-09 11:29:18 +02:00
parent 00d7a91a43
commit b1edcd55dc
5 changed files with 16 additions and 7 deletions

View file

@ -15,6 +15,9 @@ import java.util.Collections;
import java.util.EnumSet;
import java.util.Set;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import com.fasterxml.jackson.annotation.JsonIgnore;
import ch.ethz.seb.sebserver.gbl.model.session.ClientEvent.EventType;
@ -27,6 +30,7 @@ public abstract class AbstractPingIndicator extends AbstractClientIndicator {
private final ClientEventExtentionMapper clientEventExtentionMapper;
protected long pingLatency;
protected int pingCount = 0;
protected int pingNumber = 0;
@ -35,14 +39,16 @@ public abstract class AbstractPingIndicator extends AbstractClientIndicator {
this.clientEventExtentionMapper = clientEventExtentionMapper;
}
public void notifyPing(final long timestamp, final int pingNumber) {
super.currentValue = timestamp;
public final void notifyPing(final long timestamp, final int pingNumber) {
final long now = DateTime.now(DateTimeZone.UTC).getMillis();
this.pingLatency = now - timestamp;
super.currentValue = now;
this.pingCount++;
this.pingNumber = pingNumber;
}
@Override
public double computeValueAt(final long timestamp) {
public final double computeValueAt(final long timestamp) {
if (this.cachingEnabled) {
return timestamp;
} else {

View file

@ -5,6 +5,6 @@ spring.mandatory-file-encoding=UTF-8
spring.http.encoding.charset=UTF-8
spring.http.encoding.enabled=true
sebserver.version=0.3.4 pre-beta
sebserver.version=0.3.5 pre-beta
sebserver.supported.languages=en,de

View file

@ -391,7 +391,8 @@ CREATE TABLE IF NOT EXISTS `oauth_access_token` (
`user_name` VARCHAR(255) NULL,
`client_id` VARCHAR(255) NULL,
`authentication` BLOB NULL,
`refresh_token` VARCHAR(255) NULL)
`refresh_token` VARCHAR(255) NULL,
UNIQUE INDEX `authentication_id_UNIQUE` (`authentication_id` ASC))
;

View file

@ -78,7 +78,9 @@ public class HTTPClientBot {
public HTTPClientBot(final Map<String, String> args) {
//this.webserviceAddress = args.getOrDefault("webserviceAddress", "http://ralph.ethz.ch:8080");
this.webserviceAddress = args.getOrDefault("webserviceAddress", "http://localhost:8080");
this.accessTokenEndpoint = args.getOrDefault("accessTokenEndpoint", "/oauth/token");
this.clientId = args.getOrDefault("clientId", "TO_SET");
this.clientSecret = args.getOrDefault("clientSecret", "TO_SET");

View file

@ -397,10 +397,10 @@ CREATE TABLE IF NOT EXISTS `oauth_access_token` (
`user_name` VARCHAR(255) NULL,
`client_id` VARCHAR(255) NULL,
`authentication` BLOB NULL,
`refresh_token` VARCHAR(255) NULL)
`refresh_token` VARCHAR(255) NULL,
UNIQUE INDEX `authentication_id_UNIQUE` (`authentication_id` ASC))
;
-- -----------------------------------------------------
-- Table `oauth_refresh_token`
-- -----------------------------------------------------