Skip to content

Commit bd47d61

Browse files
authored
Merge branch 'main' into genesis-js-release-test
2 parents 22f66ab + fcdd4c4 commit bd47d61

File tree

8 files changed

+171
-17
lines changed

8 files changed

+171
-17
lines changed

.github/workflows/java-sample-app-s3-deploy.yml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ jobs:
8686
role-to-assume: arn:aws:iam::${{ env.ACCOUNT_ID }}:role/${{ env.E2E_TEST_ROLE_NAME }}
8787
aws-region: ${{ matrix.aws-region }}
8888

89-
- name: Build and Upload Main Jar
89+
- name: Build and Upload Remote Jar
9090
working-directory: sample-apps/java/springboot-remote-service
9191
run: |
9292
gradle build -P javaVersion=11
@@ -206,3 +206,40 @@ jobs:
206206
gradle build
207207
gradle createLambdaZip
208208
aws s3api put-object --bucket aws-appsignals-sample-app-prod-${{ matrix.aws-region }} --body ./build/distributions/lambda-function.zip --key java-lambda-function.zip
209+
210+
java-v11-adaptive-sampling:
211+
runs-on: ubuntu-latest
212+
steps:
213+
- uses: actions/checkout@v4
214+
with:
215+
fetch-depth: 0
216+
217+
- name: Configure AWS Credentials
218+
uses: aws-actions/configure-aws-credentials@v4
219+
with:
220+
role-to-assume: arn:aws:iam::${{ env.E2E_TEST_ACCOUNT_ID }}:role/${{ env.E2E_TEST_ROLE_NAME }}
221+
aws-region: us-east-1
222+
223+
- name: Retrieve account
224+
uses: aws-actions/aws-secretsmanager-get-secrets@v1
225+
with:
226+
secret-ids:
227+
ACCOUNT_ID, adaptive-sampling-region-account/prod-us-west-2
228+
229+
- name: Configure AWS Credentials
230+
uses: aws-actions/configure-aws-credentials@v4
231+
with:
232+
role-to-assume: arn:aws:iam::${{ env.ACCOUNT_ID }}:role/${{ env.E2E_TEST_ROLE_NAME }}
233+
aws-region: us-west-2
234+
235+
- name: Build and Upload Main JAR
236+
working-directory: sample-apps/java/springboot-main-service
237+
run: |
238+
gradle build -P javaVersion=11
239+
aws s3api put-object --bucket aws-appsignals-sample-app-prod-us-west-2-adap --body ./build/libs/springboot-*-SNAPSHOT.jar --key java-main-service-v11.jar
240+
241+
- name: Build and Upload Remote JAR
242+
working-directory: sample-apps/java/springboot-remote-service
243+
run: |
244+
gradle build -P javaVersion=11
245+
aws s3api put-object --bucket aws-appsignals-sample-app-prod-us-west-2-adap --body build/libs/springboot-remote-service-*-SNAPSHOT.jar --key java-remote-service-v11.jar

.github/workflows/k8s-patch-os-jobs.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,7 @@ jobs:
123123
run-dotnet-k8s-test:
124124
if: ${{ inputs.LANGUAGE == 'dotnet' }}
125125
needs: create-k8s-on-ec2
126-
# TODO: Point to REAL K8s implementation after K8s Infra created.
127-
uses: ./.github/workflows/dummy-k8s-test.yml
126+
uses: ./.github/workflows/dotnet-k8s-test.yml
128127
secrets: inherit
129128
with:
130129
aws-region: 'us-east-1'
@@ -134,8 +133,7 @@ jobs:
134133
run-node-k8s-test:
135134
if: ${{ inputs.LANGUAGE == 'node' }}
136135
needs: create-k8s-on-ec2
137-
# TODO: Point to REAL K8s implementation after K8s Infra created.
138-
uses: ./.github/workflows/dummy-k8s-test.yml
136+
uses: ./.github/workflows/node-k8s-test.yml
139137
secrets: inherit
140138
with:
141139
aws-region: 'us-east-1'

