Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bachelorthesis #1

Open
wants to merge 3 commits into
base: bachelorthesis
Choose a base branch
from
Open
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
17 changes: 14 additions & 3 deletions diagnoseIT/diagnoseit.root.gradle → diagnoseIT/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
subprojects {
allprojects {
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'eclipse'

version = '0.1'

}

subprojects {
sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
testCompile 'junit:junit:4.8.2'
testCompile 'net.sourceforge.cobertura:cobertura:2.1.1'
}

version = '0.1.0-SNAPSHOT'
group = 'diagnoseit'

}


Expand Down
7 changes: 5 additions & 2 deletions diagnoseIT/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@ subprojects {
'org.objenesis:objenesis:2.1',

'com.google.guava:guava-jdk5:13.0',
'org.springframework:spring-core:4.3.0.RELEASE',
'org.springframework:spring-context:4.3.0.RELEASE'

'org.reflections:reflections:0.9.11',

'org.spec.research:open.xtrace.default.impl:0.2.0',
'org.spec.research:open.xtrace.api:0.2.0'

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import org.apache.commons.lang3.StringUtils;
import org.diagnoseit.engine.rule.annotation.Condition;
import org.diagnoseit.engine.rule.exception.RuleExecutionException;
import org.springframework.util.ReflectionUtils;

/**
* Defines a condition method of a rule implementation. A <code>ConditionMethod</code> reflects the
Expand Down Expand Up @@ -76,7 +75,7 @@ public ConditionMethod(String name, String hint, Method method) {
*/
public ConditionFailure execute(ExecutionContext context) {
try {
boolean valid = (boolean) ReflectionUtils.invokeMethod(getMethod(), context.getInstance());
boolean valid = (boolean) getMethod().invoke(context.getInstance());
if (!valid) {
// Store information about the failed condition for later usage
return new ConditionFailure(getName(), getHint());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
import java.util.ArrayList;
import java.util.List;

import org.springframework.core.annotation.AnnotationUtils;

/**
* Class contains utility methods to work with reflection API.
*
Expand Down Expand Up @@ -93,10 +91,13 @@ public static boolean hasNoArgsConstructor(Class<?> clazz) {
* The annotation to be looked up.
* @param <T>
* The type of annotation
* @return true if annotation is present, false otherwise.
* @return the Annotation if found, else <code>null</code>
*/
public static <T extends Annotation> T findAnnotation(Class<?> clazz, Class<T> annotationClass) {
return AnnotationUtils.findAnnotation(clazz, annotationClass);
T[] annotationsByType = clazz.getAnnotationsByType(annotationClass);
if(annotationsByType.length > 0)
return annotationsByType[0];
return null;
}

/**
Expand Down
4 changes: 4 additions & 0 deletions diagnoseIT/diagnoseit.rules/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dependencies {
compile project(':diagnoseit.ruleengine')
compile 'org.influxdb:influxdb-java:2.0'
}
7 changes: 0 additions & 7 deletions diagnoseIT/diagnoseit.rules/diagnoseit.rules.gradle

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -567,9 +567,9 @@ public void writeData(double responseTime, double cpuTime, double gcTime,
Point point1 = Point.measurement(TABLE_TIMING_INFORMATION)
.tag(INFLUXDB_TAG_TRACE, String.valueOf(traceId))
.time(traceTimestamp, TimeUnit.MILLISECONDS)
.addField(COLUMN_RESPONSE_TIME, responseTime)
.addField(COLUMN_CPU_TIME, cpuTime)
.addField(COLUMN_GC_TIME, gcTime).build();
.field(COLUMN_RESPONSE_TIME, responseTime)
.field(COLUMN_CPU_TIME, cpuTime)
.field(COLUMN_GC_TIME, gcTime).build();

influxDB.write(DATABASE_NAME, RETENTION_POLICY, point1);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
dependencies {
compile project(':diagnoseit.ruleengine'), project(':diagnoseit.rules')
compile project(':diagnoseit.ruleengine')
compile project(':diagnoseit.rules')
compile files('libs/shared.jar')
compile files('libs/adapters.appdynamics.jar')
compile files('libs/adapters.dynatrace.jar')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,10 @@
import org.diagnoseit.rules.RuleConstants;
import org.diagnoseit.rules.result.ProblemInstanceResultCollector;
import org.diagnoseit.rules.result.ProblemOccurrence;
import org.reflections.Reflections;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.spec.research.open.xtrace.api.core.Trace;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider;
import org.springframework.core.type.filter.AnnotationTypeFilter;



public class DiagnoseIT implements Runnable{
Expand Down Expand Up @@ -92,16 +89,12 @@ public void run() {
}

public void init(ISessionCallback<List<ProblemOccurrence>> resultHandler) throws ClassNotFoundException {

ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(false);

scanner.addIncludeFilter(new AnnotationTypeFilter(Rule.class));

Set<Class<?>> ruleClasses = new HashSet<>();
for (String packageName : rulesPackages) {
for (BeanDefinition bd : scanner.findCandidateComponents(packageName)) {
Class<?> clazz = Class.forName(bd.getBeanClassName());
ruleClasses.add(clazz);
}
Reflections reflections = new Reflections(packageName);
Set<Class<?>> subTypesOf = reflections.getTypesAnnotatedWith(Rule.class);
ruleClasses.addAll(subTypesOf);
}

DiagnosisEngineConfiguration<Trace, List<ProblemOccurrence>> configuration = new DiagnosisEngineConfiguration<Trace, List<ProblemOccurrence>>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@
import org.diagnoseit.rules.result.ProblemInstanceResultCollector;
import org.diagnoseit.rules.result.ProblemOccurrence;
import org.diagnoseit.rules.timeseries.impl.InfluxDBConnector;
import org.reflections.Reflections;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider;
import org.springframework.core.type.filter.AnnotationTypeFilter;

public class DiagnoseITTimeseries implements Runnable {
private static final long TIMEOUT = 50;
Expand Down Expand Up @@ -88,18 +86,12 @@ public void run() {

public void init(ISessionCallback<List<ProblemOccurrence>> resultHandler)
throws ClassNotFoundException {

ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(
false);

scanner.addIncludeFilter(new AnnotationTypeFilter(Rule.class));

Set<Class<?>> ruleClasses = new HashSet<>();
for (String packageName : rulesPackages) {
for (BeanDefinition bd : scanner
.findCandidateComponents(packageName)) {
Class<?> clazz = Class.forName(bd.getBeanClassName());
ruleClasses.add(clazz);
}
Reflections reflections = new Reflections(packageName);
Set<Class<?>> subTypesOf = reflections.getTypesAnnotatedWith(Rule.class);
ruleClasses.addAll(subTypesOf);
}

DiagnosisEngineConfiguration<InfluxDBConnector, List<ProblemOccurrence>> configuration = new DiagnosisEngineConfiguration<InfluxDBConnector, List<ProblemOccurrence>>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
import org.diagnoseit.rules.result.ProblemOccurrence;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.spec.research.open.xtrace.adapters.introscope.source.IntroscopeTraceConverter;
import org.spec.research.open.xtrace.api.core.Trace;
import org.spec.research.open.xtrace.shared.TraceConverter;

/**
* Launcher for rules that analyze a single trace.
Expand All @@ -27,7 +25,7 @@ public class Launcher {
/**
* Path to traces that should be analyzed.
*/
private static final String INTROSCOPE_FILE = "C:/Users/Alper Hi/Desktop/Universit�t/Bachelorarbeit/Traces_CA/CA_Trace_Problematic.xml";
private static final String INTROSCOPE_FILE = "C:/Users/Alper Hi/Desktop/Universit�t/Bachelorarbeit/Traces_CA/CA_Trace_Problematic.xml";

private static final String DYNATRACE_FILE = "path to dynatrace trace file";

Expand All @@ -36,9 +34,7 @@ public class Launcher {
private static final String KIEKER_FILE = "path to kieker file";

public static void main(String[] args) throws ClassNotFoundException {
TraceConverter converter = new IntroscopeTraceConverter();
Trace trace = converter.convertTraces(INTROSCOPE_FILE).get(0);
startLauncher(trace);
startLauncher(new TraceCreatorForTesting().createTrace());
}

/**
Expand Down
13 changes: 0 additions & 13 deletions diagnoseIT/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,2 @@
rootProject.name = "diagnoseit.root"
include "diagnoseit.ruleengine","diagnoseit.rules","diagnoseit.standalone"

/**
* Sets the name of the project build file (and all of its sub-projects) to be "${project.name}.gradle" pattern.
* This is done as the Gradle expects build file to be named build.gradle.
*/
def renameBuildFiles(project){
project.buildFileName = "${project.name}.gradle"
project.children.each{ childProject ->
renameBuildFiles(childProject)
}
}
renameBuildFiles(rootProject)