Skip to content

Commit

Permalink
Merge with main
Browse files Browse the repository at this point in the history
  • Loading branch information
Malte-Hansen committed Dec 3, 2024
2 parents 3d06819 + 41bee9a commit c4a30b8
Show file tree
Hide file tree
Showing 26 changed files with 639 additions and 127 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/deploy-init-cassandra.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Init-Cassandra Pipeline

on:
push:
branches: ["main"]

jobs:
deploy-init-cassandra:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Container Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push multi-arch Docker image
run: |
docker buildx build \
--file init-cassandra.Dockerfile \
--platform linux/amd64,linux/arm64 \
--tag explorviz/init-cassandra . \
--push
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
Scalable service that processes, persists, aggregates and queries the observed traces of method executions within
monitored software applications.

## Features

This replaces the [trace-service](https://git.se.informatik.uni-kiel.de/ExplorViz/code/trace-service) and
[landscape-service](https://git.se.informatik.uni-kiel.de/ExplorViz/code/landscape-service) previously used to process
spans.

## Prerequisites

- Java 17 or higher
Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ dependencies {
implementation 'io.quarkus:quarkus-smallrye-openapi'

testImplementation 'io.quarkus:quarkus-junit5'
testImplementation 'io.quarkus:quarkus-junit5-mockito'

// Integration / Api Tests
testImplementation 'io.rest-assured:rest-assured'
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#Gradle properties
#Thu Apr 20 09:07:19 CEST 2023
#quarkusPluginVersion=3.2.9.Final
quarkusPluginVersion=3.6.4
quarkusPluginVersion=3.8.3
quarkusPlatformArtifactId=quarkus-bom
quarkusPluginId=io.quarkus
quarkusPlatformGroupId=io.quarkus.platform
#quarkusPlatformVersion=3.2.9.Final
quarkusPlatformVersion=3.6.4
quarkusPlatformVersion=3.8.3
confluentAvroSerdeVersion=7.3.3
6 changes: 6 additions & 0 deletions init-cassandra.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM cassandra:3.11.14

COPY src/main/resources/init_script.cql ./init.cql

CMD ["cqlsh", "cassandra-explorviz", "-f", "init.cql"]

Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@
import java.util.List;
import java.util.UUID;
import net.explorviz.span.kafka.KafkaTestResource;
import net.explorviz.span.landscape.Application;
import net.explorviz.span.landscape.Landscape;
import net.explorviz.span.landscape.Method;
import net.explorviz.span.landscape.Node;
import net.explorviz.span.persistence.PersistenceSpan;
import net.explorviz.span.persistence.PersistenceSpanProcessor;
import net.explorviz.span.trace.Trace;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

Expand All @@ -25,6 +28,8 @@ public class LandscapeResourceIt {
@Inject
PersistenceSpanProcessor spanProcessor;

final String gitCommitChecksum = "testGitCommitChecksum";

@Test
void testLoadAllStructureSpans() {
final long startEarly = 1701081827000L;
Expand All @@ -37,25 +42,25 @@ void testLoadAllStructureSpans() {
final UUID uuidExpected = UUID.randomUUID();

final PersistenceSpan differentTokenSpan = new PersistenceSpan(
UUID.randomUUID(), "123L", "", "1L", startEarly,
endEarly, "nodeIp", "app-name", "java", 0, "net.explorviz.Class.myMethod()", "847",
UUID.randomUUID(), gitCommitChecksum, "123L", "", "1L", startEarly,
endEarly, "nodeIp", "host-name", "app-name", "java", 0, "net.explorviz.Class.myMethod()", "847",
"iamapod", "iamanode", "iamanamespace", "iamadeployment");

final String duplicateMethodName = "myMethodName()";
final String otherMethodName = "myOtherMethodName()";

final PersistenceSpan firstOccurenceSpan = new PersistenceSpan(uuidExpected,
"123L", "", "1L", startEarly, endEarly, "nodeIp", "app-name", "java", 0,
final PersistenceSpan firstOccurenceSpan = new PersistenceSpan(uuidExpected, gitCommitChecksum,
"123L", "", "1L", startEarly, endEarly, "nodeIp", "host-name", "app-name", "java", 0,
"net.explorviz.Class." + duplicateMethodName, "847",
"iamapod", "iamanode", "iamanamespace", "iamadeployment");

final PersistenceSpan secondOccurenceSpan = new PersistenceSpan(uuidExpected,
"789L", "", "3L", startLate, endLate, "nodeIp", "app-name", "java", 0,
final PersistenceSpan secondOccurenceSpan = new PersistenceSpan(uuidExpected, gitCommitChecksum,
"789L", "", "3L", startLate, endLate, "nodeIp", "host-name", "app-name", "java", 0,
"net.explorviz.Class." + duplicateMethodName, "847",
"iamapod", "iamanode", "iamanamespace", "iamadeployment");

final PersistenceSpan otherSpan = new PersistenceSpan(uuidExpected, "456L",
"0L", "", startExpected, endExpected, "nodeIp", "app-name", "java", 0,
final PersistenceSpan otherSpan = new PersistenceSpan(uuidExpected, "456L", gitCommitChecksum,
"0L", "", startExpected, endExpected, "nodeIp", "host-name", "app-name", "java", 0,
"net.explorviz.Class." + otherMethodName, "321",
"iamnotapod", "iamnotanode", "iamnotanamespace", "iamnotadeployment");

Expand All @@ -69,7 +74,20 @@ void testLoadAllStructureSpans() {

final Landscape result = response.getBody().as(Landscape.class);

final List<Method> resultMethodList = result.nodes().get(0).applications().get(0).packages()
final List<Node> node = result.nodes();

Assertions.assertEquals(1, node.size());
Assertions.assertEquals("host-name", node.get(0).hostName());
Assertions.assertEquals("nodeIp", node.get(0).ipAddress());

final List<Application> applications = result.nodes().get(0).applications();

Assertions.assertEquals(1, applications.size());
Assertions.assertEquals("app-name", applications.get(0).name());
Assertions.assertEquals("java", applications.get(0).language());
Assertions.assertEquals(0, applications.get(0).instanceId());

final List<Method> resultMethodList = applications.get(0).packages()
.get(0).subPackages().get(0).classes().get(0).methods();

Assertions.assertEquals(2, resultMethodList.size());
Expand All @@ -89,25 +107,25 @@ void testLoadStructureSpansByTimeRange() {
final UUID uuidExpected = UUID.randomUUID();

final PersistenceSpan differentTokenSpan = new PersistenceSpan(
UUID.randomUUID(), "123L", "", "1L", startEarly,
endEarly, "nodeIp", "app-name", "java", 0, "net.explorviz.Class.myMethod()", "847",
"iamapod", "iamanode", "iamanamespace", "iamadeployment" );
UUID.randomUUID(), gitCommitChecksum, "123L", "", "1L", startEarly,
endEarly, "nodeIp", "host-name", "app-name", "java", 0, "net.explorviz.Class.myMethod()", "847",
"iamapod", "iamanode", "iamanamespace", "iamadeployment");

final String duplicateMethodName = "myMethodName()";
final String otherMethodName = "myOtherMethodName()";

final PersistenceSpan firstOccurenceSpan = new PersistenceSpan(uuidExpected,
"123L", "", "1L", startEarly, endEarly, "nodeIp", "app-name", "java", 0,
final PersistenceSpan firstOccurenceSpan = new PersistenceSpan(uuidExpected, gitCommitChecksum,
"123L", "", "1L", startEarly, endEarly, "nodeIp", "host-name", "app-name", "java", 0,
"net.explorviz.Class." + duplicateMethodName, "847",
"iamapod", "iamanode", "iamanamespace", "iamadeployment");

final PersistenceSpan secondOccurenceSpan = new PersistenceSpan(uuidExpected,
"789L", "", "3L", startLate, endLate, "nodeIp", "app-name", "java", 0,
final PersistenceSpan secondOccurenceSpan = new PersistenceSpan(uuidExpected, gitCommitChecksum,
"789L", "", "3L", startLate, endLate, "nodeIp", "host-name", "app-name", "java", 0,
"net.explorviz.Class." + duplicateMethodName, "847",
"iamapod", "iamanode", "iamanamespace", "iamadeployment");

final PersistenceSpan otherSpan = new PersistenceSpan(uuidExpected, "456L",
"", "2L", startExpected, endExpected, "nodeIp", "app-name", "java", 0,
final PersistenceSpan otherSpan = new PersistenceSpan(uuidExpected, gitCommitChecksum, "456L",
"", "2L", startExpected, endExpected, "nodeIp", "host-name", "app-name", "java", 0,
"net.explorviz.Class." + otherMethodName, "321",
"iamnotapod", "iamnotanode", "iamnotanamespace", "iamnotadeployment");

Expand All @@ -132,4 +150,55 @@ void testLoadStructureSpansByTimeRange() {
Assertions.assertEquals(otherMethodName, resultMethodList.get(0).name());
}

@Test
void testLoadTracesByTimeRange() {
final long startEarly = 1701081837000L;
final long endEarly = 1701081838000L;
final long startExpected = 1701081840000L;
final long endExpected = 1701081841000L;
final long startLate = 1701081843000L;
final long endLate = 1701081844000L;

final UUID uuidExpected = UUID.randomUUID();

final PersistenceSpan differentTokenSpan = new PersistenceSpan(
UUID.randomUUID(), gitCommitChecksum, "123L", "", "1L", startEarly,
endEarly, "nodeIp", "host-name", "app-name", "java", 0, "net.explorviz.Class.myMethod()",
"847");

final String duplicateMethodName = "myMethodName()";
final String otherMethodName = "myOtherMethodName()";

final PersistenceSpan firstOccurenceSpan = new PersistenceSpan(uuidExpected, gitCommitChecksum,
"123L", "", "1L", startEarly, endEarly, "nodeIp", "host-name", "app-name", "java", 0,
"net.explorviz.Class." + duplicateMethodName, "847");

final PersistenceSpan secondOccurenceSpan = new PersistenceSpan(uuidExpected, gitCommitChecksum,
"789L", "", "3L", startLate, endLate, "nodeIp", "host-name", "app-name", "java", 0,
"net.explorviz.Class." + duplicateMethodName, "847");

final PersistenceSpan otherSpan = new PersistenceSpan(uuidExpected, gitCommitChecksum, "456L",
"", "2L", startExpected, endExpected, "nodeIp", "host-name", "app-name", "java", 0,
"net.explorviz.Class." + otherMethodName, "321");

spanProcessor.accept(differentTokenSpan);
spanProcessor.accept(firstOccurenceSpan);
spanProcessor.accept(secondOccurenceSpan);
spanProcessor.accept(otherSpan);

final long from = startExpected;
final long to = endExpected;

final Response response = given().pathParam("token", uuidExpected)
.queryParam("from", from).queryParam("to", to).when()
.get("/v2/landscapes/{token}/dynamic");

final Trace[] result = response.getBody().as(Trace[].class);

// ATTENTION: For the moment, we only filter based on the starting point of
// traces
Assertions.assertEquals(2, result.length);
Assertions.assertEquals(gitCommitChecksum, result[0].gitCommitChecksum());
}

}
Loading

0 comments on commit c4a30b8

Please sign in to comment.