Commit b97d13fe authored by Kyriakos Kritikos's avatar Kyriakos Kritikos
Browse files

Update of MetricsCollector based on modifications to CAMEL

parent d723265e
......@@ -9,10 +9,8 @@ package eu.paasage.executionware.metric_collector;
import java.util.ArrayList;
import org.kairosdb.client.builder.Aggregator;
import org.kairosdb.client.builder.TimeUnit;
import eu.paasage.camel.metric.Metric;
import eu.paasage.camel.metric.MetricFunctionArityType;
import eu.paasage.camel.metric.MetricFunctionType;
......
......@@ -7,21 +7,6 @@
package eu.paasage.executionware.metric_collector;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import org.eclipse.emf.cdo.view.CDOView;
import org.kairosdb.client.builder.Aggregator;
import org.kairosdb.client.builder.AggregatorFactory;
import org.kairosdb.client.builder.DataPoint;
import org.kairosdb.client.builder.TimeUnit;
import eu.paasage.camel.metric.Metric;
import eu.paasage.camel.metric.MetricFunctionArityType;
import eu.paasage.camel.metric.MetricFunctionType;
import eu.paasage.executionware.metric_collector.kairosdb.KairosDbClient;
import eu.paasage.mddb.cdo.client.CDOClient;
public abstract class AggregationNode {
......
......@@ -7,23 +7,17 @@
package eu.paasage.executionware.metric_collector;
import java.io.File;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.List;
import java.util.Random;
import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.CDOState;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
import org.eclipse.emf.cdo.session.CDOSessionInvalidationEvent;
import org.eclipse.emf.cdo.view.CDOObjectHandler;
import org.eclipse.emf.cdo.view.CDOView;
import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
import eu.paasage.camel.execution.ApplicationMeasurement;
import eu.paasage.camel.execution.Measurement;
import eu.paasage.camel.metric.MetricInstance;
import eu.paasage.executionware.metric_collector.pubsub.PublicationServer;
......
......@@ -7,7 +7,6 @@
package eu.paasage.executionware.metric_collector;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
......
......@@ -7,13 +7,9 @@
package eu.paasage.executionware.metric_collector;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.List;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
......@@ -21,19 +17,10 @@ import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.view.CDOView;
import org.eclipse.emf.common.util.EList;
import eu.paasage.camel.execution.ExecutionContext;
import eu.paasage.camel.metric.CompositeMetric;
import eu.paasage.camel.metric.CompositeMetricInstance;
import eu.paasage.camel.metric.Metric;
import eu.paasage.camel.metric.MetricApplicationBinding;
import eu.paasage.camel.metric.MetricCondition;
import eu.paasage.camel.metric.MetricInstance;
import eu.paasage.camel.metric.MetricType;
import eu.paasage.camel.scalability.BinaryEventPattern;
import eu.paasage.camel.scalability.Event;
import eu.paasage.camel.scalability.EventPattern;
import eu.paasage.camel.scalability.NonFunctionalEvent;
import eu.paasage.camel.scalability.UnaryEventPattern;
import eu.paasage.executionware.metric_collector.MetricCollector.Mode;
import eu.paasage.executionware.metric_collector.pubsub.PublicationServer;
import eu.paasage.mddb.cdo.client.CDOClient;
......
......@@ -9,94 +9,17 @@ package eu.paasage.executionware.metric_collector;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Date;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.List;
import java.util.Properties;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
import org.eclipse.emf.cdo.view.CDOQuery;
import org.eclipse.emf.cdo.view.CDOView;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;
import com.ibm.icu.text.Normalizer.Mode;
import eu.paasage.camel.Application;
import eu.paasage.camel.CamelFactory;
import eu.paasage.camel.CamelModel;
import eu.paasage.camel.requirement.Requirement;
import eu.paasage.camel.requirement.RequirementGroup;
import eu.paasage.camel.requirement.RequirementModel;
import eu.paasage.camel.requirement.RequirementOperatorType;
import eu.paasage.camel.unit.TimeIntervalUnit;
import eu.paasage.camel.unit.Unit;
import eu.paasage.camel.unit.UnitFactory;
import eu.paasage.camel.unit.UnitType;
import eu.paasage.camel.deployment.DeploymentFactory;
import eu.paasage.camel.deployment.DeploymentModel;
import eu.paasage.camel.deployment.VMInstance;
import eu.paasage.camel.execution.ExecutionContext;
import eu.paasage.camel.execution.ExecutionFactory;
import eu.paasage.camel.execution.ExecutionModel;
import eu.paasage.camel.execution.Measurement;
import eu.paasage.camel.execution.ResourceMeasurement;
import eu.paasage.camel.organisation.Organisation;
import eu.paasage.camel.organisation.OrganisationFactory;
import eu.paasage.camel.organisation.OrganisationModel;
import eu.paasage.camel.organisation.PaaSageCredentials;
import eu.paasage.camel.organisation.User;
import eu.paasage.camel.metric.ComparisonOperatorType;
import eu.paasage.camel.metric.CompositeMetric;
import eu.paasage.camel.metric.CompositeMetricContext;
import eu.paasage.camel.metric.CompositeMetricInstance;
import eu.paasage.camel.metric.Condition;
import eu.paasage.camel.metric.ConditionContext;
import eu.paasage.camel.metric.Metric;
import eu.paasage.camel.metric.MetricApplicationBinding;
import eu.paasage.camel.metric.MetricCondition;
import eu.paasage.camel.metric.MetricFactory;
import eu.paasage.camel.metric.MetricFormula;
import eu.paasage.camel.metric.MetricFormulaParameter;
import eu.paasage.camel.metric.MetricFunctionArityType;
import eu.paasage.camel.metric.MetricFunctionType;
import eu.paasage.camel.metric.MetricInstance;
import eu.paasage.camel.metric.MetricModel;
import eu.paasage.camel.metric.Property;
import eu.paasage.camel.metric.PropertyType;
import eu.paasage.camel.metric.RawMetric;
import eu.paasage.camel.metric.RawMetricInstance;
import eu.paasage.camel.metric.Schedule;
import eu.paasage.camel.metric.ScheduleType;
import eu.paasage.camel.scalability.ScalabilityFactory;
import eu.paasage.camel.scalability.ScalabilityModel;
import eu.paasage.camel.metric.Sensor;
import eu.paasage.camel.metric.Window;
import eu.paasage.camel.metric.WindowSizeType;
import eu.paasage.camel.metric.WindowType;
import eu.paasage.camel.requirement.ServiceLevelObjective;
import eu.paasage.camel.requirement.RequirementFactory;
import eu.paasage.camel.type.DoublePrecisionValue;
import eu.paasage.camel.type.Limit;
import eu.paasage.camel.type.Range;
import eu.paasage.camel.type.TypeEnum;
import eu.paasage.camel.type.TypeFactory;
import eu.paasage.camel.type.TypeModel;
import eu.paasage.executionware.metric_collector.pubsub.PublicationServer;
import eu.paasage.executionware.metric_collector.pubsub.SubscriptionClient;
import eu.paasage.mddb.cdo.client.CDOClient;
public class MetricCollector implements MetricCollection{
......
......@@ -154,7 +154,7 @@ public class MetricHandler implements Runnable{
}
else if (binding instanceof MetricVMBinding){
object = ((MetricVMBinding) binding).getVmInstance().cdoID();
measurementType = MeasurementType.RESOURCE_MEASUREMENT;
measurementType = MeasurementType.VM_MEASUREMENT;
}
getComputationPeriod(mi);
......
......@@ -17,13 +17,13 @@ import eu.paasage.camel.Application;
import eu.paasage.camel.deployment.InternalComponentInstance;
import eu.paasage.camel.deployment.VMInstance;
import eu.paasage.camel.execution.ApplicationMeasurement;
import eu.paasage.camel.execution.CommunicationMeasurement;
import eu.paasage.camel.execution.ExecutionContext;
import eu.paasage.camel.execution.ExecutionFactory;
import eu.paasage.camel.execution.ExecutionModel;
import eu.paasage.camel.execution.InternalComponentMeasurement;
import eu.paasage.camel.execution.Measurement;
import eu.paasage.camel.execution.ResourceCouplingMeasurement;
import eu.paasage.camel.execution.ResourceMeasurement;
import eu.paasage.camel.execution.VMMeasurement;
import eu.paasage.camel.metric.MetricInstance;
import eu.paasage.mddb.cdo.client.CDOClient;
......@@ -40,9 +40,9 @@ public class MetricStorage {
private static final int maxItems = 100;
public enum MeasurementType {
RESOURCE_MEASUREMENT,
VM_MEASUREMENT,
APPLICATION_MEASUREMENT,
RESOURCE_COUPLING_MEASUREMENT,
COMMUNICATION_MEASUREMENT,
COMPONENT_MEASUREMENT
}
......@@ -78,8 +78,8 @@ public class MetricStorage {
am.setApplication((Application)trans.getObject(object));
m = am;
break;
case RESOURCE_MEASUREMENT:
ResourceMeasurement rm = ExecutionFactory.eINSTANCE.createResourceMeasurement();
case VM_MEASUREMENT:
VMMeasurement rm = ExecutionFactory.eINSTANCE.createVMMeasurement();
rm.setVmInstance((VMInstance)trans.getObject(object));
m = rm;
break;
......@@ -88,8 +88,8 @@ public class MetricStorage {
cm.setInternalComponentInstance((InternalComponentInstance)trans.getObject(object));
m = cm;
break;
case RESOURCE_COUPLING_MEASUREMENT:
ResourceCouplingMeasurement rcm = ExecutionFactory.eINSTANCE.createResourceCouplingMeasurement();
case COMMUNICATION_MEASUREMENT:
CommunicationMeasurement rcm = ExecutionFactory.eINSTANCE.createCommunicationMeasurement();
rcm.setSourceVMInstance((VMInstance)trans.getObject(object));
rcm.setDestinationVMInstance((VMInstance)trans.getObject(object2));
m = rcm;
......@@ -98,7 +98,7 @@ public class MetricStorage {
m.setMetricInstance(mi);
m.setExecutionContext(ec);
m.setValue(value);
m.setReportedOn(new Date());
m.setMeasurementTime(new Date());
m.setName(CDOIDUtil.createUUID().toString());
//Add measurement
......
......@@ -8,7 +8,6 @@
package eu.paasage.executionware.metric_collector;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.concurrent.ArrayBlockingQueue;
......@@ -21,13 +20,13 @@ import eu.paasage.camel.Application;
import eu.paasage.camel.deployment.InternalComponentInstance;
import eu.paasage.camel.deployment.VMInstance;
import eu.paasage.camel.execution.ApplicationMeasurement;
import eu.paasage.camel.execution.CommunicationMeasurement;
import eu.paasage.camel.execution.ExecutionContext;
import eu.paasage.camel.execution.ExecutionFactory;
import eu.paasage.camel.execution.ExecutionModel;
import eu.paasage.camel.execution.InternalComponentMeasurement;
import eu.paasage.camel.execution.Measurement;
import eu.paasage.camel.execution.ResourceCouplingMeasurement;
import eu.paasage.camel.execution.ResourceMeasurement;
import eu.paasage.camel.execution.VMMeasurement;
import eu.paasage.camel.metric.MetricInstance;
import eu.paasage.executionware.metric_collector.MetricStorage.MeasurementType;
import eu.paasage.mddb.cdo.client.CDOClient;
......@@ -37,8 +36,6 @@ public class MetricStorageWithBlockingQueue {
private static CDOTransaction trans = null;
private static CDOClient cl = null;
private static int transNum = 0;
private static int deadline = 600;
private static TimeThread tr = null;
private static ArrayBlockingQueue<StorageRequest> queue = new ArrayBlockingQueue<StorageRequest>(10000);
private static final Integer maxTrans = 5;
......@@ -135,8 +132,8 @@ public class MetricStorageWithBlockingQueue {
am.setApplication((Application)trans.getObject(sr.object));
m = am;
break;
case RESOURCE_MEASUREMENT:
ResourceMeasurement rm = ExecutionFactory.eINSTANCE.createResourceMeasurement();
case VM_MEASUREMENT:
VMMeasurement rm = ExecutionFactory.eINSTANCE.createVMMeasurement();
rm.setVmInstance((VMInstance)trans.getObject(sr.object));
m = rm;
break;
......@@ -145,8 +142,8 @@ public class MetricStorageWithBlockingQueue {
cm.setInternalComponentInstance((InternalComponentInstance)trans.getObject(sr.object));
m = cm;
break;
case RESOURCE_COUPLING_MEASUREMENT:
ResourceCouplingMeasurement rcm = ExecutionFactory.eINSTANCE.createResourceCouplingMeasurement();
case COMMUNICATION_MEASUREMENT:
CommunicationMeasurement rcm = ExecutionFactory.eINSTANCE.createCommunicationMeasurement();
rcm.setSourceVMInstance((VMInstance)trans.getObject(sr.object));
rcm.setDestinationVMInstance((VMInstance)trans.getObject(sr.object2));
m = rcm;
......@@ -155,7 +152,7 @@ public class MetricStorageWithBlockingQueue {
m.setMetricInstance(mi);
m.setExecutionContext(ec);
m.setValue(sr.value);
m.setReportedOn(new Date());
m.setMeasurementTime(new Date());
m.setName(CDOIDUtil.createUUID().toString());
//Add measurement
......
......@@ -9,7 +9,6 @@ package eu.paasage.executionware.metric_collector;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
......
......@@ -14,9 +14,6 @@ import java.util.List;
import org.eclipse.emf.cdo.view.CDOView;
import org.eclipse.emf.common.util.EList;
import org.kairosdb.client.builder.Aggregator;
import org.kairosdb.client.builder.AggregatorFactory;
import org.kairosdb.client.builder.DataPoint;
import org.kairosdb.client.builder.TimeUnit;
import eu.paasage.camel.metric.CompositeMetric;
......@@ -35,7 +32,6 @@ import eu.paasage.executionware.metric_collector.AggregationNode;
import eu.paasage.executionware.metric_collector.MetricCollector;
import eu.paasage.executionware.metric_collector.MetricCollector.Mode;
import eu.paasage.executionware.metric_collector.StatisticsUtils;
import eu.paasage.executionware.metric_collector.kairosdb.KairosDbClient;
import eu.paasage.mddb.cdo.client.CDOClient;
public class InfluxAggregationNode extends AggregationNode{
......
......@@ -10,23 +10,17 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.influxdb.InfluxDB;
import org.influxdb.InfluxDB.LogLevel;
import org.influxdb.dto.ContinuousQuery;
import org.influxdb.dto.Database;
import org.influxdb.dto.Pong;
import org.influxdb.dto.Serie;
import org.influxdb.impl.InfluxDBImpl;
import com.github.dockerjava.api.DockerClient;
import com.github.dockerjava.api.command.CreateContainerResponse;
public class InfluxDBClient {
......
......@@ -333,7 +333,7 @@ public class KairosDbClient{
public static void main(String [] args) throws URISyntaxException, IOException{
Tag t1 = new Tag("user", "panos");
//Tag t1 = new Tag("user", "panos");
KairosDbClient dbclient = new KairosDbClient("http://localhost:8080");
try{
//dbclient.putMetric("workshopTest",t1, System.currentTimeMillis(), 100);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment