Skip to content

Commit

Permalink
Merge pull request #7 from LeeKyoungIl/feature/with_spring_cloud_config
Browse files Browse the repository at this point in the history
Feature/with spring cloud config
  • Loading branch information
LeeKyoungIl authored Sep 22, 2017
2 parents a104ef9 + c6d3032 commit b11c046
Show file tree
Hide file tree
Showing 46 changed files with 1,352 additions and 595 deletions.
9 changes: 8 additions & 1 deletion ApiServerSample/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,14 @@
<dependency>
<groupId>com.leekyoungil.illuminati</groupId>
<artifactId>illuminati-client-processor</artifactId>
<version>0.8.6</version>
<version>0.8.7</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>com.leekyoungil.illuminati</groupId>
<artifactId>illuminati-client-switch</artifactId>
<version>0.1.0</version>
<scope>compile</scope>
</dependency>

Expand Down
2 changes: 0 additions & 2 deletions ApiServerSample/src/main/resources/application.properties

This file was deleted.

2 changes: 2 additions & 0 deletions ApiServerSample/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
logging.level.root: INFO
server.port: 8081
6 changes: 4 additions & 2 deletions ApiServerSample/src/main/resources/illuminati-local.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#rabbitmq
broker: rabbitmq
clusterList: 192.168.99.100:32777
clusterList: localhost:32769
virtualHost: illuminatiLocal
topic: local-illuminati-exchange
queueName: local-illuminati-exchange.illuminati
Expand All @@ -10,7 +10,9 @@ isAsync: true
isCompression: true
parentModuleName: apisample
samplingRate: 100
debug: false
debug: true
illuminatiSwitchValueURL: https://raw.githubusercontent.com/LeeKyoungIl/illuminati/feature/with_spring_cloud_config/illuminati-config-properties/illuminati-switch-local.yml
illuminatiSwitchValueURLCheckInterval: 5000

