Production-Ready Features
with
SPRING BOOT ACTUATOR
© Rowell Belen
Automatic auditing, health
monitoring and metrics for
Spring Boot Applications
© Rowell Belen
Maven Config:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>
Gradle Config:
dependencies {
compile("org.springframework.boot:spring-boot-starter-actuator")
}
© Rowell Belen
Built-In Endpoints
© Rowell Belen
GET /health - Shows application health information
{
"status": "UP",
"diskSpace": {
"status": "UP",
"total": 10724835328,
"free": 9929453568,
"threshold": 10485760
},
"db": {
"status": "UP",
"database": "PostgreSQL",
"hello": 1
}
}
© Rowell Belen
Custom Health Indicators
import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.stereotype.Component;
@Component
public class WeatherServiceHealthIndicator implements HealthIndicator {
@Override
public Health health() {
int errorCode = checkWeatherService()
if (errorCode != 0) {
return Health.down().withDetail("Error Code", errorCode).build();
}
return Health.up().build();
}
}
© Rowell Belen
GET /metrics - Displays JVM & App Metrics
{
"mem": 440107,
"mem.free": 250901,
"processors": 2,
"instance.uptime": 626420367,
"uptime": 626441178,
"systemload.average": 0.01,
"heap.committed": 325632,
"heap.init": 239616,
"heap.used": 74730,
"heap": 3387904,
"nonheap.committed": 117344,
"nonheap.init": 2496,
"nonheap.used": 114476,
"nonheap": 0,
"threads.peak": 29,
"threads.daemon": 20,
"threads.totalStarted": 21004,
"threads": 27,
"classes": 13008,
"classes.loaded": 13008,
"classes.unloaded": 0,
"gc.ps_scavenge.count": 111,
"gc.ps_scavenge.time": 1263,
"gc.ps_marksweep.count": 3,
"gc.ps_marksweep.time": 807,
"cache.surveys.size": 1
}
© Rowell Belen
GET /metrics - Displays JVM & App Metrics (continued..)
{
"gauge.response.platform-energyid.user.userId.score": 7,
"gauge.response.platform-energyid.user.userId.survey": 10,
"gauge.response.platform-energyid.manage.health": 3,
"gauge.response.platform-energyid.survey": 3,
"counter.status.200.platform-energyid.survey": 3,
"counter.status.200.platform-energyid.manage.health": 10435,
"counter.status.404.platform-energyid.user.userId.score": 36,
"counter.status.404.star-star": 1,
"counter.status.401.platform-energyid.user.userId.survey": 2,
"counter.status.200.platform-energyid.user.userId.score": 4,
"counter.status.200.platform-energyid.user.userId.survey": 1
}
© Rowell Belen
Record Custom Metrics
import org.springframework.boot.actuate.metrics.CounterService;
@Service
public class EnergyScoreService {
private final CounterService counterService;
@Autowired
public EnergyScoreService(CounterService counterService) {
this.counterService = counterService;
}
public void getScore() {
this.counterService.increment("platform.tendril.energyscore.invoked");
}
}
© Rowell Belen
Export Actuator Metrics
@Bean
@ExportMetricWriter
MetricWriter metricWriter() {
return new DataDogStatsdMetricWriter(prefix, "com.datadog...", 8125);
}
@Bean
@ExportMetricWriter
MetricWriter metricWriter(MBeanExporter exporter) {
return new JmxMetricWriter(exporter);
}
© Rowell Belen
GET /info - Displays arbitrary application info
{
"git": {
"commit": {
"message": {
"full": "[MH-780] Support/Expose Tenant Override Survey Questions"
},
"time": 1476993093000,
"id": "173ca32139d14ae383ec46c01fff66385850bfc7",
"id.abbrev": "173ca32",
"user": {
"email": "rbelen@tendrilinc.com",
"name": "Rowell Belen"
}
},
"branch": "HEAD"
},
"build": {
"version": "0.1.0",
"artifact": "platform-energyid-api",
"build": {
"docker": "platform-energyid-api-0.1.0-70-173ca32"
},
"name": "platform-energyid-api",
"group": "com.tendril",
"time": 1476993345000
}
}
© Rowell Belen
GET /env - Exposes Application/Environment properties
{
"profiles": [
"dev"
],
"server.ports": {
"local.server.port": 8080
},
"systemEnvironment": {
"PORT_8080": "31076",
"MARATHON_APP_LABELS": "",
"MARATHON_APP_RESOURCE_CPUS": "0.2",
"MESOS_CONTAINER_NAME": "mesos-60025f2a-3e08-4558-bfa5-daef489a84eb-S49.296367df-cb80-4153-8365-af3fc5f535b3",
"SPRING_PROFILES_ACTIVE": "dev",
"HOST": "10.200.**.**",
"MARATHON_APP_DOCKER_IMAGE": "*******.useast.tni01.com/platform-energyid-api-0.1.0-70-173ca32",
"MARATHON_APP_RESOURCE_MEM": "2048.0",
"MESOS_TASK_ID": "platform-energyid-api-dev.a38b9778-96ff-11e6-bc77-0e76f225482f",
"MARATHON_APP_VERSION": "2016-10-20T19:58:58.461Z",
"MESOS_SANDBOX": "/mnt/mesos/sandbox",
"MARATHON_APP_ID": "/platform-energyid-api-dev",
},
"applicationConfig: [classpath:/application-dev.properties]": {
"spring.datasource.driver-class-name": "org.postgresql.Driver",
"spring.datasource.username": "******",
"spring.datasource.password": "******",
"spring.datasource.url": "jdbc:postgresql://******.useast.tni01.com:5432/energyid",
"app.env": "dev"
}
}
© Rowell Belen
GET /mappings - Displays a collated list of path
mappings
{
"{[/platform-energyid/user/{userId}/survey],methods=[GET]}": {
"bean": "requestMappingHandlerMapping",
"method": "List<Answer> EnergyIdController.getAnswers(String)"
},
"{[/platform-energyid/user/{userId}/score],methods=[GET]}": {
"bean": "requestMappingHandlerMapping",
"method": "public Score EnergyIdController.getUserScore(String)"
},
"{[/platform-energyid/user/{userId}/survey],methods=[POST]}": {
"bean": "requestMappingHandlerMapping",
"method": "public EnergyIdScore EnergyIdController.saveAnswers(List<Answer>)"
},
"{[/platform-energyid/tenant/{tenant}/survey],methods=[GET]}": {
"bean": "requestMappingHandlerMapping",
"method": "public Iterable<Survey> EnergyIdController.getSurvey(java.lang.String)"
},
"{[/platform-energyid/survey],methods=[GET]}": {
"bean": "requestMappingHandlerMapping",
"method": "public Iterable<Survey> EnergyIdController.getSurvey()"
}
}
© Rowell Belen
GET /trace - Displays trace of request/response history
{
"timestamp": 1477616323315,
"info": {
"method": "GET",
"path": "/platform-energyid/manage/health",
"headers": {
"request": {
"host": "10.200.**.***:31***",
"user-agent": "spray-can/1.3.2"
},
"response": {
"X-Application-Context": "application:dev:31542",
"x-api-request-id": "9ec0746c-8e81-42fd-884d-885497958b9f",
"x-duration": "0ms",
"Content-Type": "application/json;charset=UTF-8",
"Transfer-Encoding": "chunked",
"Date": "Fri, 28 Oct 2016 00:58:43 GMT",
"status": "200"
}
}
}
}
© Rowell Belen
GET /logfile - Returns the contents of the logfile
2016-10-20 19:59:16.297 INFO 1 --- [main] c.t.p.energyid.api.MainController : Starting MainController on 0ad70aa2483e with PID 1 (/app/platform-energyid-api-0.1.0.jar started by root in /app)
2016-10-20 19:59:16.384 INFO 1 --- [main] c.t.p.energyid.api.MainController : The following profiles are active: dev
2016-10-20 19:59:17.535 INFO 1 --- [main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@2957fcb0: startup date [Thu Oct 20 19:59:17 UTC 2016]; root of context hierarchy
2016-10-20 19:59:25.096 INFO 1 --- [main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cache.annotation.ProxyCachingConfiguration' of type [class org.springframework.cache.annotation.ProxyCachingConfiguration$$EnhancerBySpringCGLIB$$1ee60781] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-10-20 19:59:25.212 INFO 1 --- [main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration' of type [class org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration$$EnhancerBySpringCGLIB$$1359cc25] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-10-20 19:59:25.476 INFO 1 --- [main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration' of type [class org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration$$EnhancerBySpringCGLIB$$4d68cd] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-10-20 19:59:25.498 INFO 1 --- [main] trationDelegate$BeanPostProcessorChecker : Bean 'stringOrNumberMigrationVersionConverter' of type [class org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration$StringOrNumberToMigrationVersionConverter] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-10-20 19:59:25.690 INFO 1 --- [main] trationDelegate$BeanPostProcessorChecker : Bean 'spring.cache-org.springframework.boot.autoconfigure.cache.CacheProperties' of type [class org.springframework.boot.autoconfigure.cache.CacheProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-10-20 19:59:25.733 INFO 1 --- [main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.cache.CacheManagerCustomizers' of type [class org.springframework.boot.autoconfigure.cache.CacheManagerCustomizers] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-10-20 19:59:25.755 INFO 1 --- [main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.cache.SimpleCacheConfiguration' of type [class org.springframework.boot.autoconfigure.cache.SimpleCacheConfiguration$$EnhancerBySpringCGLIB$$b4f53f06] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-10-20 19:59:25.820 INFO 1 --- [main] trationDelegate$BeanPostProcessorChecker : Bean 'cacheManager' of type [class org.springframework.cache.concurrent.ConcurrentMapCacheManager] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-10-20 19:59:25.822 INFO 1 --- [main] trationDelegate$BeanPostProcessorChecker : Bean 'cacheAutoConfigurationValidator' of type [class org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration$CacheManagerValidator] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-10-20 19:59:26.003 INFO 1 --- [main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$d5d3d163] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-10-20 19:59:28.332 INFO 1 --- [main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2016-10-20 19:59:28.430 INFO 1 --- [main] o.apache.catalina.core.StandardService : Starting service Tomcat
2016-10-20 19:59:28.456 INFO 1 --- [main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.5
2016-10-20 19:59:28.842 INFO 1 --- [localhost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2016-10-20 19:59:28.842 INFO 1 --- [localhost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 11313 ms
2016-10-20 19:59:30.827 INFO 1 --- [localhost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2016-10-20 19:59:30.832 INFO 1 --- [localhost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'webServlet' to [/h2-console/*]
2016-10-20 19:59:30.845 INFO 1 --- [localhost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'metricsFilter' to: [/*]
2016-10-20 19:59:30.847 INFO 1 --- [localhost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2016-10-20 19:59:30.848 INFO 1 --- [localhost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2016-10-20 19:59:30.848 INFO 1 --- [localhost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2016-10-20 19:59:30.849 INFO 1 --- [localhost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2016-10-20 19:59:30.855 INFO 1 --- [localhost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'webRequestLoggingFilter' to: [/*]
2016-10-20 19:59:30.856 INFO 1 --- [localhost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestLoggingFilter' to: [/*]
2016-10-20 19:59:30.856 INFO 1 --- [localhost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'applicationContextIdFilter' to: [/*]
2016-10-20 19:59:32.600 INFO 1 --- [main] o.f.core.internal.util.VersionPrinter : Flyway 4.0.3 by Boxfuse
2016-10-20 19:59:33.074 INFO 1 --- [main] o.f.c.i.dbsupport.DbSupportFactory : Database: jdbc:postgresql://adu-myhome-rds01.useast.tni01.com:5432/energyid (PostgreSQL 9.5)
2016-10-20 19:59:33.285 INFO 1 --- [main] o.f.core.internal.command.DbValidate : Successfully validated 3 migrations (execution time 00:00.048s)
2016-10-20 19:59:33.363 INFO 1 --- [main] o.f.core.internal.command.DbMigrate : Current version of schema "public": 1.2
2016-10-20 19:59:33.366 INFO 1 --- [main] o.f.core.internal.command.DbMigrate : Schema "public" is up to date. No migration necessary.
2016-10-20 19:59:33.763 INFO 1 --- [main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2016-10-20 19:59:33.833 INFO 1 --- [main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2016-10-20 19:59:34.162 INFO 1 --- [main] org.hibernate.Version : HHH000412: Hibernate Core {5.0.11.Final}
2016-10-20 19:59:34.170 INFO 1 --- [main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2016-10-20 19:59:34.178 INFO 1 --- [main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist
2016-10-20 19:59:34.398 INFO 1 --- [main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2016-10-20 19:59:35.308 INFO 1 --- [main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL94Dialect
2016-10-20 19:59:36.951 INFO 1 --- [main] o.h.e.j.e.i.LobCreatorBuilderImpl : HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
2016-10-20 19:59:36.965 INFO 1 --- [main] org.hibernate.type.BasicTypeRegistry : HHH000270: Type registration [java.util.UUID] overrides previous : org.hibernate.type.UUIDBinaryType@33308786
2016-10-20 19:59:38.550 INFO 1 --- [main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2016-10-20 19:59:44.692 INFO 1 --- [main] o.h.h.i.QueryTranslatorFactoryInitiator : HHH000397: Using ASTQueryTranslatorFactory
2016-10-20 19:59:45.169 INFO 1 --- [main] c.t.p.energyid.service.EnergyIdService : Score count: 10
2016-10-20 19:59:45.183 INFO 1 --- [main] c.t.p.energyid.service.EnergyIdService : Survey count: 10
2016-10-20 19:59:45.203 INFO 1 --- [main] c.t.p.energyid.service.EnergyIdService : Answer count: 97
2016-10-20 19:59:45.505 INFO 1 --- [main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService
2016-10-20 19:59:45.564 INFO 1 --- [main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'asyncExecutor'
2016-10-20 19:59:47.067 INFO 1 --- [main] o.a.c.c.C.[Tomcat].[localhost].[/] : jolokia: No access restrictor found, access to any MBean is allowed
2016-10-20 19:59:47.850 INFO 1 --- [main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@2957fcb0: startup date [Thu Oct 20 19:59:17 UTC 2016]; root of context hierarchy
2016-10-20 19:59:47.868 INFO 1 --- [main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Detected ResponseBodyAdvice bean in responseInterceptor
2016-10-20 19:59:48.165 INFO 1 --- [main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/platform-energyid/user/{userId}/survey],methods=[GET]}" onto public java.util.List<com.tendril.platform.energyid.persistence.entities.Answer> com.tendril.platform.energyid.api.EnergyIdController.getAnswers(java.lang.String)
2016-10-20 19:59:48.168 INFO 1 --- [main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/platform-energyid/user/{userId}/survey],methods=[POST]}" onto public com.tendril.platform.energyid.model.energyid.EnergyIdScore com.tendril.platform.energyid.api.EnergyIdController.saveAnswers(java.lang.String,java.util.List<com.tendril.platform.energyid.persistence.entities.Answer>)
2016-10-20 19:59:48.168 INFO 1 --- [main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/platform-energyid/user/{userId}/score],methods=[GET]}" onto public com.tendril.platform.energyid.persistence.entities.Score com.tendril.platform.energyid.api.EnergyIdController.getUserScore(java.lang.String)
2016-10-20 19:59:48.170 INFO 1 --- [main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/platform-energyid/tenant/{tenant}/survey],methods=[GET]}" onto public java.lang.Iterable<com.tendril.platform.energyid.persistence.entities.Survey> com.tendril.platform.energyid.api.EnergyIdController.getSurvey(java.lang.String)
2016-10-20 19:59:48.172 INFO 1 --- [main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/platform-energyid/survey],methods=[GET]}" onto public java.lang.Iterable<com.tendril.platform.energyid.persistence.entities.Survey> com.tendril.platform.energyid.api.EnergyIdController.getSurvey()
2016-10-20 19:59:48.180 INFO 1 --- [main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2016-10-20 19:59:48.189 INFO 1 --- [main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2016-10-20 19:59:48.586 INFO 1 --- [main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-10-20 19:59:48.587 INFO 1 --- [main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-10-20 19:59:48.745 INFO 1 --- [main] .m.m.a.ExceptionHandlerExceptionResolver : Detected ResponseBodyAdvice implementation in responseInterceptor
2016-10-20 19:59:48.954 INFO 1 --- [main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-10-20 19:59:51.983 INFO 1 --- [main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/platform-energyid/manage/flyway || /platform-energyid/manage/flyway.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-10-20 19:59:51.990 INFO 1 --- [main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/platform-energyid/manage/env/{name:.*}],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EnvironmentMvcEndpoint.value(java.lang.String)
2016-10-20 19:59:51.991 INFO 1 --- [main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/platform-energyid/manage/env || /platform-energyid/manage/env.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-10-20 19:59:51.994 INFO 1 --- [main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/platform-energyid/manage/jolokia/**]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.actuate.endpoint.mvc.JolokiaMvcEndpoint.handle(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) throws java.lang.Exception
2016-10-20 19:59:51.997 INFO 1 --- [main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/platform-energyid/manage/autoconfig || /platform-energyid/manage/autoconfig.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-10-20 19:59:52.009 INFO 1 --- [main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/platform-energyid/manage/mappings || /platform-energyid/manage/mappings.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-10-20 19:59:52.011 INFO 1 --- [main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/platform-energyid/manage/trace || /platform-energyid/manage/trace.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-10-20 19:59:52.012 INFO 1 --- [main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/platform-energyid/manage/health || /platform-energyid/manage/health.json],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.invoke(java.security.Principal)
2016-10-20 19:59:52.014 INFO 1 --- [main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/platform-energyid/manage/metrics/{name:.*}],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.MetricsMvcEndpoint.value(java.lang.String)
2016-10-20 19:59:52.015 INFO 1 --- [main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/platform-energyid/manage/metrics || /platform-energyid/manage/metrics.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-10-20 19:59:52.027 INFO 1 --- [main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/platform-energyid/manage/beans || /platform-energyid/manage/beans.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-10-20 19:59:52.031 INFO 1 --- [main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/platform-energyid/manage/dump || /platform-energyid/manage/dump.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-10-20 19:59:52.032 INFO 1 --- [main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/platform-energyid/manage/heapdump || /platform-energyid/manage/heapdump.json],methods=[GET],produces=[application/octet-stream]}" onto public void org.springframework.boot.actuate.endpoint.mvc.HeapdumpMvcEndpoint.invoke(boolean,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) throws java.io.IOException,javax.servlet.ServletException
2016-10-20 19:59:52.037 INFO 1 --- [main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/platform-energyid/manage/info || /platform-energyid/manage/info.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-10-20 19:59:52.041 INFO 1 --- [main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/platform-energyid/manage/logfile || /platform-energyid/manage/logfile.json],methods=[GET || HEAD]}" onto public void org.springframework.boot.actuate.endpoint.mvc.LogFileMvcEndpoint.invoke(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) throws javax.servlet.ServletException,java.io.IOException
2016-10-20 19:59:52.052 INFO 1 --- [main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/platform-energyid/manage/shutdown || /platform-energyid/manage/shutdown.json],methods=[POST]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.ShutdownMvcEndpoint.invoke()
2016-10-20 19:59:52.054 INFO 1 --- [main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/platform-energyid/manage/configprops || /platform-energyid/manage/configprops.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-10-20 19:59:54.581 INFO 1 --- [main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2016-10-20 19:59:54.629 INFO 1 --- [main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 0
2016-10-20 19:59:55.277 INFO 1 --- [main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2016-10-20 19:59:55.295 INFO 1 --- [main] c.t.p.energyid.api.MainController : Started MainController in 40.573 seconds (JVM running for 42.125)
2016-10-20 19:59:58.773 INFO 1 --- [http-nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring FrameworkServlet 'dispatcherServlet'
2016-10-20 19:59:58.773 INFO 1 --- [http-nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started
2016-10-20 19:59:58.844 INFO 1 --- [http-nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 70 ms
2016-10-20 19:59:59.231 INFO 1 --- [http-nio-8080-exec-1] c.t.p.e.interceptor.ResponseInterceptor : [EnergyID API Request b8f299e3-92e1-4812-b498-93471204c2eb - /platform-energyid/manage/health] execution time: -19ms
2016-10-20 20:00:58.626 INFO 1 --- [http-nio-8080-exec-2] c.t.p.e.interceptor.ResponseInterceptor : [EnergyID API Request 940359b0-1f89-4616-8c97-1db78e4d9419 - /platform-energyid/manage/health] execution time: -1ms
2016-10-20 20:01:58.642 INFO 1 --- [http-nio-8080-exec-3] c.t.p.e.interceptor.ResponseInterceptor : [EnergyID API Request 962df856-1a8b-4e4e-84c8-7a51880d898a - /platform-energyid/manage/health] execution time: 0ms
2016-10-20 20:02:58.675 INFO 1 --- [http-nio-8080-exec-4] c.t.p.e.interceptor.ResponseInterceptor : [EnergyID API Request cd3e33f1-1087-47f6-91d0-17fbaed1fe9c - /platform-energyid/manage/health] execution time: -1ms
2016-10-20 20:03:19.830 INFO 1 --- [http-nio-8080-exec-5] c.t.p.e.interceptor.ResponseInterceptor : [EnergyID API Request f923c488-94cd-4e97-83d1-1990edf50902 - /platform-energyid/manage/metrics] execution time: 0ms
2016-10-20 20:03:34.461 INFO 1 --- [http-nio-8080-exec-6] c.t.p.energyid.service.Auth0Service : Resolved Auth0 Client Id: ****************************zjYN
2016-10-20 20:03:34.464 INFO 1 --- [http-nio-8080-exec-6] c.t.p.energyid.service.Auth0Service : Resolved Auth0 Client Secret: ************************************************************QJnt
2016-10-20 20:03:36.838 INFO 1 --- [http-nio-8080-exec-6] c.t.p.energyid.api.EnergyIdController : [2a460977-ac0a-4a2b-8cc5-d830165cd996] [rbelen+stg@tendrilinc.com] Energy ID Score: 4
2016-10-20 20:03:36.907 INFO 1 --- [http-nio-8080-exec-6] c.t.p.e.interceptor.ResponseInterceptor : [EnergyID API Request 2a460977-ac0a-4a2b-8cc5-d830165cd996 - /platform-energyid/user/auth0|574f69ad3747cab00d9aa550/survey] execution time: 2461ms
2016-10-20 20:03:41.445 INFO 1 --- [http-nio-8080-exec-7] c.t.p.energyid.service.Auth0Service : Resolved Auth0 Client Id: ****************************zjYN
2016-10-20 20:03:41.448 INFO 1 --- [http-nio-8080-exec-7] c.t.p.energyid.service.Auth0Service : Resolved Auth0 Client Secret: ************************************************************QJnt
© Rowell Belen
GET /flyway - Shows applied Flyway DB migrations
[
{
"type": "SQL",
"checksum": -1680589936,
"version": "1.0",
"description": "Create Tables",
"script": "V1_0__Create_Tables.sql",
"state": "SUCCESS",
"installedOn": 1476268731466,
"executionTime": 521
},
{
"type": "SQL",
"checksum": 44863635,
"version": "1.1",
"description": "Support Tenant Survey",
"script": "V1_1__Support_Tenant_Survey.sql",
"state": "SUCCESS",
"installedOn": 1476268733651,
"executionTime": 198
}
]
© Rowell Belen
Additional Endpoints...
— GET /beans
— Displays a complete list of all the Spring beans
— GET /dump
— Performs a thread dump
— GET /heapdump
— Returns a GZip compressed heap dump file
See Spring Docs for more...
© Rowell Belen
Securing Actuator Endpoints
© Rowell Belen
Configuration via application.properties
endpoints.enabled=true
endpoints.actuator.enabled=true
endpoints.autoconfig.enabled=false
endpoints.beans.enabled=true
endpoints.configprops.enabled=false
endpoints.docs.enabled=false
endpoints.dump.enabled=true
endpoints.env.enabled=true
endpoints.flyway.enabled=true
endpoints.health.enabled=true
endpoints.info.enabled=true
endpoints.jolokia.enabled=false
endpoints.liquibase.enabled=false
endpoints.logfile.enabled=true
endpoints.mappings.enabled=true
endpoints.metrics.enabled=true
endpoints.metrics.filter.enabled=false
endpoints.shutdown.enabled=false
endpoints.trace.enabled=true
© Rowell Belen
Spring Security
If Spring Security is detected in the project, Basic Auth
is auto-configured.
security.user.name=admin
security.user.password=secret
management.security.roles=SUPERUSER
See Spring Docs for more security options...
© Rowell Belen
/OUT
© Rowell Belen

Spring Boot Actuator

  • 1.
  • 2.
    Automatic auditing, health monitoringand metrics for Spring Boot Applications © Rowell Belen
  • 3.
  • 4.
  • 5.
    GET /health -Shows application health information { "status": "UP", "diskSpace": { "status": "UP", "total": 10724835328, "free": 9929453568, "threshold": 10485760 }, "db": { "status": "UP", "database": "PostgreSQL", "hello": 1 } } © Rowell Belen
  • 6.
    Custom Health Indicators importorg.springframework.boot.actuate.health.Health; import org.springframework.boot.actuate.health.HealthIndicator; import org.springframework.stereotype.Component; @Component public class WeatherServiceHealthIndicator implements HealthIndicator { @Override public Health health() { int errorCode = checkWeatherService() if (errorCode != 0) { return Health.down().withDetail("Error Code", errorCode).build(); } return Health.up().build(); } } © Rowell Belen
  • 7.
    GET /metrics -Displays JVM & App Metrics { "mem": 440107, "mem.free": 250901, "processors": 2, "instance.uptime": 626420367, "uptime": 626441178, "systemload.average": 0.01, "heap.committed": 325632, "heap.init": 239616, "heap.used": 74730, "heap": 3387904, "nonheap.committed": 117344, "nonheap.init": 2496, "nonheap.used": 114476, "nonheap": 0, "threads.peak": 29, "threads.daemon": 20, "threads.totalStarted": 21004, "threads": 27, "classes": 13008, "classes.loaded": 13008, "classes.unloaded": 0, "gc.ps_scavenge.count": 111, "gc.ps_scavenge.time": 1263, "gc.ps_marksweep.count": 3, "gc.ps_marksweep.time": 807, "cache.surveys.size": 1 } © Rowell Belen
  • 8.
    GET /metrics -Displays JVM & App Metrics (continued..) { "gauge.response.platform-energyid.user.userId.score": 7, "gauge.response.platform-energyid.user.userId.survey": 10, "gauge.response.platform-energyid.manage.health": 3, "gauge.response.platform-energyid.survey": 3, "counter.status.200.platform-energyid.survey": 3, "counter.status.200.platform-energyid.manage.health": 10435, "counter.status.404.platform-energyid.user.userId.score": 36, "counter.status.404.star-star": 1, "counter.status.401.platform-energyid.user.userId.survey": 2, "counter.status.200.platform-energyid.user.userId.score": 4, "counter.status.200.platform-energyid.user.userId.survey": 1 } © Rowell Belen
  • 9.
    Record Custom Metrics importorg.springframework.boot.actuate.metrics.CounterService; @Service public class EnergyScoreService { private final CounterService counterService; @Autowired public EnergyScoreService(CounterService counterService) { this.counterService = counterService; } public void getScore() { this.counterService.increment("platform.tendril.energyscore.invoked"); } } © Rowell Belen
  • 10.
    Export Actuator Metrics @Bean @ExportMetricWriter MetricWritermetricWriter() { return new DataDogStatsdMetricWriter(prefix, "com.datadog...", 8125); } @Bean @ExportMetricWriter MetricWriter metricWriter(MBeanExporter exporter) { return new JmxMetricWriter(exporter); } © Rowell Belen
  • 11.
    GET /info -Displays arbitrary application info { "git": { "commit": { "message": { "full": "[MH-780] Support/Expose Tenant Override Survey Questions" }, "time": 1476993093000, "id": "173ca32139d14ae383ec46c01fff66385850bfc7", "id.abbrev": "173ca32", "user": { "email": "rbelen@tendrilinc.com", "name": "Rowell Belen" } }, "branch": "HEAD" }, "build": { "version": "0.1.0", "artifact": "platform-energyid-api", "build": { "docker": "platform-energyid-api-0.1.0-70-173ca32" }, "name": "platform-energyid-api", "group": "com.tendril", "time": 1476993345000 } } © Rowell Belen
  • 12.
    GET /env -Exposes Application/Environment properties { "profiles": [ "dev" ], "server.ports": { "local.server.port": 8080 }, "systemEnvironment": { "PORT_8080": "31076", "MARATHON_APP_LABELS": "", "MARATHON_APP_RESOURCE_CPUS": "0.2", "MESOS_CONTAINER_NAME": "mesos-60025f2a-3e08-4558-bfa5-daef489a84eb-S49.296367df-cb80-4153-8365-af3fc5f535b3", "SPRING_PROFILES_ACTIVE": "dev", "HOST": "10.200.**.**", "MARATHON_APP_DOCKER_IMAGE": "*******.useast.tni01.com/platform-energyid-api-0.1.0-70-173ca32", "MARATHON_APP_RESOURCE_MEM": "2048.0", "MESOS_TASK_ID": "platform-energyid-api-dev.a38b9778-96ff-11e6-bc77-0e76f225482f", "MARATHON_APP_VERSION": "2016-10-20T19:58:58.461Z", "MESOS_SANDBOX": "/mnt/mesos/sandbox", "MARATHON_APP_ID": "/platform-energyid-api-dev", }, "applicationConfig: [classpath:/application-dev.properties]": { "spring.datasource.driver-class-name": "org.postgresql.Driver", "spring.datasource.username": "******", "spring.datasource.password": "******", "spring.datasource.url": "jdbc:postgresql://******.useast.tni01.com:5432/energyid", "app.env": "dev" } } © Rowell Belen
  • 13.
    GET /mappings -Displays a collated list of path mappings { "{[/platform-energyid/user/{userId}/survey],methods=[GET]}": { "bean": "requestMappingHandlerMapping", "method": "List<Answer> EnergyIdController.getAnswers(String)" }, "{[/platform-energyid/user/{userId}/score],methods=[GET]}": { "bean": "requestMappingHandlerMapping", "method": "public Score EnergyIdController.getUserScore(String)" }, "{[/platform-energyid/user/{userId}/survey],methods=[POST]}": { "bean": "requestMappingHandlerMapping", "method": "public EnergyIdScore EnergyIdController.saveAnswers(List<Answer>)" }, "{[/platform-energyid/tenant/{tenant}/survey],methods=[GET]}": { "bean": "requestMappingHandlerMapping", "method": "public Iterable<Survey> EnergyIdController.getSurvey(java.lang.String)" }, "{[/platform-energyid/survey],methods=[GET]}": { "bean": "requestMappingHandlerMapping", "method": "public Iterable<Survey> EnergyIdController.getSurvey()" } } © Rowell Belen
  • 14.
    GET /trace -Displays trace of request/response history { "timestamp": 1477616323315, "info": { "method": "GET", "path": "/platform-energyid/manage/health", "headers": { "request": { "host": "10.200.**.***:31***", "user-agent": "spray-can/1.3.2" }, "response": { "X-Application-Context": "application:dev:31542", "x-api-request-id": "9ec0746c-8e81-42fd-884d-885497958b9f", "x-duration": "0ms", "Content-Type": "application/json;charset=UTF-8", "Transfer-Encoding": "chunked", "Date": "Fri, 28 Oct 2016 00:58:43 GMT", "status": "200" } } } } © Rowell Belen
  • 15.
    GET /logfile -Returns the contents of the logfile 2016-10-20 19:59:16.297 INFO 1 --- [main] c.t.p.energyid.api.MainController : Starting MainController on 0ad70aa2483e with PID 1 (/app/platform-energyid-api-0.1.0.jar started by root in /app) 2016-10-20 19:59:16.384 INFO 1 --- [main] c.t.p.energyid.api.MainController : The following profiles are active: dev 2016-10-20 19:59:17.535 INFO 1 --- [main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@2957fcb0: startup date [Thu Oct 20 19:59:17 UTC 2016]; root of context hierarchy 2016-10-20 19:59:25.096 INFO 1 --- [main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cache.annotation.ProxyCachingConfiguration' of type [class org.springframework.cache.annotation.ProxyCachingConfiguration$$EnhancerBySpringCGLIB$$1ee60781] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2016-10-20 19:59:25.212 INFO 1 --- [main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration' of type [class org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration$$EnhancerBySpringCGLIB$$1359cc25] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2016-10-20 19:59:25.476 INFO 1 --- [main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration' of type [class org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration$$EnhancerBySpringCGLIB$$4d68cd] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2016-10-20 19:59:25.498 INFO 1 --- [main] trationDelegate$BeanPostProcessorChecker : Bean 'stringOrNumberMigrationVersionConverter' of type [class org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration$StringOrNumberToMigrationVersionConverter] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2016-10-20 19:59:25.690 INFO 1 --- [main] trationDelegate$BeanPostProcessorChecker : Bean 'spring.cache-org.springframework.boot.autoconfigure.cache.CacheProperties' of type [class org.springframework.boot.autoconfigure.cache.CacheProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2016-10-20 19:59:25.733 INFO 1 --- [main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.cache.CacheManagerCustomizers' of type [class org.springframework.boot.autoconfigure.cache.CacheManagerCustomizers] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2016-10-20 19:59:25.755 INFO 1 --- [main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.cache.SimpleCacheConfiguration' of type [class org.springframework.boot.autoconfigure.cache.SimpleCacheConfiguration$$EnhancerBySpringCGLIB$$b4f53f06] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2016-10-20 19:59:25.820 INFO 1 --- [main] trationDelegate$BeanPostProcessorChecker : Bean 'cacheManager' of type [class org.springframework.cache.concurrent.ConcurrentMapCacheManager] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2016-10-20 19:59:25.822 INFO 1 --- [main] trationDelegate$BeanPostProcessorChecker : Bean 'cacheAutoConfigurationValidator' of type [class org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration$CacheManagerValidator] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2016-10-20 19:59:26.003 INFO 1 --- [main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$d5d3d163] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2016-10-20 19:59:28.332 INFO 1 --- [main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http) 2016-10-20 19:59:28.430 INFO 1 --- [main] o.apache.catalina.core.StandardService : Starting service Tomcat 2016-10-20 19:59:28.456 INFO 1 --- [main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.5 2016-10-20 19:59:28.842 INFO 1 --- [localhost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2016-10-20 19:59:28.842 INFO 1 --- [localhost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 11313 ms 2016-10-20 19:59:30.827 INFO 1 --- [localhost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/] 2016-10-20 19:59:30.832 INFO 1 --- [localhost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'webServlet' to [/h2-console/*] 2016-10-20 19:59:30.845 INFO 1 --- [localhost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'metricsFilter' to: [/*] 2016-10-20 19:59:30.847 INFO 1 --- [localhost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*] 2016-10-20 19:59:30.848 INFO 1 --- [localhost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*] 2016-10-20 19:59:30.848 INFO 1 --- [localhost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*] 2016-10-20 19:59:30.849 INFO 1 --- [localhost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*] 2016-10-20 19:59:30.855 INFO 1 --- [localhost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'webRequestLoggingFilter' to: [/*] 2016-10-20 19:59:30.856 INFO 1 --- [localhost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestLoggingFilter' to: [/*] 2016-10-20 19:59:30.856 INFO 1 --- [localhost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'applicationContextIdFilter' to: [/*] 2016-10-20 19:59:32.600 INFO 1 --- [main] o.f.core.internal.util.VersionPrinter : Flyway 4.0.3 by Boxfuse 2016-10-20 19:59:33.074 INFO 1 --- [main] o.f.c.i.dbsupport.DbSupportFactory : Database: jdbc:postgresql://adu-myhome-rds01.useast.tni01.com:5432/energyid (PostgreSQL 9.5) 2016-10-20 19:59:33.285 INFO 1 --- [main] o.f.core.internal.command.DbValidate : Successfully validated 3 migrations (execution time 00:00.048s) 2016-10-20 19:59:33.363 INFO 1 --- [main] o.f.core.internal.command.DbMigrate : Current version of schema "public": 1.2 2016-10-20 19:59:33.366 INFO 1 --- [main] o.f.core.internal.command.DbMigrate : Schema "public" is up to date. No migration necessary. 2016-10-20 19:59:33.763 INFO 1 --- [main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default' 2016-10-20 19:59:33.833 INFO 1 --- [main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [ name: default ...] 2016-10-20 19:59:34.162 INFO 1 --- [main] org.hibernate.Version : HHH000412: Hibernate Core {5.0.11.Final} 2016-10-20 19:59:34.170 INFO 1 --- [main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found 2016-10-20 19:59:34.178 INFO 1 --- [main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist 2016-10-20 19:59:34.398 INFO 1 --- [main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final} 2016-10-20 19:59:35.308 INFO 1 --- [main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL94Dialect 2016-10-20 19:59:36.951 INFO 1 --- [main] o.h.e.j.e.i.LobCreatorBuilderImpl : HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException 2016-10-20 19:59:36.965 INFO 1 --- [main] org.hibernate.type.BasicTypeRegistry : HHH000270: Type registration [java.util.UUID] overrides previous : org.hibernate.type.UUIDBinaryType@33308786 2016-10-20 19:59:38.550 INFO 1 --- [main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default' 2016-10-20 19:59:44.692 INFO 1 --- [main] o.h.h.i.QueryTranslatorFactoryInitiator : HHH000397: Using ASTQueryTranslatorFactory 2016-10-20 19:59:45.169 INFO 1 --- [main] c.t.p.energyid.service.EnergyIdService : Score count: 10 2016-10-20 19:59:45.183 INFO 1 --- [main] c.t.p.energyid.service.EnergyIdService : Survey count: 10 2016-10-20 19:59:45.203 INFO 1 --- [main] c.t.p.energyid.service.EnergyIdService : Answer count: 97 2016-10-20 19:59:45.505 INFO 1 --- [main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 2016-10-20 19:59:45.564 INFO 1 --- [main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'asyncExecutor' 2016-10-20 19:59:47.067 INFO 1 --- [main] o.a.c.c.C.[Tomcat].[localhost].[/] : jolokia: No access restrictor found, access to any MBean is allowed 2016-10-20 19:59:47.850 INFO 1 --- [main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@2957fcb0: startup date [Thu Oct 20 19:59:17 UTC 2016]; root of context hierarchy 2016-10-20 19:59:47.868 INFO 1 --- [main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Detected ResponseBodyAdvice bean in responseInterceptor 2016-10-20 19:59:48.165 INFO 1 --- [main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/platform-energyid/user/{userId}/survey],methods=[GET]}" onto public java.util.List<com.tendril.platform.energyid.persistence.entities.Answer> com.tendril.platform.energyid.api.EnergyIdController.getAnswers(java.lang.String) 2016-10-20 19:59:48.168 INFO 1 --- [main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/platform-energyid/user/{userId}/survey],methods=[POST]}" onto public com.tendril.platform.energyid.model.energyid.EnergyIdScore com.tendril.platform.energyid.api.EnergyIdController.saveAnswers(java.lang.String,java.util.List<com.tendril.platform.energyid.persistence.entities.Answer>) 2016-10-20 19:59:48.168 INFO 1 --- [main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/platform-energyid/user/{userId}/score],methods=[GET]}" onto public com.tendril.platform.energyid.persistence.entities.Score com.tendril.platform.energyid.api.EnergyIdController.getUserScore(java.lang.String) 2016-10-20 19:59:48.170 INFO 1 --- [main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/platform-energyid/tenant/{tenant}/survey],methods=[GET]}" onto public java.lang.Iterable<com.tendril.platform.energyid.persistence.entities.Survey> com.tendril.platform.energyid.api.EnergyIdController.getSurvey(java.lang.String) 2016-10-20 19:59:48.172 INFO 1 --- [main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/platform-energyid/survey],methods=[GET]}" onto public java.lang.Iterable<com.tendril.platform.energyid.persistence.entities.Survey> com.tendril.platform.energyid.api.EnergyIdController.getSurvey() 2016-10-20 19:59:48.180 INFO 1 --- [main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) 2016-10-20 19:59:48.189 INFO 1 --- [main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest) 2016-10-20 19:59:48.586 INFO 1 --- [main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2016-10-20 19:59:48.587 INFO 1 --- [main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2016-10-20 19:59:48.745 INFO 1 --- [main] .m.m.a.ExceptionHandlerExceptionResolver : Detected ResponseBodyAdvice implementation in responseInterceptor 2016-10-20 19:59:48.954 INFO 1 --- [main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2016-10-20 19:59:51.983 INFO 1 --- [main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/platform-energyid/manage/flyway || /platform-energyid/manage/flyway.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 2016-10-20 19:59:51.990 INFO 1 --- [main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/platform-energyid/manage/env/{name:.*}],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EnvironmentMvcEndpoint.value(java.lang.String) 2016-10-20 19:59:51.991 INFO 1 --- [main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/platform-energyid/manage/env || /platform-energyid/manage/env.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 2016-10-20 19:59:51.994 INFO 1 --- [main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/platform-energyid/manage/jolokia/**]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.actuate.endpoint.mvc.JolokiaMvcEndpoint.handle(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) throws java.lang.Exception 2016-10-20 19:59:51.997 INFO 1 --- [main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/platform-energyid/manage/autoconfig || /platform-energyid/manage/autoconfig.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 2016-10-20 19:59:52.009 INFO 1 --- [main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/platform-energyid/manage/mappings || /platform-energyid/manage/mappings.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 2016-10-20 19:59:52.011 INFO 1 --- [main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/platform-energyid/manage/trace || /platform-energyid/manage/trace.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 2016-10-20 19:59:52.012 INFO 1 --- [main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/platform-energyid/manage/health || /platform-energyid/manage/health.json],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.invoke(java.security.Principal) 2016-10-20 19:59:52.014 INFO 1 --- [main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/platform-energyid/manage/metrics/{name:.*}],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.MetricsMvcEndpoint.value(java.lang.String) 2016-10-20 19:59:52.015 INFO 1 --- [main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/platform-energyid/manage/metrics || /platform-energyid/manage/metrics.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 2016-10-20 19:59:52.027 INFO 1 --- [main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/platform-energyid/manage/beans || /platform-energyid/manage/beans.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 2016-10-20 19:59:52.031 INFO 1 --- [main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/platform-energyid/manage/dump || /platform-energyid/manage/dump.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 2016-10-20 19:59:52.032 INFO 1 --- [main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/platform-energyid/manage/heapdump || /platform-energyid/manage/heapdump.json],methods=[GET],produces=[application/octet-stream]}" onto public void org.springframework.boot.actuate.endpoint.mvc.HeapdumpMvcEndpoint.invoke(boolean,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) throws java.io.IOException,javax.servlet.ServletException 2016-10-20 19:59:52.037 INFO 1 --- [main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/platform-energyid/manage/info || /platform-energyid/manage/info.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 2016-10-20 19:59:52.041 INFO 1 --- [main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/platform-energyid/manage/logfile || /platform-energyid/manage/logfile.json],methods=[GET || HEAD]}" onto public void org.springframework.boot.actuate.endpoint.mvc.LogFileMvcEndpoint.invoke(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) throws javax.servlet.ServletException,java.io.IOException 2016-10-20 19:59:52.052 INFO 1 --- [main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/platform-energyid/manage/shutdown || /platform-energyid/manage/shutdown.json],methods=[POST]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.ShutdownMvcEndpoint.invoke() 2016-10-20 19:59:52.054 INFO 1 --- [main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/platform-energyid/manage/configprops || /platform-energyid/manage/configprops.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 2016-10-20 19:59:54.581 INFO 1 --- [main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup 2016-10-20 19:59:54.629 INFO 1 --- [main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 0 2016-10-20 19:59:55.277 INFO 1 --- [main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http) 2016-10-20 19:59:55.295 INFO 1 --- [main] c.t.p.energyid.api.MainController : Started MainController in 40.573 seconds (JVM running for 42.125) 2016-10-20 19:59:58.773 INFO 1 --- [http-nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring FrameworkServlet 'dispatcherServlet' 2016-10-20 19:59:58.773 INFO 1 --- [http-nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started 2016-10-20 19:59:58.844 INFO 1 --- [http-nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 70 ms 2016-10-20 19:59:59.231 INFO 1 --- [http-nio-8080-exec-1] c.t.p.e.interceptor.ResponseInterceptor : [EnergyID API Request b8f299e3-92e1-4812-b498-93471204c2eb - /platform-energyid/manage/health] execution time: -19ms 2016-10-20 20:00:58.626 INFO 1 --- [http-nio-8080-exec-2] c.t.p.e.interceptor.ResponseInterceptor : [EnergyID API Request 940359b0-1f89-4616-8c97-1db78e4d9419 - /platform-energyid/manage/health] execution time: -1ms 2016-10-20 20:01:58.642 INFO 1 --- [http-nio-8080-exec-3] c.t.p.e.interceptor.ResponseInterceptor : [EnergyID API Request 962df856-1a8b-4e4e-84c8-7a51880d898a - /platform-energyid/manage/health] execution time: 0ms 2016-10-20 20:02:58.675 INFO 1 --- [http-nio-8080-exec-4] c.t.p.e.interceptor.ResponseInterceptor : [EnergyID API Request cd3e33f1-1087-47f6-91d0-17fbaed1fe9c - /platform-energyid/manage/health] execution time: -1ms 2016-10-20 20:03:19.830 INFO 1 --- [http-nio-8080-exec-5] c.t.p.e.interceptor.ResponseInterceptor : [EnergyID API Request f923c488-94cd-4e97-83d1-1990edf50902 - /platform-energyid/manage/metrics] execution time: 0ms 2016-10-20 20:03:34.461 INFO 1 --- [http-nio-8080-exec-6] c.t.p.energyid.service.Auth0Service : Resolved Auth0 Client Id: ****************************zjYN 2016-10-20 20:03:34.464 INFO 1 --- [http-nio-8080-exec-6] c.t.p.energyid.service.Auth0Service : Resolved Auth0 Client Secret: ************************************************************QJnt 2016-10-20 20:03:36.838 INFO 1 --- [http-nio-8080-exec-6] c.t.p.energyid.api.EnergyIdController : [2a460977-ac0a-4a2b-8cc5-d830165cd996] [rbelen+stg@tendrilinc.com] Energy ID Score: 4 2016-10-20 20:03:36.907 INFO 1 --- [http-nio-8080-exec-6] c.t.p.e.interceptor.ResponseInterceptor : [EnergyID API Request 2a460977-ac0a-4a2b-8cc5-d830165cd996 - /platform-energyid/user/auth0|574f69ad3747cab00d9aa550/survey] execution time: 2461ms 2016-10-20 20:03:41.445 INFO 1 --- [http-nio-8080-exec-7] c.t.p.energyid.service.Auth0Service : Resolved Auth0 Client Id: ****************************zjYN 2016-10-20 20:03:41.448 INFO 1 --- [http-nio-8080-exec-7] c.t.p.energyid.service.Auth0Service : Resolved Auth0 Client Secret: ************************************************************QJnt © Rowell Belen
  • 16.
    GET /flyway -Shows applied Flyway DB migrations [ { "type": "SQL", "checksum": -1680589936, "version": "1.0", "description": "Create Tables", "script": "V1_0__Create_Tables.sql", "state": "SUCCESS", "installedOn": 1476268731466, "executionTime": 521 }, { "type": "SQL", "checksum": 44863635, "version": "1.1", "description": "Support Tenant Survey", "script": "V1_1__Support_Tenant_Survey.sql", "state": "SUCCESS", "installedOn": 1476268733651, "executionTime": 198 } ] © Rowell Belen
  • 17.
    Additional Endpoints... — GET/beans — Displays a complete list of all the Spring beans — GET /dump — Performs a thread dump — GET /heapdump — Returns a GZip compressed heap dump file See Spring Docs for more... © Rowell Belen
  • 18.
  • 19.
  • 20.
    Spring Security If SpringSecurity is detected in the project, Basic Auth is auto-configured. security.user.name=admin security.user.password=secret management.security.roles=SUPERUSER See Spring Docs for more security options... © Rowell Belen
  • 21.