Skip to content

Commit 1690fde

Browse files
authored
Merge pull request #41 from jj22ee/metric-rollup-tests
Add Test Cases for Metric Rollup Addition of [RemoteService, RemoteTarget, ...]
2 parents 0e48219 + 94208cf commit 1690fde

40 files changed

+488
-92
lines changed

.github/workflows/application-signals-python-e2e-ec2-test.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ jobs:
168168
continue-on-error: true
169169
run: |
170170
curl -S -s -o /dev/null http://${{ env.MAIN_SERVICE_ENDPOINT }}/outgoing-http-call; echo
171-
curl -S -s -o /dev/null http://${{ env.MAIN_SERVICE_ENDPOINT }}/aws-sdk-call; echo
171+
curl -S -s -o /dev/null http://${{ env.MAIN_SERVICE_ENDPOINT }}/aws-sdk-call?testingId=${{ env.TESTING_ID }}; echo
172172
curl -S -s -o /dev/null http://${{ env.MAIN_SERVICE_ENDPOINT }}/remote-service?ip=${{ env.REMOTE_SERVICE_IP }}; echo
173173
curl -S -s -o /dev/null http://${{ env.MAIN_SERVICE_ENDPOINT }}/client-call; echo
174174
@@ -184,36 +184,39 @@ jobs:
184184
- name: Validate generated EMF logs
185185
id: log-validation
186186
run: ./gradlew validator:run --args='-c python/ec2/log-validation.yml
187+
--testing-id ${{ env.TESTING_ID }}
187188
--endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }}
188189
--remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8001
189190
--region ${{ inputs.aws-region }}
190191
--metric-namespace ${{ env.METRIC_NAMESPACE }}
191192
--log-group ${{ env.LOG_GROUP_NAME }}
192193
--service-name python-sample-application-${{ env.TESTING_ID }}
193194
--remote-service-name python-sample-remote-application-${{ env.TESTING_ID }}
194-
--request-body ip=${{ env.REMOTE_SERVICE_IP }}
195+
--query-string ip=${{ env.REMOTE_SERVICE_IP }}
195196
--instance-ami ${{ env.EC2_INSTANCE_AMI }}
196197
--rollup'
197198

198199
- name: Validate generated metrics
199200
id: metric-validation
200201
if: (success() || steps.log-validation.outcome == 'failure') && !cancelled()
201202
run: ./gradlew validator:run --args='-c python/ec2/metric-validation.yml
203+
--testing-id ${{ env.TESTING_ID }}
202204
--endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }}
203205
--remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8001
204206
--region ${{ inputs.aws-region }}
205207
--metric-namespace ${{ env.METRIC_NAMESPACE }}
206208
--log-group ${{ env.LOG_GROUP_NAME }}
207209
--service-name python-sample-application-${{ env.TESTING_ID }}
208210
--remote-service-name python-sample-remote-application-${{ env.TESTING_ID }}
209-
--request-body ip=${{ env.REMOTE_SERVICE_IP }}
211+
--query-string ip=${{ env.REMOTE_SERVICE_IP }}&testingId=${{ env.TESTING_ID }}
210212
--instance-ami ${{ env.EC2_INSTANCE_AMI }}
211213
--rollup'
212214

213215
- name: Validate generated traces
214216
id: trace-validation
215217
if: (success() || steps.log-validation.outcome == 'failure' || steps.metric-validation.outcome == 'failure') && !cancelled()
216218
run: ./gradlew validator:run --args='-c python/ec2/trace-validation.yml
219+
--testing-id ${{ env.TESTING_ID }}
217220
--endpoint http://${{ env.MAIN_SERVICE_ENDPOINT }}
218221
--remote-service-deployment-name ${{ env.REMOTE_SERVICE_IP }}:8001
219222
--region ${{ inputs.aws-region }}
@@ -222,7 +225,7 @@ jobs:
222225
--log-group ${{ env.LOG_GROUP_NAME }}
223226
--service-name python-sample-application-${{ env.TESTING_ID }}
224227
--remote-service-name python-sample-remote-application-${{ env.TESTING_ID }}
225-
--request-body ip=${{ env.REMOTE_SERVICE_IP }}
228+
--query-string ip=${{ env.REMOTE_SERVICE_IP }}
226229
--instance-ami ${{ env.EC2_INSTANCE_AMI }}
227230
--rollup'
228231

