Skip to content

Commit

Permalink
updated server meters
Browse files Browse the repository at this point in the history
  • Loading branch information
boglesby committed Jan 17, 2020
1 parent 8f11d09 commit 5b76d73
Show file tree
Hide file tree
Showing 22 changed files with 445 additions and 217 deletions.
58 changes: 28 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Pushing from manifest to org pivot-boglesby / space playground as boglesby@pivot
Using manifest file client/manifest.yml
Getting app info...
Updating app with these attributes...
name: sdgApp
name: clientApp
path: /Users/boglesby/Dev/Tests/spring-boot/pcc-long-running-test/client/build/libs/client-0.0.1-SNAPSHOT.jar
buildpacks:
https://github.com/cloudfoundry/java-buildpack.git
Expand All @@ -63,9 +63,9 @@ Updating app with these attributes...
services:
pccService
routes:
sdgapp.apps.pcfone.io
clientapp.apps.pcfone.io
Updating app sdgApp...
Updating app clientApp...
Mapping routes...
Comparing local files to remote cache...
Packaging files to upload...
Expand Down Expand Up @@ -106,10 +106,10 @@ Staging app and tracing logs...
Waiting for app to start...
name: sdgApp
name: clientApp
requested state: started
isolation segment: iso-01
routes: sdgapp.apps.pcfone.io
routes: clientapp.apps.pcfone.io
last uploaded: Fri 03 Jan 16:02:05 PST 2020
stack: cflinuxfs3
buildpacks: https://github.com/cloudfoundry/java-buildpack.git
Expand Down Expand Up @@ -230,7 +230,7 @@ start command: JAVA_OPTS="-agentpath:$PWD/.java-buildpack/open_jdk_jre/bin/jvm
Get the latest client application log messages using the **cf logs** command like:

```
cf logs sdgApp --recent
cf logs clientApp --recent
...
2019-12-19T16:20:09.95-0800 [APP/PROC/WEB/0] OUT 2019-12-20 00:20:09.955 INFO 33 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2019-12-19T16:20:09.96-0800 [APP/PROC/WEB/0] OUT 2019-12-20 00:20:09.960 INFO 33 --- [ main] io.pivotal.test.client.Client : Started Client in 7.316 seconds (JVM running for 8.365)
Expand All @@ -241,8 +241,8 @@ cf logs sdgApp --recent
Tail the client application log messages using the **cf logs** command like:

```
cf logs sdgApp
Retrieving logs for app sdgApp in org pivot-boglesby / space playground as [email protected]...
cf logs clientApp
Retrieving logs for app clientApp in org pivot-boglesby / space playground as [email protected]...
```
#### Get CQ Client Application Logs
##### Get latest Logs
Expand All @@ -260,7 +260,7 @@ Tail the CQ client application log messages using the **cf logs** command like:

```
cf logs clientCqApp
Retrieving logs for app sdgApp in org pivot-boglesby / space playground as [email protected]...
Retrieving logs for app clientApp in org pivot-boglesby / space playground as [email protected]...
```
## Run Clients
### PCFOne
Expand All @@ -279,9 +279,7 @@ name requested state instances memory disk urls
sdgApp started 1/1 768M 1G sdgapp.apps.seoul.cf-app.com
clientCqApp started 1/1 768M 1G clientcqapp.apps.seoul.cf-app.com
```