.github/workflows/node-k8s-test.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,17 +94,13 @@ jobs:
9494
NODE_REMOTE_SAMPLE_APP_IMAGE, e2e-test/node-remote-sample-app-image
9595
RELEASE_TESTING_ECR_ACCOUNT, e2e-test/${{ github.event.repository.name }}/node-k8s-release-testing-account
9696
97-
# Temporarily use Java K8s Canary Cluster for Node.js e2e tests
9897
- name: Retrieve K8s EC2 Secrets
9998
if: ${{ env.CALLER_WORKFLOW_NAME != 'k8s-os-patching' }}
10099
uses: aws-actions/aws-secretsmanager-get-secrets@v1
101100
with:
102-
# secret-ids: |
103-
# MAIN_SERVICE_ENDPOINT, e2e-test/${{ github.event.repository.name }}/node-k8s-master-node-endpoint
104-
# MASTER_NODE_SSH_KEY, e2e-test/${{ github.event.repository.name }}/node-k8s-ssh-key
105101
secret-ids: |
106-
MAIN_SERVICE_ENDPOINT, e2e-test/aws-application-signals-test-framework/java-k8s-master-node-endpoint
107-
MASTER_NODE_SSH_KEY, e2e-test/aws-application-signals-test-framework/java-k8s-ssh-key
102+
MAIN_SERVICE_ENDPOINT, e2e-test/${{ github.event.repository.name }}/node-k8s-master-node-endpoint
103+
MASTER_NODE_SSH_KEY, e2e-test/${{ github.event.repository.name }}/node-k8s-ssh-key
108104
109105
- name: Retrieve K8s EC2 OS Patching Secrets
110106
if: ${{ env.CALLER_WORKFLOW_NAME == 'k8s-os-patching' }}