.github/workflows/application-signals-python-e2e-eks-test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ jobs:
253253
continue-on-error: true
254254
run: |
255255
curl -S -s -o /dev/null http://${{ env.APP_ENDPOINT }}/outgoing-http-call; echo
256-
curl -S -s -o /dev/null http://${{ env.APP_ENDPOINT }}/aws-sdk-call; echo
256+
curl -S -s -o /dev/null http://${{ env.APP_ENDPOINT }}/aws-sdk-call?testingId=${{ env.TESTING_ID }}; echo
257257
curl -S -s -o /dev/null http://${{ env.APP_ENDPOINT }}/remote-service?ip=${{ env.REMOTE_SERVICE_POD_IP }}; echo
258258
curl -S -s -o /dev/null http://${{ env.APP_ENDPOINT }}/client-call; echo
259259
@@ -280,7 +280,7 @@ jobs:
280280
--platform-info ${{ inputs.test-cluster-name }}
281281
--service-name python-application-${{ env.TESTING_ID }}
282282
--remote-service-deployment-name ${{ env.REMOTE_SERVICE_DEPLOYMENT_NAME }}
283-
--request-body ip=${{ env.REMOTE_SERVICE_POD_IP }}
283+
--query-string ip=${{ env.REMOTE_SERVICE_POD_IP }}
284284
--rollup'
285285

286286
- name: Call endpoints and validate generated metrics
@@ -298,7 +298,7 @@ jobs:
298298
--service-name python-application-${{ env.TESTING_ID }}
299299
--remote-service-name python-remote-application-${{ env.TESTING_ID }}
300300
--remote-service-deployment-name ${{ env.REMOTE_SERVICE_DEPLOYMENT_NAME }}
301-
--request-body ip=${{ env.REMOTE_SERVICE_POD_IP }}
301+
--query-string ip=${{ env.REMOTE_SERVICE_POD_IP }}&testingId=${{ env.TESTING_ID }}
302302
--rollup'
303303

304304
- name: Call endpoints and validate generated traces
@@ -314,7 +314,7 @@ jobs:
314314
--platform-info ${{ inputs.test-cluster-name }}
315315
--service-name python-application-${{ env.TESTING_ID }}
316316
--remote-service-deployment-name ${{ env.REMOTE_SERVICE_DEPLOYMENT_NAME }}
317-
--request-body ip=${{ env.REMOTE_SERVICE_POD_IP }}
317+
--query-string ip=${{ env.REMOTE_SERVICE_POD_IP }}
318318
--rollup'
319319

320320
- name: Publish metric on test result

.github/workflows/appsignals-e2e-ec2-test.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,10 @@ jobs:
165165
- name: Call all test APIs
166166
continue-on-error: true
167167
run: |
168-
curl -S -s http://${{ env.MAIN_SERVICE_ENDPOINT }}/outgoing-http-call/
169-
curl -S -s http://${{ env.MAIN_SERVICE_ENDPOINT }}/aws-sdk-call/
170-
curl -S -s http://${{ env.MAIN_SERVICE_ENDPOINT }}/remote-service?ip=${{ env.REMOTE_SERVICE_IP }}/
171-
curl -S -s http://${{ env.MAIN_SERVICE_ENDPOINT }}/client-call/
168+
curl -S -s http://${{ env.MAIN_SERVICE_ENDPOINT }}/outgoing-http-call
169+
curl -S -s http://${{ env.MAIN_SERVICE_ENDPOINT }}/aws-sdk-call?testingId=${{ env.TESTING_ID }}
170+
curl -S -s http://${{ env.MAIN_SERVICE_ENDPOINT }}/remote-service?ip=${{ env.REMOTE_SERVICE_IP }}
171+
curl -S -s http://${{ env.MAIN_SERVICE_ENDPOINT }}/client-call
172172
173173
- name: Initiate Gradlew Daemon
174174
uses: ./.github/workflows/actions/execute_and_retry
@@ -191,7 +191,7 @@ jobs:
191191
--log-group ${{ env.LOG_GROUP_NAME }}
192192
--service-name sample-application-${{ env.TESTING_ID }}
193193
--remote-service-name sample-remote-application-${{ env.TESTING_ID }}
194-
--request-body ip=${{ env.REMOTE_SERVICE_IP }}
194+
--query-string ip=${{ env.REMOTE_SERVICE_IP }}
195195
--instance-ami ${{ env.EC2_INSTANCE_AMI }}
196196
--rollup'
197197

