Skip to content

Commit

Permalink
Merge pull request #145 in TELIMA/karnak from feat/set_back_eureka_fo…
Browse files Browse the repository at this point in the history
…r_memory_tests to develop

* commit '0917d7f257fb81bcc4851f911ed3cd15cc3c3d59':
  feat: change pom version
  feat: set config eureka for memory monitoring graphana
  • Loading branch information
jdcshug committed May 24, 2022
2 parents 1f9bf2f + 0917d7f commit 0242ea6
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 2 deletions.
20 changes: 19 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</licenses>

<!-- Version -->
<version>1.0.32</version>
<version>1.0.33</version>

<!-- Packaging -->
<packaging>jar</packaging>
Expand Down Expand Up @@ -395,6 +395,16 @@
<version>1.1.1</version>
</dependency>

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>

<!-- Monitoring-->
<dependency>
<groupId>io.micrometer</groupId>
Expand Down Expand Up @@ -689,6 +699,14 @@
<type>pom</type>
<version>${vaadin.version}</version>
</dependency>

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>2021.0.2</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/karnak/backend/config/AppConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.event.EventListener;
Expand All @@ -39,6 +41,8 @@
@EnableConfigurationProperties
@ConfigurationProperties
@EnableCaching
@EnableDiscoveryClient
@EnableEurekaClient
public class AppConfig {

private static final Logger LOGGER = LoggerFactory.getLogger(AppConfig.class);
Expand Down
20 changes: 20 additions & 0 deletions src/main/resources/application-eureka.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
eureka:
datacenter: ${DATACENTER:local}
instance:
instanceId: ${spring.application.name}:${server.port}:${spring.application.instance_id:${random.value}}
health-check-url-path: /actuator/health
lease-expiration-duration-in-seconds: 2
lease-renewal-interval-in-seconds: 1
prefer-ip-address: false # forcer l'enregistrement par hostname
metadata-map:
startup: ${random.int} #needed to trigger info and endpoint update after restart
client:
enabled: true
healthcheck:
enabled: true
fetch-registry: true
register-with-eureka: true
service-url:
defaultZone: ${EUREKA_CLIENT_SERVICE_URL_DEFAULT_ZONE:http://localhost:8761/eureka}
registry-fetch-interval-seconds: 3
region: ${REGION:local}
22 changes: 21 additions & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ spring:
enabled: true
change-log: classpath:db/changelog/db.changelog-master.yaml
profiles:
active: '@activatedProperties@,docker,redis'
active: '@activatedProperties@,docker,redis, eureka'
datasource:
password: ${DB_PASSWORD:5!KAnN@%98%d}
url: 'jdbc:postgresql://${DB_HOST:localhost}:${DB_PORT:5433}/${DB_NAME:karnak}'
Expand Down Expand Up @@ -63,6 +63,12 @@ spring:
jdbc:
lob:
non_contextual_creation: true
info:
# environment: ${ENVIRONMENT}
tags:
eureka.datacenter: ${eureka.datacenter}
eureka.instance-id: ${eureka.instance.instance-id}

management:
endpoints:
web:
Expand All @@ -74,5 +80,19 @@ management:
endpoint:
health:
show-details: always
metrics:
export:
prometheus:
enabled: true
distribution:
percentiles-histogram:
'[http.server.requests]': true
percentiles:
'[http.server.requests]': 0.5, 0.9, 0.95, 0.99, 0.999
slo:
'[http.server.requests]': 50ms, 150ms, 250ms, 400ms
tags:
application: ${spring.application.name}

monitoring:
max-history: 150000
5 changes: 5 additions & 0 deletions src/test/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ logging:
server:
port: 8081
spring:
application:
name: karnak
cloud:
config:
enabled: false
profiles:
active: '@activatedProperties@'
liquibase:
Expand Down

0 comments on commit 0242ea6

Please sign in to comment.