Page 1
SPRINGONE2GXWASHINGTON, DC
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and l icensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/l icenses/by-nc/3.0/
Spring Boot for DevOpsNicolas Fränkel
@nicolas_frankel
Page 2
@nicolas_frankel 2
Me, Myself and I• By day
– hybris consultant• By night
– Teacher/trainer– Blogger– Book author
Page 3
@nicolas_frankel 3
DevOps• Devs and Ops collaboration?• Treat your infrastructure as
code?• Automate everything?
Page 4
@nicolas_frankel 4
DevOps• Meta-data• Health checks• Metrics
Page 5
@nicolas_frankel 5
A little story
Page 6
@nicolas_frankel 6
Spring Boot to the rescue
Page 7
@nicolas_frankel 7
Non-Functional Requirements• Meta data• Monitoring
– Health checks– Metrics
Page 8
@nicolas_frankel 8
Non-Functional Requirements• Configuration
– Beans– Property values– Controller mappings– etc.
Page 9
@nicolas_frankel 9
Enough talk, time for a demo
Page 10
@nicolas_frankel 14
1. Meta data
Page 11
@nicolas_frankel 15
Meta data• Which application?
– groupId– applicationId
• Version– From Maven– From Git
• Anything!!!
Page 12
@nicolas_frankel 16
Demo time
Page 13
@nicolas_frankel 17
2. Health checks
Page 14
@nicolas_frankel 18
Health checks• A good way to monitor your
application• Each check wraps a
dependency• e.g. a datasource
Page 15
@nicolas_frankel 19
Health checks• Each check returns an Health
object– Status
• UP • DOWN• UNKWOWN• OUT_OF_SERVICE
– Possibly with details
Page 16
@nicolas_frankel 20
Health checks endpoint• /health aggregates all checks• Health are objects
– Serialized in JSON• If only one is down, the HTTP
code is set to 5xx
Page 17
@nicolas_frankel 21
Health checks• Bean must implement
HealthIndicator• Doesn’t use Dropwizard
HealthCheck
Page 18
@nicolas_frankel 22
Demo time
Page 19
@nicolas_frankel 23
3. Metrics
Page 20
@nicolas_frankel 24
Dropwizard Metrics• A metrics model• Exporters to backends• And more…
Page 21
@nicolas_frankel 25
Simple metrics• Gauge
– Simple value• Counter
– Incrementable gauge
Page 22
@nicolas_frankel 26
jconsole• JMX-compliant GUI for
monitoring JVM
Page 23
@nicolas_frankel 27
Page 24
@nicolas_frankel 28
Demo time
Page 25
@nicolas_frankel 29
Dropwizard reporters• (HTTP)• (JMX)• Graphite
Page 26
@nicolas_frankel 32
Graphite• Store numeric time-series data• Render graphs of this data on
demand
Page 27
@nicolas_frankel 33
Demo time
Page 28
@nicolas_frankel 36
For development• Either define the 2 reporters
– Set @ConditionalOnMissingBean
– Use a "Development" profile• Or define only the JMX reporter
– In production, use JMXTrans
Page 29
@nicolas_frankel 37
Metrics are not only technical
Page 30
@nicolas_frankel 38
Q&Ahttps://github.com/nfrankel/enhanced-pet-clinic@nicolas_frankel http://frankel.in/http://blog.frankel.ch/