@@ -208,7 +208,7 @@ jobs:
208208
--log-group ${{ env.LOG_GROUP_NAME }}
209209
--service-name sample-application-${{ env.TESTING_ID }}
210210
--remote-service-name sample-remote-application-${{ env.TESTING_ID }}
211-
--request-body ip=${{ env.REMOTE_SERVICE_IP }}
211+
--query-string ip=${{ env.REMOTE_SERVICE_IP }}&testingId=${{ env.TESTING_ID }}
212212
--instance-ami ${{ env.EC2_INSTANCE_AMI }}
213213
--rollup'
214214

@@ -225,7 +225,7 @@ jobs:
225225
--log-group ${{ env.LOG_GROUP_NAME }}
226226
--service-name sample-application-${{ env.TESTING_ID }}
227227
--remote-service-name sample-remote-application-${{ env.TESTING_ID }}
228-
--request-body ip=${{ env.REMOTE_SERVICE_IP }}
228+
--query-string ip=${{ env.REMOTE_SERVICE_IP }}
229229
--instance-ami ${{ env.EC2_INSTANCE_AMI }}
230230
--rollup'
231231

.github/workflows/appsignals-e2e-eks-test.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -261,10 +261,10 @@ jobs:
261261
- name: Call all test APIs
262262
continue-on-error: true
263263
run: |
264-
curl -S -s http://${{ env.APP_ENDPOINT }}/outgoing-http-call/
265-
curl -S -s http://${{ env.APP_ENDPOINT }}/aws-sdk-call/
266-
curl -S -s http://${{ env.APP_ENDPOINT }}/remote-service?ip=${{ env.REMOTE_SERVICE_POD_IP }}/
267-
curl -S -s http://${{ env.APP_ENDPOINT }}/client-call/
264+
curl -S -s http://${{ env.APP_ENDPOINT }}/outgoing-http-call
265+
curl -S -s http://${{ env.APP_ENDPOINT }}/aws-sdk-call?testingId=${{ env.TESTING_ID }}
266+
curl -S -s http://${{ env.APP_ENDPOINT }}/remote-service?ip=${{ env.REMOTE_SERVICE_POD_IP }}
267+
curl -S -s http://${{ env.APP_ENDPOINT }}/client-call
268268
269269
- name: Initiate Gradlew Daemon
270270
uses: ./.github/workflows/actions/execute_and_retry
@@ -289,7 +289,7 @@ jobs:
289289
--platform-info ${{ inputs.test-cluster-name }}
290290
--service-name sample-application-${{ env.TESTING_ID }}
291291
--remote-service-deployment-name ${{ env.REMOTE_SERVICE_DEPLOYMENT_NAME }}
292-
--request-body ip=${{ env.REMOTE_SERVICE_POD_IP }}
292+
--query-string ip=${{ env.REMOTE_SERVICE_POD_IP }}
293293
--rollup'
294294

295295
- name: Call endpoints and validate generated metrics
@@ -307,7 +307,7 @@ jobs:
307307
--service-name sample-application-${{ env.TESTING_ID }}
308308
--remote-service-name sample-remote-application-${{ env.TESTING_ID }}
309309
--remote-service-deployment-name ${{ env.REMOTE_SERVICE_DEPLOYMENT_NAME }}
310-
--request-body ip=${{ env.REMOTE_SERVICE_POD_IP }}
310+
--query-string ip=${{ env.REMOTE_SERVICE_POD_IP }}&testingId=${{ env.TESTING_ID }}
311311
--rollup'
312312