```
curl -k -X POST https://sdgapp.apps.pcfone.io/trades/put/10/1024
curl -k -X POST https://clientapp.apps.pcfone.io/trades/put/10/1024
{"operation":"put","status":"SUCCESS","completionTime":191}
```
The application will log messages like:
Expand All @@ -304,7 +302,7 @@ The application will log messages like:
Run the get command using **curl** like:
```
curl -k https://sdgapp.apps.pcfone.io/trades/get/10
curl -k https://clientapp.apps.pcfone.io/trades/get/10
{"operation":"get","status":"SUCCESS","completionTime":55}
```
The application will log messages like:
Expand All @@ -327,7 +325,7 @@ The application will log messages like:
Run the destroy command using **curl** like:
```
curl -k -X DELETE https://sdgapp.apps.pcfone.io/trades/destroy/10
curl -k -X DELETE https://clientapp.apps.pcfone.io/trades/destroy/10
{"operation":"destroy","status":"SUCCESS","completionTime":63}
```
The application will log messages like:
Expand All @@ -350,7 +348,7 @@ The application will log messages like:
Run the query by cusip command using **curl** like:
```
curl -k https://sdgapp.apps.pcfone.io/trades/querybycusip/10
curl -k https://clientapp.apps.pcfone.io/trades/querybycusip/10
```
The application will log messages like:
Expand All @@ -372,7 +370,7 @@ The application will log messages like:
Run the function update command using **curl** like:
```
curl -k -X POST https://sdgapp.apps.pcfone.io/trades/functionupdate/10
curl -k -X POST https://clientapp.apps.pcfone.io/trades/functionupdate/10
{"operation":"functionupdate","status":"SUCCESS","completionTime":65}
```
The application will log messages like:
Expand All @@ -395,7 +393,7 @@ The application will log messages like:
Run the function update command using **curl** like:
```
curl -k -X POST https://sdgapp.apps.pcfone.io/trades/putforever/10/1024
curl -k -X POST https://clientapp.apps.pcfone.io/trades/putforever/10/1024
```
The application will log messages like:
Expand All @@ -407,7 +405,7 @@ The application will log messages like:
Run the function update command using **curl** like:
```
curl -k https://sdgapp.apps.pcfone.io/trades/getforever/10
curl -k https://clientapp.apps.pcfone.io/trades/getforever/10
```
The application will log messages like:
Expand All @@ -419,7 +417,7 @@ The application will log messages like:
Run the function update command using **curl** like:
```
curl -k -X DELETE https://sdgapp.apps.pcfone.io/trades/destroyforever/10
curl -k -X DELETE https://clientapp.apps.pcfone.io/trades/destroyforever/10
```
The application will log messages like:
Expand All @@ -431,7 +429,7 @@ The application will log messages like:
Run the function update command using **curl** like:
```
curl -k https://sdgapp.apps.pcfone.io/trades/querybycusipforever
curl -k https://clientapp.apps.pcfone.io/trades/querybycusipforever
```
The application will log messages like:
Expand All @@ -443,7 +441,7 @@ The application will log messages like:
Run the function update command using **curl** like:
```
curl -k -X POST https://sdgapp.apps.pcfone.io/trades/functionupdateforever/10
curl -k -X POST https://clientapp.apps.pcfone.io/trades/functionupdateforever/10
```
The application will log messages like:
Expand All @@ -455,7 +453,7 @@ The application will log messages like:
Run the multi-threaded put forever command using **curl** like:
```
curl -k -X POST https://sdgapp.apps.pcfone.io/trades/putforever/10/1024/5
curl -k -X POST https://clientapp.apps.pcfone.io/trades/putforever/10/1024/5
```
The application will log messages like:
Expand All @@ -467,7 +465,7 @@ The application will log messages like:
Run the multi-threaded get forever command using **curl** like:
```
curl -k https://sdgapp.apps.pcfone.io/trades/getforever/10/5
curl -k https://clientapp.apps.pcfone.io/trades/getforever/10/5
```
The application will log messages like:
Expand All @@ -478,7 +476,7 @@ The application will log messages like:
Run the multi-threaded destroy forever command using **curl** like:
```
curl -k -X DELETE https://sdgapp.apps.pcfone.io/trades/destroyforever/10/5
curl -k -X DELETE https://clientapp.apps.pcfone.io/trades/destroyforever/10/5
```
The application will log messages like:
Expand All @@ -489,7 +487,7 @@ The application will log messages like:
Run the multi-threaded query by cusip forever command using **curl** like:
```
curl -k https://sdgapp.apps.pcfone.io/trades/querybycusipforever/5
curl -k https://clientapp.apps.pcfone.io/trades/querybycusipforever/5
```
The application will log messages like:
Expand All @@ -500,7 +498,7 @@ The application will log messages like:
Run the multi-threaded function update command using **curl** like:
```
curl -k -X POST https://sdgapp.apps.pcfone.io/trades/functionupdateforever/10/5
curl -k -X POST https://clientapp.apps.pcfone.io/trades/functionupdateforever/10/5
```
The application will log messages like:
Expand All @@ -511,7 +509,7 @@ The application will log messages like:
Run the get one command using **curl** like:
```
curl -k https://sdgapp.apps.pcfone.io/trades/getone/0
curl -k https://clientapp.apps.pcfone.io/trades/getone/0
```
The application will log messages like:
Expand All @@ -521,7 +519,7 @@ The application will log messages like:
Run the query one by cusip command using **curl** like:
```
curl -k https://sdgapp.apps.pcfone.io/trades/queryonebycusip/AAPL
curl -k https://clientapp.apps.pcfone.io/trades/queryonebycusip/AAPL
```
The application will log messages like:
Expand All @@ -531,7 +529,7 @@ The application will log messages like:
Run the test command using **curl** like:
```
curl -k -X POST https://sdgapp.apps.pcfone.io/trades/starttest/100000/1024
curl -k -X POST https://clientapp.apps.pcfone.io/trades/starttest/100000/1024
[{"operation":"putforever","status":"SUCCESS","completionTime":0},{"operation":"getforever","status":"SUCCESS","completionTime":0},{"operation":"querybycusipforever","status":"SUCCESS","completionTime":0},{"operation":"functionupdateforever","status":"SUCCESS","completionTime":0}]
```
The application will log messages like:
Expand Down Expand Up @@ -559,7 +557,7 @@ The application will log messages like:
Run the stop operations command using **curl** like:
```
curl -k -X POST https://sdgapp.apps.pcfone.io/trades/stopoperations
curl -k -X POST https://clientapp.apps.pcfone.io/trades/stopoperations
```
The application will log messages like:
Expand Down
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ project(':client') {
compile 'org.springframework.geode:spring-geode-starter:1.2.2.RELEASE'
compile 'org.springframework.geode:spring-geode-starter-actuator:1.2.2.RELEASE'
compile "org.springframework.boot:spring-boot-starter-web:2.2.2.RELEASE"
compile group: 'io.micrometer', name: 'micrometer-registry-prometheus', version: '1.3.2'
}
}

