Peering inside the black box
Gergely Tóth
Java Platform Engineering
SPRING ONE, SEPTEMBER 2021 PUBLIC
What is my service up to?
Environment
How much memory is
available?
Are we going to run out of file
descriptors?
Interactions
How many incoming/outgoing
calls does it make?
What is the latency in
responding to requests?
Resource Usage
How much CPU are we
using?
How much heap are we
using?
Version
What version of the
application code is running?
What JDK is being used?
SPRING ONE, SEPTEMBER 2021 PUBLIC
Three Pillars of Observability
Tracing
Series of related distributed
events
Events generated in different
parts of the system for a
given user interaction
Metrics
Numeric representation of
measured data
Maximum response time for a
given endpoint
Number of calls to an
endpoint per seconds
Logs
Timestamped record of
events
Application startup and
graceful shutdown
Internal error detailed
information
SPRING ONE, SEPTEMBER 2021 PUBLIC
Cornucopia of options … OpenTelemetry
Standard solution
Provides a common single
API for observability
Supports the mayor
programing languages
Easy to use
Automatic instrumentation
using the agent
Easy to get started with any
application
Collector
Central place to receive,
process and export traces
and metrics (and logs)
W3C
Standard of context
propagation
Replaces homegrown formats
https://opentelemetry.io/img/logos/opentelemetry-stacked-color.png
SPRING ONE, SEPTEMBER 2021 PUBLIC
@NewSpan
public void getAnnotationForTagValueResolver(
@SpanTag(key = "test", resolver = TagValueResolver.class) String test) {
}
Spring Cloud Sleuth for tracing
Part of Spring ecosystem
Quick start: Spring initializr
Integrates with other
components
OpenTelemetry bridge
OpenTelemetry via Sleuth
Currently in incubation
https://spring.io/images/projects/spring-edf462fec682b9d48cf628eaf9e19521.svg
SPRING ONE, SEPTEMBER 2021 PUBLIC
Pet Clinic
https://github.com/spring-projects/spring-petclinic
SPRING ONE, SEPTEMBER 2021 PUBLIC
How to: Pet Clinic
Spring
Cloud
Gateway
Pet Clinic
Pet Clinic
SPRING ONE, SEPTEMBER 2021 PUBLIC
How to: Pet Clinic
Spring
Cloud
Gateway
Pet Clinic
Pet Clinic
OTEL
Collector
SPRING ONE, SEPTEMBER 2021 PUBLIC
How to: Pet Clinic
Spring
Cloud
Gateway
Pet Clinic
Pet Clinic
OTEL
Collector
Jaeger
SPRING ONE, SEPTEMBER 2021 PUBLIC
How to: Pet Clinic
Spring
Cloud
Gateway
Pet Clinic
Pet Clinic
OTEL
Collector
Jaeger
Zipkin
SPRING ONE, SEPTEMBER 2021 PUBLIC
How to: Pet Clinic
Spring
Cloud
Gateway
Pet Clinic
Pet Clinic
OTEL
Collector
Jaeger
Zipkin
Prometheus
SPRING ONE, SEPTEMBER 2021 PUBLIC
How to: Pet Clinic
Spring
Cloud
Gateway
Pet Clinic
Pet Clinic
OTEL
Collector
Jaeger
Zipkin
Prometheus
Grafana
SPRING ONE, SEPTEMBER 2021 PUBLIC
Demo
SPRING ONE, SEPTEMBER 2021 PUBLIC
▪ Getting live information about services is crucial
▪ There is a cornucopia of vendors/libs/frameworks that
provide observability
▪ These require specific dependency/agent for the services
▪ OpenTelemetry standardizes and gives a vendor
agnostic solution
▪ Spring already has a standard solution for traces: Sleuth
▪ Using the bridge between Sleuth and OpenTelemetry
provides an easy solution to benefit from both without
changing the already existing code
The story
SPRING ONE, SEPTEMBER 2021 PUBLIC
▪ Finalized Sleuth OpenTelemetry Bridge
▪ OpenTelemetry metrics SDK finalised
▪ OpenTelemetry for logs
▪ Integration of OpenTelemetry metrics export for
Spring
▪ Integration for OpenTelemetry logs export for Spring
What’s next?