313313
- name: Call endpoints and validate generated traces
@@ -324,7 +324,7 @@ jobs:
324324
--platform-info ${{ inputs.test-cluster-name }}
325325
--service-name sample-application-${{ env.TESTING_ID }}
326326
--remote-service-deployment-name ${{ env.REMOTE_SERVICE_DEPLOYMENT_NAME }}
327-
--request-body ip=${{ env.REMOTE_SERVICE_POD_IP }}
327+
--query-string ip=${{ env.REMOTE_SERVICE_POD_IP }}
328328
--rollup'
329329

330330
- name: Publish metric on test result

.github/workflows/appsignals-e2e-k8s-test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ jobs:
120120
--app-namespace ${{ env.SAMPLE_APP_NAMESPACE }}
121121
--service-name sample-application-${{ env.TESTING_ID }}
122122
--remote-service-name sample-r-app-deployment-${{ env.TESTING_ID }}
123-
--request-body ip=${{ env.REMOTE_SERVICE_IP }}
123+
--query-string ip=${{ env.REMOTE_SERVICE_IP }}
124124
--rollup'
125125

126126
- name: Validate generated metrics
@@ -138,7 +138,7 @@ jobs:
138138
--service-name sample-application-${{ env.TESTING_ID }}
139139
--remote-service-name sample-r-app-deployment-${{ env.TESTING_ID }}
140140
--remote-service-deployment-name sample-r-app-deployment-${{ env.TESTING_ID }}
141-
--request-body ip=${{ env.REMOTE_SERVICE_IP }}
141+
--query-string ip=${{ env.REMOTE_SERVICE_IP }}
142142
--rollup'
143143

144144
- name: Validate generated traces
@@ -156,7 +156,7 @@ jobs:
156156
--service-name sample-application-${{ env.TESTING_ID }}
157157
--remote-service-name sample-r-app-deployment-${{ env.TESTING_ID }}
158158
--remote-service-deployment-name sample-r-app-deployment-${{ env.TESTING_ID }}
159-
--request-body ip=${{ env.REMOTE_SERVICE_IP }}
159+
--query-string ip=${{ env.REMOTE_SERVICE_IP }}
160160
--rollup'
161161

162162
- name: Publish metric on test result