.github/workflows/util/setup-k8s.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ function run_k8s_master() {
9393
sudo containerd config default > config.toml
9494
sudo cp config.toml /etc/containerd/config.toml
9595
sudo sed -i 's/SystemdCgroup \= false/SystemdCgroup \= true/' /etc/containerd/config.toml
96-
sudo sed -i 's/systemd_cgroup \= true/systemd_cgroup \= true/' /etc/containerd/config.toml
96+
grep -Eq '^[[:space:]]*"?SystemdCgroup"?[[:space:]]*=[[:space:]]*true' /etc/containerd/config.toml || \
97+
sudo sed -i "/^[[:space:]]*\\[plugins\\.'io\\.containerd\\.cri\\.v1\\.runtime'\\.containerd\\.runtimes\\.runc\\.options\\]/a\ SystemdCgroup = true" /etc/containerd/config.toml
9798
sudo systemctl restart containerd && sleep 20
9899
sudo setenforce 0 && sudo sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config
99100
echo -e "[kubernetes]\nname=Kubernetes\nbaseurl=https://pkgs.k8s.io/core:/stable:/v1.29/rpm/\nenabled=1\ngpgcheck=1\ngpgkey=https://pkgs.k8s.io/core:/stable:/v1.29/rpm/repodata/repomd.xml.key\nexclude=kubelet kubeadm kubectl cri-tools kubernetes-cni" | sudo tee /etc/yum.repos.d/kubernetes.repo
@@ -142,7 +143,8 @@ function run_k8s_worker() {
142143
sudo containerd config default > config.toml
143144
sudo cp config.toml /etc/containerd/config.toml
144145
sudo sed -i 's/SystemdCgroup \= false/SystemdCgroup \= true/' /etc/containerd/config.toml
145-
sudo sed -i 's/systemd_cgroup \= true/systemd_cgroup \= true/' /etc/containerd/config.toml
146+
grep -Eq '^[[:space:]]*"?SystemdCgroup"?[[:space:]]*=[[:space:]]*true' /etc/containerd/config.toml || \
147+
sudo sed -i "/^[[:space:]]*\\[plugins\\.'io\\.containerd\\.cri\\.v1\\.runtime'\\.containerd\\.runtimes\\.runc\\.options\\]/a\ SystemdCgroup = true" /etc/containerd/config.toml
146148
sudo systemctl restart containerd
147149
sudo setenforce 0 && sudo sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config
148150
echo -e "[kubernetes]\nname=Kubernetes\nbaseurl=https://pkgs.k8s.io/core:/stable:/v1.29/rpm/\nenabled=1\ngpgcheck=1\ngpgkey=https://pkgs.k8s.io/core:/stable:/v1.29/rpm/repodata/repomd.xml.key\nexclude=kubelet kubeadm kubectl cri-tools kubernetes-cni" | sudo tee /etc/yum.repos.d/kubernetes.repo
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: Validate E2E Tests Are Accounted For
2+
on:
3+
workflow_call:
4+
inputs:
5+
exclusions:
6+
description: 'Comma-separated list of test files to exclude from validation'
7+
type: string
8+
required: false
9+
default: ''
10+
11+
env:
12+
TEST_RESOURCES_FOLDER: ${GITHUB_WORKSPACE}
13+
EXCLUSIONS: ${{ inputs.exclusions }}
14+
15+
jobs:
16+
validate-e2e-tests-are-accounted-for:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Install Ruby
20+
uses: ruby/[email protected]
21+
with:
22+
ruby-version: "3.4"
23+
24+
- name: Checkout aws-application-signals-test-framework
25+
run: |
26+
cd ${{ env.TEST_RESOURCES_FOLDER }}
27+
git clone https://github.com/aws-observability/aws-application-signals-test-framework.git
28+
29+
- name: Determine workflow files expected to be used by ADOT Java
30+
if: contains(github.repository, 'aws-otel-java-instrumentation')
31+
run: |
32+
cd ${{ env.TEST_RESOURCES_FOLDER }}/aws-application-signals-test-framework/.github/workflows/
33+
EXCLUSIONS="${{ env.EXCLUSIONS }}"
34+
[[ -n "$EXCLUSIONS" ]] && echo "Applying exclusions to TESTS_EXPECTED: $EXCLUSIONS"
35+
echo "TESTS_EXPECTED=$(ls | grep -E '(^java-)|(^metric-limiter-)' | grep -Ev '(lambda-layer-perf-test|otlp-ocb)' | grep -E 'test\.ya?ml$' | { [[ -n "$EXCLUSIONS" ]] && grep -v -F -f <(echo "$EXCLUSIONS" | tr ',' '\n') || cat; } | sort | tr '\n' ' ' | sed 's/ $//')" >> $GITHUB_ENV
36+
37+
- name: Determine workflow files expected to be used by ADOT JavaScript
38+
if: contains(github.repository, 'aws-otel-js-instrumentation')
39+
run: |
40+
cd ${{ env.TEST_RESOURCES_FOLDER }}/aws-application-signals-test-framework/.github/workflows/
41+
EXCLUSIONS="${{ env.EXCLUSIONS }}"
42+
[[ -n "$EXCLUSIONS" ]] && echo "Applying exclusions to TESTS_EXPECTED: $EXCLUSIONS"
43+
echo "TESTS_EXPECTED=$(ls | grep -E '^node-' | grep -v 'lambda-layer-perf-test' | grep -E 'test\.ya?ml$' | { [[ -n "$EXCLUSIONS" ]] && grep -v -F -f <(echo "$EXCLUSIONS" | tr ',' '\n') || cat; } | sort | tr '\n' ' ' | sed 's/ $//')" >> $GITHUB_ENV
44+
45+
- name: Determine workflow files expected to be used by ADOT Python
46+
if: contains(github.repository, 'aws-otel-python-instrumentation')
47+
run: |
48+
cd ${{ env.TEST_RESOURCES_FOLDER }}/aws-application-signals-test-framework/.github/workflows/
49+
EXCLUSIONS="${{ env.EXCLUSIONS }}"
50+
[[ -n "$EXCLUSIONS" ]] && echo "Applying exclusions to TESTS_EXPECTED: $EXCLUSIONS"
51+
echo "TESTS_EXPECTED=$(ls | grep -E '^python-' | grep -v 'lambda-layer-perf-test' | grep -E 'test\.ya?ml$' | { [[ -n "$EXCLUSIONS" ]] && grep -v -F -f <(echo "$EXCLUSIONS" | tr ',' '\n') || cat; } | sort | tr '\n' ' ' | sed 's/ $//')" >> $GITHUB_ENV
52+
53+
- name: Determine workflow files expected to be used by ADOT .NET
54+
if: contains(github.repository, 'aws-otel-dotnet-instrumentation')
55+
run: |
56+
cd ${{ env.TEST_RESOURCES_FOLDER }}/aws-application-signals-test-framework/.github/workflows/
57+
EXCLUSIONS="${{ env.EXCLUSIONS }}"
58+
[[ -n "$EXCLUSIONS" ]] && echo "Applying exclusions to TESTS_EXPECTED: $EXCLUSIONS"
59+
echo "TESTS_EXPECTED=$(ls | grep -E '^dotnet-' | grep -v 'lambda-layer-perf-test' | grep -E 'test\.ya?ml$' | { [[ -n "$EXCLUSIONS" ]] && grep -v -F -f <(echo "$EXCLUSIONS" | tr ',' '\n') || cat; } | sort | tr '\n' ' ' | sed 's/ $//')" >> $GITHUB_ENV
60+
61+
- name: Determine workflow files expected to be used by CloudWatch Agent
62+
if: contains(github.repository, 'amazon-cloudwatch-agent')
63+
run: |
64+
cd ${{ env.TEST_RESOURCES_FOLDER }}/aws-application-signals-test-framework/.github/workflows/
65+
EXCLUSIONS="${{ env.EXCLUSIONS }}"
66+
[[ -n "$EXCLUSIONS" ]] && echo "Applying exclusions to TESTS_EXPECTED: $EXCLUSIONS"
67+
echo "TESTS_EXPECTED=$(ls | grep -E '(^java-)|(^node-)|(^python-)|(^dotnet-)|(^metric-limiter-)' | grep -Ev '(sigv4|lambda-test|lambda-layer-perf-test|ocb|genesis)' | grep -E 'test\.ya?ml$' | { [[ -n "$EXCLUSIONS" ]] && grep -v -F -f <(echo "$EXCLUSIONS" | tr ',' '\n') || cat; } | sort | tr '\n' ' ' | sed 's/ $//')" >> $GITHUB_ENV
68+
69+
- name: Determine workflow files actually being used by ${{ github.repository }}
70+
run: |
71+
cd ${{ env.TEST_RESOURCES_FOLDER }}
72+
git clone -b ${{ github.ref_name }} https://github.com/${{ github.repository }}.git ${{ github.repository }}
73+
cd ${{ github.repository }}/.github/workflows/
74+
75+
# Get all test framework workflows actually used in application-signals-e2e-test.yml, with exclusions applied
76+
EXCLUSIONS="${{ env.EXCLUSIONS }}"
77+
[[ -n "$EXCLUSIONS" ]] && echo "Applying exclusions to TESTS_ACTUALLY_USED: $EXCLUSIONS"
78+
echo "TESTS_ACTUALLY_USED=$(ruby -ryaml -e '
79+
exclusions = "${{ env.EXCLUSIONS }}".split(",").map(&:strip).reject(&:empty?)
80+
workflows = YAML.load_file("application-signals-e2e-test.yml")["jobs"].values
81+
.map { |v| v["uses"] }
82+
.compact
83+
.uniq
84+
# Ignore the Job that triggers this "validate-e2e-tests-are-accounted-for" validation
85+
.select { |u| u.include?("aws-application-signals-test-framework/.github/workflows") && !u.include?("validate-e2e-tests-are-accounted-for") }
86+
.map { |u| u.split("/").last.split("@").first }
87+
.reject { |w| exclusions.include?(w) }
88+
.sort
89+
puts workflows.join(" ")
90+
')" >> $GITHUB_ENV
91+
92+
- name: Compare TESTS_ACTUALLY_USED and TESTS_EXPECTED
93+
run: |
94+
echo "Tests being used:"
95+
echo "- $TESTS_ACTUALLY_USED"
96+
echo "Tests expected to be used:"
97+
echo "- $TESTS_EXPECTED"
98+
if [[ -z "$TESTS_ACTUALLY_USED" || -z "$TESTS_EXPECTED" || "$TESTS_ACTUALLY_USED" != "$TESTS_EXPECTED" ]]; then
99+
echo "Mismatch found!"
100+
exit 1
101+
fi

sample-apps/java/springboot-main-service/src/main/java/com/amazon/sampleapp/FrontendServiceController.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@
3838
import org.springframework.beans.factory.annotation.Autowired;
3939
import org.springframework.context.annotation.Bean;
4040
import org.springframework.stereotype.Controller;
41+
import org.springframework.http.ResponseEntity;
4142
import org.springframework.web.bind.annotation.GetMapping;
43+
import org.springframework.web.bind.annotation.PathVariable;
4244
import org.springframework.web.bind.annotation.RequestParam;
4345
import org.springframework.web.bind.annotation.ResponseBody;
4446
import software.amazon.awssdk.services.s3.S3Client;
@@ -164,6 +166,20 @@ public String mysql() {
164166
return getXrayTraceId();
165167
}
166168

169+
@GetMapping("/status/{code}")
170+
@ResponseBody
171+
public ResponseEntity<String> status(@PathVariable int code, @RequestParam(name = "ip", defaultValue = "localhost") String ip) {
172+
ip = ip.replace("/", "");
173+
try {
174+
HttpGet request = new HttpGet("http://" + ip + ":8080/status/" + code);
175+
httpClient.execute(request).close();
176+
} catch (Exception e) {
177+
// Ignore exception
178+
}
179+
logger.info("Service A requested status code {} from Service B", code);
180+
return ResponseEntity.ok(getXrayTraceId());
181+
}
182+
167183
// get x-ray trace id
168184
private String getXrayTraceId() {
169185
String traceId = Span.current().getSpanContext().getTraceId();

sample-apps/java/springboot-remote-service/src/main/java/com/amazon/sampleapp/RemoteServiceController.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515

1616
package com.amazon.sampleapp;
1717

18+
import org.springframework.http.ResponseEntity;
1819
import org.springframework.stereotype.Controller;
1920
import org.springframework.web.bind.annotation.GetMapping;
21+
import org.springframework.web.bind.annotation.PathVariable;
2022
import org.springframework.web.bind.annotation.ResponseBody;
2123

2224
@Controller
@@ -27,4 +29,9 @@ public class RemoteServiceController {
2729
public String healthcheck() {
2830
return "Remote service healthcheck";
2931
}
32+
33+
@GetMapping("/status/{code}")
34+
public ResponseEntity<String> status(@PathVariable int code) {
35+
return ResponseEntity.status(code).build();
36+
}
3037
}

validator/src/main/resources/expected-data-template/java/eks-otlp-ocb/remote-service-trace.mustache

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,7 @@
7070
},
7171
"subsegments": [
7272
{
73-
"name": "^RemoteServiceController.healthcheck$",
74-
"annotations": {
75-
"aws.local.environment": "^eks:{{platformInfo}}/{{appNamespace}}$"
76-
}
73+
"name": "^RemoteServiceController.healthcheck$"
7774
}
7875
]
7976
}]

0 commit comments

Comments
 (0)