#kafka
#broker: kafka
Expand Down
5 changes: 4 additions & 1 deletion ApiServerSample/src/main/resources/illuminati.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# it is very dangerous function. it is activate when debug is true.
# after using this function. you must have to re compile.(clean first)
chaosBomber: true
chaosBomber: true
#
#illuminati:
# switchValue: false
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public class ApiServerSampleApplicationTests {
// long start1 = System.nanoTime();
//
// for (int i=0; i<1; i++) {
// byte[] tmp = StringUtils.encode(testJson.toCharArray());
// byte[] tmp = StringObjectUtils.encode(testJson.toCharArray());
// }
//
// long end1 = System.nanoTime();
Expand Down
148 changes: 148 additions & 0 deletions illuminati-client/illuminati-client-common/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.leekyoungil.illuminati</groupId>
<artifactId>illuminati-client-common</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.6</java.version>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.4</version>
</dependency>

<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.8.10</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.8.10</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.1</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
<version>2.9.0</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.9.0</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.0</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.5</version>
<scope>compile</scope>
</dependency>
</dependencies>

<build>

<plugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>

<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>

</plugins>

</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.leekyoungil.illuminati.common;

import com.leekyoungil.illuminati.common.constant.IlluminatiConstant;
import com.leekyoungil.illuminati.common.properties.IlluminatiCommonProperties;
import com.leekyoungil.illuminati.common.properties.IlluminatiPropertiesHelper;
import com.leekyoungil.illuminati.common.util.StringObjectUtils;
import com.leekyoungil.illuminati.common.util.SystemUtil;

public class IlluminatiCommon {

public synchronized static void init () {
String debug = IlluminatiPropertiesHelper.getPropertiesValueByKey(IlluminatiCommonProperties.class, null, "illuminati", "debug");
if (StringObjectUtils.isValid(debug)) {
IlluminatiConstant.ILLUMINATI_DEBUG = Boolean.valueOf(debug);
}

if (IlluminatiConstant.ILLUMINATI_DEBUG == true) {
SystemUtil.createThreadStatusDebugThread();
}

if (IlluminatiPropertiesHelper.isIlluminatiSwitcherActive() == true) {
IlluminatiConstant.ILLUMINATI_SWITCH_ACTIVATION = true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.leekyoungil.illuminati.common.constant;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

import java.lang.reflect.Modifier;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;

abstract public class IlluminatiConstant {

public static Map<String, Thread> SYSTEM_THREAD_MAP = new HashMap<String, Thread>();

public static boolean ILLUMINATI_DEBUG = false;

public static boolean ILLUMINATI_SWITCH_ACTIVATION = false;
public static AtomicBoolean ILLUMINATI_SWITCH_VALUE = new AtomicBoolean(false);

public final static String BASIC_ILLUMINATI_SWITCH_VALUE_CHECK_INTERVAL = "5000";

public static final String[] PROPERTIES_KEYS;

static {
PROPERTIES_KEYS = new String[]{"parentModuleName", "samplingRate"
, "broker", "clusterList", "virtualHost", "topic", "queueName"
, "userName", "password", "isAsync", "isCompression"
, "performance", "debug", "chaosBomber"};
}

public static final Gson ILLUMINATI_GSON_OBJ = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().excludeFieldsWithModifiers(Modifier.TRANSIENT).serializeNulls().create();
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
package com.leekyoungil.illuminati.client.prossor.model;
package com.leekyoungil.illuminati.common.dto;

import com.google.gson.annotations.Expose;
import com.leekyoungil.illuminati.client.prossor.init.IlluminatiClientInit;
import com.leekyoungil.illuminati.client.prossor.util.ConvertUtil;
import com.leekyoungil.illuminati.client.prossor.util.StringUtils;
import com.leekyoungil.illuminati.client.prossor.util.SystemUtil;
import com.leekyoungil.illuminati.common.constant.IlluminatiConstant;
import com.leekyoungil.illuminati.common.util.StringObjectUtils;
import org.aspectj.lang.reflect.MethodSignature;

import javax.servlet.http.HttpServletRequest;
import java.io.Serializable;
import java.lang.reflect.Method;
import java.nio.ByteBuffer;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
Expand All @@ -26,8 +22,8 @@ public class IlluminatiModel implements Serializable {

protected static final DateFormat DATE_FORMAT_EVENT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSS");

@Expose private final String parentModuleName = IlluminatiClientInit.PARENT_MODULE_NAME;
@Expose private final ServerInfo serverInfo = IlluminatiClientInit.SERVER_INFO;
@Expose private String parentModuleName;
@Expose private ServerInfo serverInfo;
@Expose private Map<String, Object> jvmInfo;

@Expose private String id;
Expand Down Expand Up @@ -66,6 +62,11 @@ public void initBasicJvmInfo (final Map<String, Object> jvmInfo) {
this.jvmInfo = jvmInfo;
}

public void initStaticInfo (final String parentModuleName, final ServerInfo serverInfo) {
this.parentModuleName= parentModuleName;
this.serverInfo = serverInfo;
}

public void addBasicJvmMemoryInfo (final Map<String, Object> jvmMemoryInfo) {
if (this.jvmInfo == null) {
this.jvmInfo = new HashMap<String, Object>();
Expand All @@ -89,8 +90,8 @@ public void loadClientInfo (final Map<String, String> clientInfoMap) {
}

public void staticInfo (final Map<String, Object> staticInfo) {
if (!IlluminatiClientInit.SERVER_INFO.isAreadySetServerDomainAndPort()) {
IlluminatiClientInit.SERVER_INFO.setStaticInfoFromRequest(staticInfo);
if (this.serverInfo != null && !this.serverInfo.isAreadySetServerDomainAndPort()) {
this.serverInfo.setStaticInfoFromRequest(staticInfo);
}
}

Expand All @@ -99,11 +100,11 @@ public void isActiveChaosBomber (boolean isActiveChaosBomber) {
}

public String getJsonString () {
return IlluminatiClientInit.ILLUMINATI_GSON_OBJ.toJson(this);
return IlluminatiConstant.ILLUMINATI_GSON_OBJ.toJson(this);
}

private void generateAggregateId () {
this.id = StringUtils.generateId(this.localTime.getTime(), null);
this.id = StringObjectUtils.generateId(this.localTime.getTime(), null);
}

protected String getId () {
Expand Down
Loading

0 comments on commit b11c046

Please sign in to comment.