fixed monitoring for demo and ping indicator
This commit is contained in:
		
							parent
							
								
									00d7a91a43
								
							
						
					
					
						commit
						b1edcd55dc
					
				
					 5 changed files with 16 additions and 7 deletions
				
			
		|  | @ -15,6 +15,9 @@ import java.util.Collections; | ||||||
| import java.util.EnumSet; | import java.util.EnumSet; | ||||||
| import java.util.Set; | import java.util.Set; | ||||||
| 
 | 
 | ||||||
|  | import org.joda.time.DateTime; | ||||||
|  | import org.joda.time.DateTimeZone; | ||||||
|  | 
 | ||||||
| import com.fasterxml.jackson.annotation.JsonIgnore; | import com.fasterxml.jackson.annotation.JsonIgnore; | ||||||
| 
 | 
 | ||||||
| import ch.ethz.seb.sebserver.gbl.model.session.ClientEvent.EventType; | import ch.ethz.seb.sebserver.gbl.model.session.ClientEvent.EventType; | ||||||
|  | @ -27,6 +30,7 @@ public abstract class AbstractPingIndicator extends AbstractClientIndicator { | ||||||
| 
 | 
 | ||||||
|     private final ClientEventExtentionMapper clientEventExtentionMapper; |     private final ClientEventExtentionMapper clientEventExtentionMapper; | ||||||
| 
 | 
 | ||||||
|  |     protected long pingLatency; | ||||||
|     protected int pingCount = 0; |     protected int pingCount = 0; | ||||||
|     protected int pingNumber = 0; |     protected int pingNumber = 0; | ||||||
| 
 | 
 | ||||||
|  | @ -35,14 +39,16 @@ public abstract class AbstractPingIndicator extends AbstractClientIndicator { | ||||||
|         this.clientEventExtentionMapper = clientEventExtentionMapper; |         this.clientEventExtentionMapper = clientEventExtentionMapper; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public void notifyPing(final long timestamp, final int pingNumber) { |     public final void notifyPing(final long timestamp, final int pingNumber) { | ||||||
|         super.currentValue = timestamp; |         final long now = DateTime.now(DateTimeZone.UTC).getMillis(); | ||||||
|  |         this.pingLatency = now - timestamp; | ||||||
|  |         super.currentValue = now; | ||||||
|         this.pingCount++; |         this.pingCount++; | ||||||
|         this.pingNumber = pingNumber; |         this.pingNumber = pingNumber; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public double computeValueAt(final long timestamp) { |     public final double computeValueAt(final long timestamp) { | ||||||
|         if (this.cachingEnabled) { |         if (this.cachingEnabled) { | ||||||
|             return timestamp; |             return timestamp; | ||||||
|         } else { |         } else { | ||||||
|  |  | ||||||
|  | @ -5,6 +5,6 @@ spring.mandatory-file-encoding=UTF-8 | ||||||
| spring.http.encoding.charset=UTF-8 | spring.http.encoding.charset=UTF-8 | ||||||
| spring.http.encoding.enabled=true | spring.http.encoding.enabled=true | ||||||
| 
 | 
 | ||||||
| sebserver.version=0.3.4 pre-beta | sebserver.version=0.3.5 pre-beta | ||||||
| sebserver.supported.languages=en,de | sebserver.supported.languages=en,de | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -391,7 +391,8 @@ CREATE TABLE IF NOT EXISTS `oauth_access_token` ( | ||||||
|   `user_name` VARCHAR(255) NULL, |   `user_name` VARCHAR(255) NULL, | ||||||
|   `client_id` VARCHAR(255) NULL, |   `client_id` VARCHAR(255) NULL, | ||||||
|   `authentication` BLOB NULL, |   `authentication` BLOB NULL, | ||||||
|   `refresh_token` VARCHAR(255) NULL) |   `refresh_token` VARCHAR(255) NULL, | ||||||
|  |   UNIQUE INDEX `authentication_id_UNIQUE` (`authentication_id` ASC)) | ||||||
| ; | ; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -78,7 +78,9 @@ public class HTTPClientBot { | ||||||
| 
 | 
 | ||||||
|     public HTTPClientBot(final Map<String, String> args) { |     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.webserviceAddress = args.getOrDefault("webserviceAddress", "http://localhost:8080"); | ||||||
|  | 
 | ||||||
|         this.accessTokenEndpoint = args.getOrDefault("accessTokenEndpoint", "/oauth/token"); |         this.accessTokenEndpoint = args.getOrDefault("accessTokenEndpoint", "/oauth/token"); | ||||||
|         this.clientId = args.getOrDefault("clientId", "TO_SET"); |         this.clientId = args.getOrDefault("clientId", "TO_SET"); | ||||||
|         this.clientSecret = args.getOrDefault("clientSecret", "TO_SET"); |         this.clientSecret = args.getOrDefault("clientSecret", "TO_SET"); | ||||||
|  |  | ||||||
|  | @ -397,10 +397,10 @@ CREATE TABLE IF NOT EXISTS `oauth_access_token` ( | ||||||
|   `user_name` VARCHAR(255) NULL, |   `user_name` VARCHAR(255) NULL, | ||||||
|   `client_id` VARCHAR(255) NULL, |   `client_id` VARCHAR(255) NULL, | ||||||
|   `authentication` BLOB 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` | -- Table `oauth_refresh_token` | ||||||
| -- ----------------------------------------------------- | -- ----------------------------------------------------- | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 anhefti
						anhefti