Skip to content

Commit

Permalink
Merge pull request #84 from LeeKyoungIl/develop
Browse files Browse the repository at this point in the history
Merge Develop into Master
  • Loading branch information
LeeKyoungIl authored Dec 17, 2019
2 parents 4b0600c + 95b9b83 commit ef76803
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 33 deletions.
4 changes: 2 additions & 2 deletions ApiServerSample/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<dependency>
<groupId>me.phoboslabs.illuminati</groupId>
<artifactId>illuminati-annotation</artifactId>
<version>1.2.1</version>
<version>1.2.2</version>
<scope>compile</scope>
</dependency>

Expand All @@ -68,7 +68,7 @@
<dependency>
<groupId>me.phoboslabs.illuminati</groupId>
<artifactId>illuminati-processor</artifactId>
<version>0.9.9.28</version>
<version>0.9.9.29</version>
<scope>compile</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public String sampleTest () {
return "illuminati Cool";
}

@Illuminati(packageType = PackageType.SERVICE)
@Illuminati(packageType = PackageType.SERVICE, ignoreProfile = {"local"})
public String sampleTestByObject (TestModel testModel) {
this.sampleTestByObject1(null);
apiSampleService1.sampleTestByObject1(null);
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ The illuminati is desinged to make collect all data easily and it can be possibl
## struct of illuminati Project

- library
* [illuminati-annotation:1.2.1](https://github.com/LeeKyoungIl/illuminati/tree/master/illuminati/illuminati-annotation)
* [illuminati-annotation:1.2.2](https://github.com/LeeKyoungIl/illuminati/tree/master/illuminati/illuminati-annotation)
* [illuminati-common:1.4.5](https://github.com/LeeKyoungIl/illuminati/tree/master/illuminati/illuminati-common)
* [illuminati-processor:0.9.9.28](https://github.com/LeeKyoungIl/illuminati/tree/master/illuminati/illuminati-processor)
* [illuminati-processor:0.9.9.29](https://github.com/LeeKyoungIl/illuminati/tree/master/illuminati/illuminati-processor)
* [illuminati-switch:1.0.14](https://github.com/LeeKyoungIl/illuminati/tree/master/illuminati/illuminati-switch)
* [illuminati-jscollector:0.5.15](https://github.com/LeeKyoungIl/illuminati/tree/master/illuminati/illuminati-jscollector)
* [illuminati-elasticsearch:0.8.8](https://github.com/LeeKyoungIl/illuminati/tree/master/illuminati/illuminati-elasticsearch)
Expand Down Expand Up @@ -90,13 +90,13 @@ The illuminati is desinged to make collect all data easily and it can be possibl
<dependency>
<groupId>me.phoboslabs.illuminati</groupId>
<artifactId>illuminati-annotation</artifactId>
<version>1.2.1</version>
<version>1.2.2</version>
</dependency>

<dependency>
<groupId>me.phoboslabs.illuminati</groupId>
<artifactId>illuminati-processor</artifactId>
<version>0.9.9.28</version>
<version>0.9.9.29</version>
</dependency>

<!-- This is an option. If you add the module, you can turn it on and off without deploying it. -->
Expand All @@ -123,8 +123,8 @@ repositories {
jcenter()
}

compile 'me.phoboslabs.illuminati:illuminati-annotation:1.2.1'
compile 'me.phoboslabs.illuminati:illuminati-processor:0.9.9.28'
compile 'me.phoboslabs.illuminati:illuminati-annotation:1.2.2'
compile 'me.phoboslabs.illuminati:illuminati-processor:0.9.9.29'
// This is an option. If you add the module, you can turn it on and off without deploying it.
compile 'me.phoboslabs.illuminati:illuminati-switch:1.0.14'
<!-- This is an option. If you add the module, you can collect Event data from Browser to server to response by one transaction id. -->
Expand Down
24 changes: 20 additions & 4 deletions illuminati/illuminati-annotation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@
<dependency>
<groupId>me.phoboslabs.illuminati</groupId>
<artifactId>illuminati-annotation</artifactId>
<version>1.2.1</version>
<version>1.2.2</version>
</dependency>

<dependency>
<groupId>me.phoboslabs.illuminati</groupId>
<artifactId>illuminati-processor</artifactId>
<version>0.9.9.28</version>
<version>0.9.9.29</version>
</dependency>
```

## add to Gradle Dependency
* Gradle

```java
compile 'me.phoboslabs.illuminati:illuminati-annotation:1.2.1'
compile 'me.phoboslabs.illuminati:illuminati-processor:0.9.9.28'
compile 'me.phoboslabs.illuminati:illuminati-annotation:1.2.2'
compile 'me.phoboslabs.illuminati:illuminati-processor:0.9.9.29'
```

## add @Illuminati to Class
Expand All @@ -55,6 +55,8 @@ public class ApiSampleController {
}
```
* apply to all sub methods, but if you want to exclude some method.
* you can select exclude by the Profiles. Basic Value is the value of the "spring.profiles.active". You can change the key by profileKeyword option.

```java
@Illuminati
@RestController
Expand All @@ -73,6 +75,20 @@ public class ApiSampleController {
String testJson = "{\"test\" : 2}";
return testJson;
}

@Illuminati(ignoreProfile = {"local", "test"})
@RequestMapping(value = "test2")
public String test3 (String a, Integer b) throws Exception {
String testJson = "{\"test\" : 3}";
return testJson;
}

@Illuminati(ignoreProfile = {"local", "test"}, profileKeyword = "another.profiles")
@RequestMapping(value = "test2")
public String test4 (String a, Integer b) throws Exception {
String testJson = "{\"test\" : 4}";
return testJson;
}
}
```

Expand Down
2 changes: 1 addition & 1 deletion illuminati/illuminati-annotation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>me.phoboslabs.illuminati</groupId>
<artifactId>illuminati-annotation</artifactId>
<version>1.2.1</version>
<version>1.2.2</version>
<packaging>jar</packaging>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@
@Retention(value = RetentionPolicy.RUNTIME)
public @interface Illuminati {

boolean ignore () default false;
boolean ignore() default false;

int samplingRate () default 0;
int samplingRate() default 0;

PackageType packageType () default PackageType.DEFAULT;
PackageType packageType() default PackageType.DEFAULT;

String[] ignoreProfile() default {};

String profileKeyword() default "spring.profiles.active";
}
8 changes: 4 additions & 4 deletions illuminati/illuminati-processor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
<dependency>
<groupId>me.phoboslabs.illuminati</groupId>
<artifactId>illuminati-annotation</artifactId>
<version>1.2.1</version>
<version>1.2.2</version>
</dependency>

<dependency>
<groupId>me.phoboslabs.illuminati</groupId>
<artifactId>illuminati-processor</artifactId>
<version>0.9.9.28</version>
<version>0.9.9.29</version>
</dependency>

<!-- This is an option. If you add the module, you can turn it on and off without deploying it. -->
Expand Down Expand Up @@ -55,8 +55,8 @@ repositories {
jcenter()
}

compile 'me.phoboslabs.illuminati:illuminati-annotation:1.2.1'
compile 'me.phoboslabs.illuminati:illuminati-processor:0.9.9.28'
compile 'me.phoboslabs.illuminati:illuminati-annotation:1.2.2'
compile 'me.phoboslabs.illuminati:illuminati-processor:0.9.9.29'
// This is an option. If you add the module, you can turn it on and off without deploying it.
compile 'me.phoboslabs.illuminati:illuminati-switch:1.0.14'
// This is an option. If you add the module, you can back up to H2DB automatically when you have a problem with your broker.
Expand Down
4 changes: 2 additions & 2 deletions illuminati/illuminati-processor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>me.phoboslabs.illuminati</groupId>
<artifactId>illuminati-processor</artifactId>
<version>0.9.9.28</version>
<version>0.9.9.29</version>
<packaging>jar</packaging>

<properties>
Expand Down Expand Up @@ -43,7 +43,7 @@
<dependency>
<groupId>me.phoboslabs.illuminati</groupId>
<artifactId>illuminati-annotation</artifactId>
<version>1.2.1</version>
<version>[1.2.2, )</version>
<scope>compile</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,7 @@ public boolean checkIlluminatiIsIgnore (final ProceedingJoinPoint pjp) throws Th
}

public Object executeIlluminati (final ProceedingJoinPoint pjp, final HttpServletRequest request) throws Throwable {
if (IlluminatiGracefulShutdownChecker.getIlluminatiReadyToShutdown()) {
return pjp.proceed();
}

if (this.isActivateIlluminatiSwitch() && this.isOnIlluminatiSwitch() == false) {
if (this.checkConditionOfIlluminatiBasicExecution(pjp) == false) {
return pjp.proceed();
}

Expand All @@ -139,11 +135,7 @@ public Object executeIlluminati (final ProceedingJoinPoint pjp, final HttpServle
* @throws Throwable
*/
public Object executeIlluminatiByChaosBomber (final ProceedingJoinPoint pjp, final HttpServletRequest request) throws Throwable {
if (IlluminatiGracefulShutdownChecker.getIlluminatiReadyToShutdown()) {
return pjp.proceed();
}

if (this.isOnIlluminatiSwitch() == false) {
if (this.checkConditionOfIlluminatiBasicExecution(pjp) == false) {
return pjp.proceed();
}

Expand All @@ -158,6 +150,41 @@ public Object executeIlluminatiByChaosBomber (final ProceedingJoinPoint pjp, fin
// ### private methods ###
// ################################################################################################################

private boolean checkConditionOfIlluminatiBasicExecution(final ProceedingJoinPoint pjp) {
if (IlluminatiGracefulShutdownChecker.getIlluminatiReadyToShutdown()) {
return false;
}
if (this.checkIgnoreProfile(pjp)) {
return false;
}
if (this.isActivateIlluminatiSwitch() && this.isOnIlluminatiSwitch() == false) {
return false;
}

return true;
}

private boolean checkIgnoreProfile(final ProceedingJoinPoint pjp) {
boolean checkResult = false;
try {
Illuminati illuminati = this.getIlluminatiAnnotation(pjp);
if (illuminati.ignoreProfile().length == 0) {
return false;
}

final String activeProfileKeyword = illuminati.profileKeyword();
final String activatedProfileKeyword = System.getProperty(activeProfileKeyword);
for (String checkKeyword : illuminati.ignoreProfile()) {
if (activatedProfileKeyword.equalsIgnoreCase(checkKeyword)) {
checkResult = true;
break;
}
}
} catch (Exception ignore) {}

return checkResult;
}

private Illuminati getIlluminatiAnnotation (final ProceedingJoinPoint pjp) {
final MethodSignature signature = (MethodSignature) pjp.getSignature();
final Method method = signature.getMethod();
Expand Down

0 comments on commit ef76803

Please sign in to comment.