Skip to content

Commit

Permalink
[MAPR] AOP aspects ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
mapalomar committed Oct 10, 2020
1 parent 64acebf commit 6d30c92
Show file tree
Hide file tree
Showing 9 changed files with 546 additions and 481 deletions.
9 changes: 5 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ All notable changes to this project will be documented in this file.

### Added

- Setted responses retention time on fake requests
- Added aspect configuration
- Setted responses retention time on fake requests.
- Added aspect configuration.
- AOP aspects ordering.

### Fixed

Expand All @@ -19,14 +20,14 @@ All notable changes to this project will be documented in this file.

- Updated DP3T release: 1.1.2
- Environment description in README.md file.
- Added license
- Added license.
- Added CODE_OF_CONDUCT.md file.
- Added CHANGELOG.md file.

### Changed

- Max keys are now 30.
- Updated TestContainers version
- Updated TestContainers version.

### Deleted

Expand Down
33 changes: 29 additions & 4 deletions dpppt-backend-sdk/dpppt-backend-sdk-ws/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,23 @@
</properties>

<profiles>
<profile>
<id>aws-metrics</id>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-aws</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-aws-actuator</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-cloudwatch2</artifactId>
</dependency>
</dependencies>
</profile>
<profile>
<id>radarcovid-local</id>
<properties>
Expand All @@ -38,12 +55,24 @@
<properties>
<build.profile.id>radarcovid-pre</build.profile.id>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-aws-parameter-store-config</artifactId>
</dependency>
</dependencies>
</profile>
<profile>
<id>radarcovid-pro</id>
<properties>
<build.profile.id>radarcovid-pro</build.profile.id>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-aws-parameter-store-config</artifactId>
</dependency>
</dependencies>
</profile>
</profiles>

Expand All @@ -61,10 +90,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cloud-connectors</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-aws-parameter-store-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ cloud:
stack:
auto: ${CLOUD.AWS.STACK.AUTO:false}

management.endpoints.enabled-by-default: false
management:
endpoints.enabled-by-default: false
metrics:
export:
cloudwatch:
namespace: dpppt
batch-size: 20

server:
error.whitelabel.enabled: true
Expand Down Expand Up @@ -62,8 +68,13 @@ logging:
com.amazonaws: error
org.dpppt.backend.sdk.data.gaen.fakekeyservice: info
org.dpppt.backend.sdk.ws.radarcovid: debug
org.dpppt.backend.sdk.ws.radarcovid.annotation: info
org.dpppt.backend.sdk.ws.radarcovid.config: info
org.dpppt.backend.sdk.ws.security.gaen: debug
org.dpppt: info
com.zaxxer.hikari.pool.HikariPool: debug
com.zaxxer.hikari.HikariConfig: debug
com.zaxxer.hikari: debug
pattern:
console: '[%-5level] [%X{X-B3-TraceId:-},%X{X-Amz-Cf-Id:-}] - %c{1} - %msg%n'

Expand Down Expand Up @@ -138,5 +149,7 @@ application:
enabled: ${RESPONSE_RETENTION_ENABLED:false}
time:
exposed: ${RESPONSE_RETENTION_TIME_EXPOSED:1000} # milliseconds
exposednextday: ${RESPONSE_RETENTION_TIME_EXPOSEDNEXTDAY:1000} # milliseconds

log:
enabled: ${LOGGABLE_ENABLED:false}
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ public GaenController(GAENDataService dataService, FakeKeyService fakeKeyService

@PostMapping(value = "/exposednextday")
@Loggable
@ResponseRetention(time = "application.response.retention.time.exposednextday")
@Transactional
@Operation(description = "Allows the client to send the last exposed key of the infection to the backend server. The JWT must come from a previous call to /exposed")
@ApiResponses(value = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
Expand All @@ -40,6 +41,7 @@ public class ControllerLoggerAspectConfiguration {
private static final Logger log = LoggerFactory.getLogger("org.dpppt.backend.sdk.ws.radarcovid.annotation.Loggable");

@Aspect
@Order(1)
@Component
public class ControllerLoggerAspect {
@Before("execution(@org.dpppt.backend.sdk.ws.radarcovid.annotation.Loggable * *..controller..*(..))")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import java.util.Arrays;
Expand All @@ -31,6 +32,7 @@ public class MethodLoggerAspectConfiguration {
private static final Logger log = LoggerFactory.getLogger("org.dpppt.backend.sdk.ws.radarcovid.annotation.Loggable");

@Aspect
@Order(2)
@Component
public class MethodLoggerAspect {
@Before("execution(@org.dpppt.backend.sdk.ws.radarcovid.annotation.Loggable * *..business.impl..*(..))")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.core.env.Environment;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
Expand All @@ -40,6 +41,7 @@ public class ResponseRetentionAspectConfiguration {
private Environment environment;

@Aspect
@Order(0)
@Component
public class ControllerTimeResponseControlAspect {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ logging:
com.amazonaws: error
org.dpppt.backend.sdk.data.gaen.fakekeyservice: info
org.dpppt.backend.sdk.ws.radarcovid: debug
org.dpppt.backend.sdk.ws.radarcovid.config: info
org.dpppt.backend.sdk.ws.radarcovid.annotation: info
org.dpppt.backend.sdk.ws.security.gaen: debug
org.dpppt: info
pattern:
Expand Down Expand Up @@ -138,5 +140,7 @@ application:
enabled: ${RESPONSE_RETENTION_ENABLED:true}
time:
exposed: ${RESPONSE_RETENTION_TIME_EXPOSED:1000} # milliseconds
exposednextday: ${RESPONSE_RETENTION_TIME_EXPOSEDNEXTDAY:1000} # milliseconds

log:
enabled: ${LOGGABLE_ENABLED:true}
Loading

0 comments on commit 6d30c92

Please sign in to comment.