Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sample-apps/springboot/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ dependencies {
implementation("io.opentelemetry:opentelemetry-api:1.34.1")
implementation("software.amazon.awssdk:s3")
implementation("software.amazon.awssdk:sts")
implementation("com.mysql:mysql-connector-j:8.0.33")
implementation("com.mysql:mysql-connector-j:8.4.0")
}

jib {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@ public void validate() throws Exception {
String operation = (String) expectedAttributes.get("Operation");
String remoteService = (String) expectedAttributes.get("RemoteService");
String remoteOperation = (String) expectedAttributes.get("RemoteOperation");
String remoteResourceType = (String) expectedAttributes.get("RemoteResourceType");
String remoteResourceIdentifier = (String) expectedAttributes.get("RemoteResourceIdentifier");

Map<String, Object> actualLog =
this.getActualLog(operation, remoteService, remoteOperation);
this.getActualLog(operation, remoteService, remoteOperation, remoteResourceType, remoteResourceIdentifier);
log.info("Value of an actual log: {}", actualLog);

if (actualLog == null) throw new BaseException(ExceptionCode.EXPECTED_LOG_NOT_FOUND);
Expand Down Expand Up @@ -126,7 +128,7 @@ private JsonifyArrayList<Map<String, Object>> getExpectedAttributes() throws Exc
}

private Map<String, Object> getActualLog(
String operation, String remoteService, String remoteOperation) throws Exception {
String operation, String remoteService, String remoteOperation, String remoteResourceType, String remoteResourceIdentifier) throws Exception {
String dependencyFilter = null;

// Dependency calls will have the remoteService and remoteOperation attribute, but service calls
Expand All @@ -139,6 +141,10 @@ private Map<String, Object> getActualLog(
dependencyFilter = String.format("&& ($.RemoteService = \"%s\") && ($.RemoteOperation = \"%s\")", remoteService, remoteOperation);
}

if (remoteResourceType != null && remoteResourceIdentifier != null) {
dependencyFilter += String.format(" && ($.RemoteResourceType = %%%s%%) && ($.RemoteResourceIdentifier = %%%s%%)", remoteResourceType, remoteResourceIdentifier);
}

String filterPattern = String.format("{ ($.Service = %s) && ($.Operation = \"%s\") %s }", context.getServiceName(), operation, dependencyFilter);
log.info("Filter Pattern for Log Search: " + filterPattern);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"default": {
"EC2.AutoScalingGroup": "^eks-.+",
"EKS.Cluster": "^{{platformInfo}}$",
"K8s.Namespace": "^{{appNamespace}}",
"otel.resource.K8s.Workload": "^sample-app-deployment-{{testingId}}",
"K8s.Namespace": "^{{appNamespace}}$",
"otel.resource.K8s.Workload": "^sample-app-deployment-{{testingId}}$",
"otel.resource.K8s.Node": "^i-[A-Za-z0-9]{17}$",
"otel.resource.K8s.Pod": "^sample-app-deployment-{{testingId}}(-[A-Za-z0-9]*)*$",
"otel.resource.host.name": "^ip(-[0-9]{1,3}){4}.*$",
Expand All @@ -50,6 +50,12 @@
"aws.local.operation": "^GET /mysql$"
},
"subsegments": [
{
"name": "^mysql$",
"sql": {
"url": "^Create connection$"
}
},
{
"name": "^mysql$",
"sql": {
Expand All @@ -61,7 +67,7 @@
"aws.remote.operation": "^SELECT$",
"aws.local.operation": "^GET /mysql$",
"aws.remote.resource.type": "^DB::Connection$",
"aws.remote.resource.identifier": "{{remoteResourceIdentifier}}",
"aws.remote.resource.identifier": "^{{remoteResourceIdentifier}}$",
"aws.remote.service": "^mysql$",
"aws.local.service": "^{{serviceName}}$",
"aws.local.environment": "^eks:{{platformInfo}}/{{appNamespace}}$"
Expand All @@ -83,4 +89,4 @@
}
]
}
]
]