Commit 92e4e164 authored by femiadeyemi's avatar femiadeyemi
Browse files

make available the metrics of cerebrum

Motivation:

To gain insight on cerebrum-app, the spring framework provide
the facility to expose the application metrics to monitoring
service like Prometheus on Kubernetes.

Modification:

- enable graceful shutdown
- add spring boot actuator and prometheus registry micrometer
    dependencies
- expose the actuator endpoint that will provides: health,
   info, metric etc.
- avoid 404 error on request to /favicon.ico

Result:

Cerebrum now makes it metrics available and can be shutdown
gracefully.

Target: master
parent 8614f6e7
Pipeline #73306 failed with stages
in 8 minutes and 52 seconds
......@@ -32,6 +32,16 @@
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-neo4j</artifactId>
......@@ -176,6 +186,7 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${project.parent.version}</version>
<configuration>
<excludes>
<exclude>
......
......@@ -26,7 +26,7 @@ public class CerebrumSecurityConfig extends WebSecurityConfigurerAdapter
.cors().and()
.authorizeRequests()
.mvcMatchers("/api/v0/admin/**").hasRole("ADMIN")
.mvcMatchers("/", "/swagger-ui/**", "/api/**").permitAll()
.mvcMatchers("/", "/swagger-ui/**", "/api/**", "/actuator/**", "/favicon.ico").permitAll()
.anyRequest().authenticated()
.and()
.oauth2ResourceServer(OAuth2ResourceServerConfigurer::jwt);
......
......@@ -24,7 +24,16 @@ server:
error:
whitelabel:
enabled: false
shutdown: "graceful"
management:
endpoints:
web:
exposure:
include: "prometheus,health,info,metric,shutdown"
metrics:
tags:
application: ${spring.application.name}
org:
neo4j:
driver:
......@@ -34,6 +43,8 @@ org:
password: test
spring:
application:
name: cerebrum-app
data:
rest:
base-path: /api/v0
......
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