Upgrade to Pro — share decks privately, control downloads, hide ads and more …

2023-01-25 SpringOne - Observability of Your Ap...

2023-01-25 SpringOne - Observability of Your Application

Jonatan Ivanov

April 30, 2023
Tweet

More Decks by Jonatan Ivanov

Other Decks in Programming

Transcript

  1. Summary - We’ve managed to correlate - Logs to Traces

    (and vice versa) - Traces to Metrics (via common tags) - Metrics to Traces (via exemplars) to Logs - The Spring portfolio is instrumented - WebMVC, WebFlux, etc. instrumentation - Third-party libraries are also instrumented - jdbc-observations - OpenFeign - etc.
  2. What’s (kind of) new in Micrometer? 1.9.0 - 2022 May

    - OTLP Registry (OpenTelemetry) - HighCardinalityTagsDetector - Exemplars (Prometheus)
  3. Exemplars (Prometheus) “Metadata” that you can attach to your metrics

    Updated at measurement time (sampled) They are not tags (high cardinality) Usually traceId and spanId Correlate Metrics to Distributed Tracing and Logs Available for Counter and Histogram buckets
  4. What’s new in Micrometer? 1.10.0 - 2022 November - Micrometer

    Tracing (Sleuth w/o Spring deps.) - Micrometer Docs Generator - Micrometer Context Propagation - Observation API (micrometer-core)
  5. 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
  6. Observation observation = Observation.start("s1",registry); try (Observation.Scope scope = observation.openScope()) {

    Thread.sleep(1000); // Business logic } catch (Exception exception) { observation.error(exception); throw exception; } finally { // TODO: attach tags (key-value) observation.stop(); } Observation API (Micrometer 1.10)
  7. ObservationRegistry registry = ObservationRegistry.create(); registry.observationConfig() .observationHandler(new MeterHandler(...)) .observationHandler(new TracingHandler(...)) .observationHandler(new

    LoggingHandler(...)) .observationHandler(new AuditEventHandler(...)); Observation observation = Observation.start("s1",registry); // let the fun begin… observation.stop(); Observation API (Micrometer 1.10)