Peering Inside the Black Box: A Case for Observability

  • 1.
    Peering inside theblack box Gergely Tóth Java Platform Engineering
  • 2.
    SPRING ONE, SEPTEMBER2021 PUBLIC What is my service up to? Environment How much memory is available? Are we going to run out of file descriptors? Interactions How many incoming/outgoing calls does it make? What is the latency in responding to requests? Resource Usage How much CPU are we using? How much heap are we using? Version What version of the application code is running? What JDK is being used?
  • 3.
    SPRING ONE, SEPTEMBER2021 PUBLIC Three Pillars of Observability Tracing Series of related distributed events Events generated in different parts of the system for a given user interaction Metrics Numeric representation of measured data Maximum response time for a given endpoint Number of calls to an endpoint per seconds Logs Timestamped record of events Application startup and graceful shutdown Internal error detailed information
  • 4.
    SPRING ONE, SEPTEMBER2021 PUBLIC Cornucopia of options … OpenTelemetry Standard solution Provides a common single API for observability Supports the mayor programing languages Easy to use Automatic instrumentation using the agent Easy to get started with any application Collector Central place to receive, process and export traces and metrics (and logs) W3C Standard of context propagation Replaces homegrown formats https://opentelemetry.io/img/logos/opentelemetry-stacked-color.png
  • 5.
    SPRING ONE, SEPTEMBER2021 PUBLIC @NewSpan public void getAnnotationForTagValueResolver( @SpanTag(key = "test", resolver = TagValueResolver.class) String test) { } Spring Cloud Sleuth for tracing Part of Spring ecosystem Quick start: Spring initializr Integrates with other components OpenTelemetry bridge OpenTelemetry via Sleuth Currently in incubation https://spring.io/images/projects/spring-edf462fec682b9d48cf628eaf9e19521.svg
  • 6.
    SPRING ONE, SEPTEMBER2021 PUBLIC Pet Clinic https://github.com/spring-projects/spring-petclinic
  • 7.
    SPRING ONE, SEPTEMBER2021 PUBLIC How to: Pet Clinic Spring Cloud Gateway Pet Clinic Pet Clinic
  • 8.
    SPRING ONE, SEPTEMBER2021 PUBLIC How to: Pet Clinic Spring Cloud Gateway Pet Clinic Pet Clinic OTEL Collector
  • 9.
    SPRING ONE, SEPTEMBER2021 PUBLIC How to: Pet Clinic Spring Cloud Gateway Pet Clinic Pet Clinic OTEL Collector Jaeger
  • 10.
    SPRING ONE, SEPTEMBER2021 PUBLIC How to: Pet Clinic Spring Cloud Gateway Pet Clinic Pet Clinic OTEL Collector Jaeger Zipkin
  • 11.
    SPRING ONE, SEPTEMBER2021 PUBLIC How to: Pet Clinic Spring Cloud Gateway Pet Clinic Pet Clinic OTEL Collector Jaeger Zipkin Prometheus
  • 12.
    SPRING ONE, SEPTEMBER2021 PUBLIC How to: Pet Clinic Spring Cloud Gateway Pet Clinic Pet Clinic OTEL Collector Jaeger Zipkin Prometheus Grafana
  • 13.
    SPRING ONE, SEPTEMBER2021 PUBLIC Demo
  • 14.
    SPRING ONE, SEPTEMBER2021 PUBLIC ▪ Getting live information about services is crucial ▪ There is a cornucopia of vendors/libs/frameworks that provide observability ▪ These require specific dependency/agent for the services ▪ OpenTelemetry standardizes and gives a vendor agnostic solution ▪ Spring already has a standard solution for traces: Sleuth ▪ Using the bridge between Sleuth and OpenTelemetry provides an easy solution to benefit from both without changing the already existing code The story
  • 15.
    SPRING ONE, SEPTEMBER2021 PUBLIC ▪ Finalized Sleuth OpenTelemetry Bridge ▪ OpenTelemetry metrics SDK finalised ▪ OpenTelemetry for logs ▪ Integration of OpenTelemetry metrics export for Spring ▪ Integration for OpenTelemetry logs export for Spring What’s next?