Skip to content

Commit 196a960

Browse files
authored
feat: Adding E2E tracing test for RDS database interactions (#101)
This change introduces E2E trace test for Application Signals <-> RDS database interaction in EKS Java workflow.
1 parent 827ac08 commit 196a960

File tree

4 files changed

+95
-1
lines changed

4 files changed

+95
-1
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,7 @@ jobs:
408408
--platform-info ${{ env.CLUSTER_NAME }}
409409
--service-name sample-application-${{ env.TESTING_ID }}
410410
--remote-service-deployment-name ${{ env.REMOTE_SERVICE_DEPLOYMENT_NAME }}
411+
--remote-resource-identifier "information_schema|${{env.RDS_MYSQL_CLUSTER_ENDPOINT}}|3306"
411412
--query-string ip=${{ env.REMOTE_SERVICE_POD_IP }}&testingId=${{ env.TESTING_ID }}
412413
--rollup'
413414

validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public enum PredefinedExpectedTemplate implements FileConfig {
4141

4242
JAVA_EKS_RDS_MYSQL_LOG("/expected-data-template/java/eks/rds-mysql-log.mustache"),
4343
JAVA_EKS_RDS_MYSQL_METRIC("/expected-data-template/java/eks/rds-mysql-metric.mustache"),
44+
JAVA_EKS_RDS_MYSQL_TRACE("/expected-data-template/java/eks/rds-mysql-trace.mustache"),
4445

4546
/** Java EC2 Default Test Case Validations */
4647
JAVA_EC2_DEFAULT_OUTGOING_HTTP_CALL_LOG("/expected-data-template/java/ec2/default/outgoing-http-call-log.mustache"),
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
[
2+
{
3+
"name": "^{{serviceName}}$",
4+
"http": {
5+
"request": {
6+
"url": "^{{endpoint}}/mysql$",
7+
"method": "^GET$"
8+
},
9+
"response": {
10+
"status": 200
11+
}
12+
},
13+
"aws": {
14+
"account_id": "^{{accountId}}$",
15+
"xray": {
16+
"auto_instrumentation": true,
17+
"sdk": "^opentelemetry for"
18+
}
19+
},
20+
"annotations": {
21+
"aws.local.service": "^{{serviceName}}$",
22+
"aws.local.operation": "^GET /mysql$",
23+
"aws.local.environment": "^eks:{{platformInfo}}/{{appNamespace}}$"
24+
},
25+
"metadata": {
26+
"default": {
27+
"EC2.AutoScalingGroup": "^eks-.+",
28+
"EKS.Cluster": "^{{platformInfo}}$",
29+
"K8s.Namespace": "^{{appNamespace}}",
30+
"otel.resource.K8s.Workload": "^sample-app-deployment-{{testingId}}",
31+
"otel.resource.K8s.Node": "^i-[A-Za-z0-9]{17}$",
32+
"otel.resource.K8s.Pod": "^sample-app-deployment-{{testingId}}(-[A-Za-z0-9]*)*$",
33+
"otel.resource.host.name": "^ip(-[0-9]{1,3}){4}.*$",
34+
"PlatformType": "^AWS::EKS$",
35+
"aws.span.kind": "^LOCAL_ROOT$",
36+
"http.route": "^/mysql$"
37+
}
38+
},
39+
"subsegments": [
40+
{
41+
"name": "^FrontendServiceController.mysql$",
42+
"aws": {
43+
"account_id": "^{{accountId}}$",
44+
"xray": {
45+
"auto_instrumentation": true,
46+
"sdk": "^opentelemetry for"
47+
}
48+
},
49+
"annotations": {
50+
"aws.local.operation": "^GET /mysql$"
51+
},
52+
"subsegments": [
53+
{
54+
"name": "^mysql$",
55+
"sql": {
56+
"url": "^SELECT information_schema.tables$",
57+
"sanitized_query": "SELECT \\* FROM tables LIMIT \\?;",
58+
"database_type": "^mysql$"
59+
},
60+
"annotations": {
61+
"aws.remote.operation": "^SELECT$",
62+
"aws.local.operation": "^GET /mysql$",
63+
"aws.remote.resource.type": "^DB::Connection$",
64+
"aws.remote.resource.identifier": "{{remoteResourceIdentifier}}",
65+
"aws.remote.service": "^mysql$",
66+
"aws.local.service": "^{{serviceName}}$",
67+
"aws.local.environment": "^eks:{{platformInfo}}/{{appNamespace}}$"
68+
},
69+
"metadata": {
70+
"default": {
71+
"EC2.AutoScalingGroup": "^eks-.+",
72+
"EKS.Cluster": "^{{platformInfo}}$",
73+
"K8s.Namespace": "^{{appNamespace}}$",
74+
"PlatformType": "^AWS::EKS$",
75+
"aws.span.kind": "^CLIENT$",
76+
"db.sql.table": "^tables$",
77+
"db.operation": "^SELECT$"
78+
}
79+
},
80+
"namespace": "^remote$"
81+
}
82+
]
83+
}
84+
]
85+
}
86+
]

validator/src/main/resources/validations/java/eks/trace-validation.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,10 @@
2121
httpPath: "/client-call"
2222
httpMethod: "get"
2323
callingType: "http"
24-
expectedTraceTemplate: "JAVA_EKS_CLIENT_CALL_TRACE"
24+
expectedTraceTemplate: "JAVA_EKS_CLIENT_CALL_TRACE"
25+
-
26+
validationType: "trace"
27+
httpPath: "/mysql"
28+
httpMethod: "get"
29+
callingType: "http"
30+
expectedTraceTemplate: "JAVA_EKS_RDS_MYSQL_TRACE"

0 commit comments

Comments
 (0)