Slide 1

Slide 1 text

SPB2031LV Observability for Modern Spring Applications Staff Software Engineer Tommy Ludwig (he/him) #springone #SPB2031LV Staff Software Engineer Jonatan Ivanov (he/him)

Slide 2

Slide 2 text

Confidential │2023 © VMware, Inc. 2 Disclaimer This presentation may contain product features or functionality that are currently under development. This overview of new technology represents no commitment from VMware to deliver these features in any generally available product. Features are subject to change, and must not be included in contracts, purchase orders, or sales agreements of any kind. Technical feasibility and market demand will affect final delivery. Pricing and packaging for any new features/functionality/technology discussed or presented, have not been determined.

Slide 3

Slide 3 text

Confidential │2023 © VMware, Inc. 3 Gauge the audience How many people are using: Observability in production? Spring Boot 3? Micrometer? OpenTelemetry?

Slide 4

Slide 4 text

Confidential │ © VMware, Inc. 4 What is Observability?

Slide 5

Slide 5 text

Confidential │2023 © VMware, Inc. 5 What is Observability? (Providing meaningful information about what happens inside) (Data about your app) How well we can understand the internals of a system based on its outputs

Slide 6

Slide 6 text

Confidential │ © VMware, Inc. 6 Why do we need Observability?

Slide 7

Slide 7 text

Confidential │2023 © VMware, Inc. 7 Why do we need Observability? Today's systems are increasingly complex (Death Star Architecture, Big Ball of Mud)

Slide 8

Slide 8 text

Confidential │2023 © VMware, Inc. 8 Why do we need Observability? Environments can be chaotic (You turn a knob here a little and services are going down there) We need to deal with unknown unknowns (We can’t know everything) Things can be perceived differently by different observers (Everything is broken for the users but seems ok to you)

Slide 9

Slide 9 text

Confidential │2023 © VMware, Inc. 9 Why do we need Observability? Business perspective Reduce lost revenue from production incidents • Lower mean time to recovery (MTTR) Require less specialized knowledge for root cause analysis • Shared method of investigating across system Quantify user experience • Don't guess, measure!

Slide 10

Slide 10 text

Confidential │ © VMware, Inc. 10 DEMO github.com/jonatan-ivanov/teahouse

Slide 11

Slide 11 text

Confidential │2023 © VMware, Inc. 11 Architecture Tea Service Tealeaf Service Water Service

Slide 12

Slide 12 text

Confidential │2023 © VMware, Inc. 12 Let’s make some tea! 🍵

Slide 13

Slide 13 text

Confidential │2023 © VMware, Inc. 13 logs metrics traces

Slide 14

Slide 14 text

Confidential │ © VMware, Inc. 14 Logging Metrics Distributed Tracing

Slide 15

Slide 15 text

Confidential │2023 © VMware, Inc. 15 Logging - Metrics - Distributed Tracing Logging What happened (why)? Emitting events Metrics What is the context? Aggregating data Distributed Tracing Why happened? Recording causal ordering of events

Slide 16

Slide 16 text

Confidential │ © VMware, Inc. 16 Logging with Spring

Slide 17

Slide 17 text

Confidential │2023 © VMware, Inc. 17 Logging with Spring Boot: SLF4J + Logback SLF4J with Logback comes pre-configured SLF4J (Simple Logging Façade for Java) Simple API for logging libraries Logback Natively implements the SLF4J API If you want Log4j2 instead of Logback: - spring-boot-starter-logging + spring-boot-starter-log4j2

Slide 18

Slide 18 text

Confidential │ © VMware, Inc. 18 Metrics with Spring

Slide 19

Slide 19 text

Confidential │2023 © VMware, Inc. 19 Metrics with Spring: Micrometer Dimensional metrics library on the JVM Like SLF4J, but for metrics API is independent of the configured metrics backend Comes with spring-boot-actuator Spring projects are instrumented using Micrometer Many third-party libraries use Micrometer

Slide 20

Slide 20 text

Confidential │2023 © VMware, Inc. 20 Like SLF4J, but for metrics… (supported metrics backends) AppOptics Atlas Azure Monitor CloudWatch (AWS) Datadog Dynatrace Elastic Ganglia Graphite Humio InfluxDB JMX KairosDB New Relic OpenTSDB OTLP Prometheus SignalFx Stackdriver (GCP) StatsD Wavefront + third-party registries

Slide 21

Slide 21 text

Confidential │ © VMware, Inc. 21 Distributed Tracing with Spring

Slide 22

Slide 22 text

Confidential │2023 © VMware, Inc. 22 Distributed Tracing with Spring Boot 2.x: Spring Cloud Sleuth Boot 3.x: Micrometer Tracing (Sleuth w/o Spring dependencies) Provide an abstraction layer on top of tracing libraries Brave (OpenZipkin), default OpenTelemetry (CNCF), experimental Instrumentation for Spring Projects, 3rd party libraries, Support for various backends

Slide 23

Slide 23 text

Confidential │ © VMware, Inc. 23 Observation API “Spring Observability”

Slide 24

Slide 24 text

Confidential │2023 © VMware, Inc. 24 You want to instrument your application… Add logs (application logs) Add metrics Increment Counters Start/Stop Timers Add Distributed Tracing Start/Stop Spans Log Correlation, Context Propagation

Slide 25

Slide 25 text

Confidential │2023 © VMware, Inc. 25 Observation API (Micrometer 1.10) Observation observation = Observation.start("talk",registry); try { // TODO: scope Thread.sleep(1000); } catch (Exception exception) { observation.error(exception); throw exception; } finally { // TODO: attach tags (key-value) observation.stop(); }

Slide 26

Slide 26 text

Confidential │2023 © VMware, Inc. 26 Observation API (Micrometer 1.10) ObservationRegistry registry = ObservationRegistry.create(); registry.observationConfig() .observationHandler(new MeterHandler(...)) .observationHandler(new TracingHandler(...)) .observationHandler(new LoggingHandler(...)) .observationHandler(new AuditEventHandler(...));

Slide 27

Slide 27 text

Confidential │2023 © VMware, Inc. 27 Observation API (Micrometer 1.10) Observation.createNotStarted("talk", registry) .lowCardinalityKeyValue("conference", "S1") .highCardinalityKeyValue("uid", userId) .observe(this::talk); @Observed

Slide 28

Slide 28 text

Confidential │2023 © VMware, Inc. 28 Micrometer.next (or next.next?) Improved Exemplars support Lots of Observability improvements in the Spring portfolio Better Context Propagation Automatic Log Correlation Additional instrumentations (@Scheduled, R2DBC, etc.) Investigating Virtual Treads / Project Loom (?) Investigating Coordinated Restore at Checkpoint (?) New Docs site?

Slide 29

Slide 29 text

Let’s continue the conversation Stay Connected Follow us: @TommyLudwig @jonatan_ivanov Visit us at slack.micrometer.io

Slide 30

Slide 30 text

Thank You Confidential │ © VMware, Inc.

Slide 31

Slide 31 text

Please take your survey.