terraform/ec2/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ resource "null_resource" "remote_service_setup" {
177177
"echo $agent_config > amazon-cloudwatch-agent.json",
178178

179179
# Get and run CW agent rpm
180-
"${var.get_cw_agent_rpm_command}",
180+
"${var.get_cw_agent_rpm_command}",
181181
"sudo rpm -U ./cw-agent.rpm",
182182
"sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:./amazon-cloudwatch-agent.json",
183183

validator/src/main/java/com/amazon/aoc/App.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ public class App implements Callable<Integer> {
7878
@CommandLine.Option(names = {"--endpoint"})
7979
private String endpoint;
8080

81-
@CommandLine.Option(names = {"--request-body"})
82-
private String requestBody;
81+
@CommandLine.Option(names = {"--query-string"})
82+
private String queryString;
8383

8484
@CommandLine.Option(
8585
names = {"--log-group"},
@@ -161,7 +161,7 @@ public Integer call() throws Exception {
161161
context.setRemoteServiceName(this.remoteServiceName);
162162
context.setRemoteServiceDeploymentName(this.remoteServiceDeploymentName);
163163
context.setEndpoint(this.endpoint);
164-
context.setRequestBody(this.requestBody);
164+
context.setQueryString(this.queryString);
165165
context.setLogGroup(this.logGroup);
166166
context.setEcsContext(buildJsonContext(ecsContext, ECSContext.class));
167167
context.setEc2Context(buildJsonContext(ec2Context, EC2Context.class));

validator/src/main/java/com/amazon/aoc/callers/HttpCaller.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
public class HttpCaller implements ICaller {
3333
private String url;
3434
private String path;
35-
private String requestBody;
35+
private String queryString;
3636

3737
/**
3838
* construct httpCaller.
@@ -51,11 +51,11 @@ public HttpCaller(String endpoint, String path) {
5151
*
5252
* @param endpoint the endpoint to call, for example "http://127.0.0.1:8080"
5353
* @param path the path to call, for example "/test"
54-
* @param requestBody the request body, for example "key=value"
54+
* @param queryString the query string, for example "key1=value1&key2=value2"
5555
*/
56-
public HttpCaller(String endpoint, String path, String requestBody) {
56+
public HttpCaller(String endpoint, String path, String queryString) {
5757
this.path = path;
58-
this.url = endpoint + path + "?" + requestBody + "/";
58+
this.url = endpoint + path + "?" + queryString;
5959
log.info("validator is trying to hit this {} endpoint", this.url);
6060
}
6161

validator/src/main/java/com/amazon/aoc/models/Context.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public class Context {
5151

5252
private String endpoint;
5353

54-
private String requestBody;
54+
private String queryString;
5555

5656
private String logGroup;
5757

validator/src/main/java/com/amazon/aoc/models/ValidationConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class ValidationConfig {
2828

2929
String httpPath;
3030
String httpMethod;
31-
String requestBody;
31+
String queryString;
3232

3333
String expectedResultPath;
3434
Boolean shouldValidateMetricValue;

validator/src/main/java/com/amazon/aoc/services/CloudWatchService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
public class CloudWatchService {
3636
public static final String SERVICE_DIMENSION = "Service";
3737
public static final String REMOTE_SERVICE_DIMENSION = "RemoteService";
38+
public static final String REMOTE_TARGET_DIMENSION = "RemoteTarget";
3839

3940
private static final int MAX_QUERY_PERIOD = 60;
4041
private static final String REQUESTER = "integrationTest";

validator/src/main/java/com/amazon/aoc/validators/CWMetricValidator.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,17 +90,20 @@ public void validate() throws Exception {
9090
RetryHelper.retry(
9191
maxRetryCount,
9292
() -> {
93-
// We will query both the Service and RemoteService dimensions to ensure we get all
94-
// metrics from all aggregations, specifically the [RemoteService] aggregation.
93+
// We will query the Service, RemoteService, and RemoteTarget dimensions to ensure we
94+
// get all metrics from all aggregations, specifically the [RemoteService] aggregation.
9595
List<String> serviceNames =
9696
Lists.newArrayList(
9797
context.getServiceName(), context.getRemoteServiceDeploymentName());
98-
// TODO - Put the following back in: "www.amazon.com", "AWS.SDK.S3"
9998
List<String> remoteServiceNames =
10099
Lists.newArrayList(context.getRemoteServiceDeploymentName());
100+
List<String> remoteTargetNames = Lists.newArrayList();
101101
if (context.getRemoteServiceName() != null && !context.getRemoteServiceName().isEmpty()) {
102102
serviceNames.add(context.getRemoteServiceName());
103103
}
104+
if (context.getTestingId() != null && !context.getTestingId().isEmpty()) {
105+
remoteTargetNames.add("::s3:::e2e-test-bucket-name-" + context.getTestingId());
106+
}
104107

105108
List<Metric> actualMetricList = Lists.newArrayList();
106109
addMetrics(
@@ -113,6 +116,11 @@ public void validate() throws Exception {
113116
remoteServiceNames,
114117
expectedMetricList,
115118
actualMetricList);
119+
addMetrics(
120+
CloudWatchService.REMOTE_TARGET_DIMENSION,
121+
remoteTargetNames,
122+
expectedMetricList,
123+
actualMetricList);
116124

117125
// remove the skip dimensions
118126
log.info("dimensions to be skipped in validation: {}", skippedDimensionNameList);

validator/src/main/java/com/amazon/aoc/validators/ValidatorFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ public IValidator launchValidator(ValidationConfig validationConfig) throws Exce
6464
case "http":
6565
caller = new HttpCaller(context.getEndpoint(), validationConfig.getHttpPath());
6666
break;
67-
case "http-with-body":
67+
case "http-with-query":
6868
// ONLY ONE OF THESE CAN BE USED PER VALIDATOR CALL
6969
caller =
7070
new HttpCaller(
71-
context.getEndpoint(), validationConfig.getHttpPath(), context.getRequestBody());
71+
context.getEndpoint(), validationConfig.getHttpPath(), context.getQueryString());
7272
break;
7373
case "none":
7474
caller = null;

0 commit comments

Comments
 (0)