Expand All @@ -70,11 +71,14 @@ project(':client-cq') {
compile 'org.springframework.geode:spring-geode-starter:1.2.2.RELEASE'
compile 'org.springframework.geode:spring-geode-starter-actuator:1.2.2.RELEASE'
compile "org.springframework.boot:spring-boot-starter-web:2.2.2.RELEASE"
compile group: 'io.micrometer', name: 'micrometer-registry-prometheus', version: '1.3.2'
}
}

project(':server') {
dependencies {
compile 'org.projectlombok:lombok:1.18.8'
annotationProcessor 'org.projectlombok:lombok:1.18.10'
provided 'io.pivotal.gemfire:geode-core:9.8.3'
}
}
2 changes: 1 addition & 1 deletion client-cq/manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ applications:
- name: clientCqApp
memory: 768M
instances: 1
path: build/libs/client_cq-0.0.1-SNAPSHOT.jar
path: build/libs/client-cq-0.0.1-SNAPSHOT.jar
services:
- pccService
buildpacks:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package io.pivotal.test.client.cq;

import org.apache.geode.cache.query.CqEvent;
import org.apache.geode.internal.logging.LogService;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.gemfire.listener.annotation.ContinuousQuery;
import org.springframework.stereotype.Component;

@Component
public class TradeProcessor {

private static final Logger logger = LogService.getLogger();
private static final Logger logger = LoggerFactory.getLogger(TradeProcessor.class);

@ContinuousQuery(name = "TradeProcessor", query = "SELECT * FROM /Trades WHERE cusip = 'AAPL'")
public void processTrade(CqEvent event) {
Expand Down
2 changes: 1 addition & 1 deletion client/manifest.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
applications:
- name: sdgApp
- name: clientApp
memory: 768M
instances: 1
path: build/libs/client-0.0.1-SNAPSHOT.jar
Expand Down
20 changes: 17 additions & 3 deletions client/src/main/java/io/pivotal/test/client/Client.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package io.pivotal.test.client;

import io.pivotal.test.client.domain.Trade;
import io.pivotal.test.client.metrics.OperationMeterBinder;
import io.pivotal.test.client.metrics.ServerMeterBuilder;
import io.pivotal.test.client.service.TradeService;
import org.apache.geode.internal.logging.LogService;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
Expand All @@ -14,6 +16,7 @@
import org.springframework.data.gemfire.config.annotation.EnableEntityDefinedRegions;
import org.springframework.data.gemfire.config.annotation.EnableStatistics;
import org.springframework.geode.boot.autoconfigure.ContinuousQueryAutoConfiguration;
import org.springframework.scheduling.annotation.EnableScheduling;

import java.util.Arrays;
import java.util.List;
Expand All @@ -24,9 +27,10 @@
@SpringBootApplication(exclude = ContinuousQueryAutoConfiguration.class) // disable subscriptions
@EnableEntityDefinedRegions(basePackageClasses = Trade.class)
@EnableStatistics
@EnableScheduling
public class Client {

private static final Logger logger = LogService.getLogger();
private static final Logger logger = LoggerFactory.getLogger(Client.class);

@Autowired
private TradeService service;
Expand Down Expand Up @@ -101,6 +105,16 @@ ApplicationRunner runner() {
};
}

@Bean
OperationMeterBinder getOperationMeterBuilder(){
return new OperationMeterBinder();
}

@Bean
ServerMeterBuilder getServerMeterBuilder() {
return new ServerMeterBuilder();
}

// @Bean
// MappingPdxSerializer myCustomMappingPdxSerializer() {
// logger.warn("XXX Client.myCustomMappingPdxSerializer ", new Exception());
Expand Down
Loading

0 comments on commit 5b76d73

Please sign in to comment.