Slide 1

Slide 1 text

.consulting .solutions .partnership Fährtenlesen für Microservices Tracing in der Cloud

Slide 2

Slide 2 text

Fährtenlesen für Microservices: Tracing in der Cloud Kurzvorstellung © msg | Februar 2019 | Fährtenlesen für Microservices: Tracing in der Cloud 2 33 Jahre alt 5 Jahre Cloud 10 Jahre Java 15 Jahre Linux

Slide 3

Slide 3 text

Ausgangssituation 1. https://github.com/bjkastel/sb2-jaeger-sample Unsere Anwendung © msg | Februar 2019 | Fährtenlesen für Microservices: Tracing in der Cloud 3

Slide 4

Slide 4 text

Ausgangssituation 1. https://github.com/bjkastel/sb2-jaeger-sample Warten… © msg | Februar 2019 | Fährtenlesen für Microservices: Tracing in der Cloud 4

Slide 5

Slide 5 text

Ausgangssituation 1. https://github.com/bjkastel/sb2-jaeger-sample Es funktioniert nicht © msg | Februar 2019 | Fährtenlesen für Microservices: Tracing in der Cloud 5

Slide 6

Slide 6 text

Fährtenlesen für Microservices: Tracing in der Cloud Observability © msg | Februar 2019 | Fährtenlesen für Microservices: Tracing in der Cloud 6 Tracing Status Metriken Logging Aufzeichnen von Ereignissen Statistiken über Ereignisse Verlauf von Ereignissen Zustand des Systems

Slide 7

Slide 7 text

Fährtenlesen für Microservices: Tracing in der Cloud Wie kann Tracing bei der Fehleranalyse unterstützen © msg | Februar 2019 | Fährtenlesen für Microservices: Tracing in der Cloud 7

Slide 8

Slide 8 text

Trace und Spans Fährtenlesen für Microservices: Tracing in der Cloud © msg | Februar 2019 | Fährtenlesen für Microservices: Tracing in der Cloud 8 1. https://w3c.github.io/trace-context/ 2. https://www.jaegertracing.io/docs/1.9/architecture/#span 3. https://www.jaegertracing.io/docs/1.9/client-libraries/#propagation-format • Trace • Beschreibt eine Programmsequenz • Besteht aus mehreren Operationen • Koordination erfolgt über Meta-Informationen • Trace Id • Span Id • Parent Span Id • Flags • Spans • Einzelne Operationen in einem Aufruf • Enthält Informationen über • Beginn • Ende • Komponentenname • Logeinträge • Tags (Key/Value-Paare)

Slide 9

Slide 9 text

Fährtenlesen für Microservices: Tracing in der Cloud 1. https://opentracing.io/docs/overview/what-is-tracing/ 2. https://opentracing.io/specification/ 3. https://opentracing.io/docs/supported-tracers/ 4. https://w3c.github.io/trace-context/ 5. Logo: https://github.com/cncf/artwork OpenTracing © msg | Februar 2019 | Fährtenlesen für Microservices: Tracing in der Cloud 9 • Was ist OpenTracing − Vendor neutrale API für verteiltes Tracing − Semantische Spezifikation − Plattform übergreifend − Anbindung Tracing Implementierungen − Ermöglicht Instrumentalisierung des Programmcodes − Cloud Native Computing Foundation • Was ist OpenTracing nicht − Kein Standard − Überlässt die Weitergabe von Trace-Kontext-Metadaten der Tracing Implementierung

Slide 10

Slide 10 text

Jaeger Tracing Architektur • Implementierung der OpenTracing API • Cloud Native Computing Foundation • Ursprünglich von Uber entwickelt • Datenhaltung − Cassandra Database − Elastic Search • Zusätzliche Funktionen − Vergleichen von Traces − Abhängigkeiten zwischen Services darstellen − Queuing über Kafka − Unterstützung für Sampling − Anbindung an Apache Spark Fährtenlesen für Microservices: Tracing in der Cloud © msg | Februar 2019 | Fährtenlesen für Microservices: Tracing in der Cloud 10 1. https://www.jaegertracing.io/docs/1.9/architecture/#components 2. Logo: https://github.com/cncf/artwork

Slide 11

Slide 11 text

Fährtenlesen für Microservices: Tracing in der Cloud 1. https://github.com/opentracing-contrib/java-spring-jaeger 2. https://github.com/opentracing-contrib/java-spring-cloud Spring Boot, OpenTracing und Jaeger Tracing © msg | Februar 2019 | Fährtenlesen für Microservices: Tracing in der Cloud 11 • Vorbereitete Spring Boot Starter − Vorbereitete Konfiguration − Automatische Integration • Nur ein Maven Dependency Eintrag nötig: io.opentracing.contrib opentracing-spring-jaeger-cloud-starter 1.0.1

Slide 12

Slide 12 text

Vorhandenen Instrumentalisierungen • Spring − RestControllers − RestTemplates − WebAsyncTask − @Async − @Scheduled − Executors • Messaging − JMS − RabbitMQ − WebSocket STOMP − Spring Messaging • Datenbanken − JDBC − Mongo − Redis • Standard Logging • Weitere − Zuul − RxJava − Feign − HystrixFeign − Hystrix Fährtenlesen für Microservices: Tracing in der Cloud © msg | Februar 2019 | Fährtenlesen für Microservices: Tracing in der Cloud 12 1. https://github.com/opentracing-contrib/java-spring-jaeger 2. https://github.com/opentracing-contrib/java-spring-cloud

Slide 13

Slide 13 text

Fährtenlesen für Microservices: Tracing in der Cloud 1. https://github.com/bjkastel/sb2-jaeger-sample Demo Aufbau © msg | Februar 2019 | Fährtenlesen für Microservices: Tracing in der Cloud 13

Slide 14

Slide 14 text

© msg | Februar 2019 | Fährtenlesen für Microservices: Tracing in der Cloud 14 DEMO

Slide 15

Slide 15 text

Fährtenlesen für Microservices: Tracing in der Cloud Tracing Informationen anreichern © msg | Februar 2019 | Fährtenlesen für Microservices: Tracing in der Cloud 15 Spans um Informationen durch Tags erweitern Eigene Spans mit Informationen über den fachlichen Kontext erzeugen // ---------------------------------------------------------------------- // Add waitTime as Tag to current Span tracer.activeSpan().setTag("waitTime", waitTime); // ---------------------------------------------------------------------- // ---------------------------------------------------------------------- // Open own Span for the megaFancyBusinessCalculation. // It's using try-with-resources feature to close the span automatically. try (Scope scope = tracer.buildSpan("megaFancyBusinessCalculation") .startActive(true)) { waitTime = megaFancyBusinessCalculation(); scope.span().setTag("waitTime", waitTime); } // ----------------------------------------------------------------------

Slide 16

Slide 16 text

Fährtenlesen für Microservices: Tracing in der Cloud 1. Bild: https://rrze-pp.github.io/rrze-icon-set/tango/gallery.html#filter von Regional Computing Centre of Erlangen (RRZE) ist lizenziert gemäß CC BY-SA Sampling / Adaptives Sampling © msg | Februar 2019 | Fährtenlesen für Microservices: Tracing in der Cloud 16 • Reduzierung der Rate mit der Traces aufgezeichnet werden • Varianten: − Constant Sampling − Probabilistic Sampling (1 von 10 Traces) − Rate Limiting (Traces pro Sekunde) − Remote • Adaptives Sampling − Entscheidet auf Basis von bestimmten Operationen (Spans) − Mindestrate + Probabilistic Sampling

Slide 17

Slide 17 text

Fährtenlesen für Microservices: Tracing in der Cloud Fazit © msg | Februar 2019 | Fährtenlesen für Microservices: Tracing in der Cloud 17 • Tracing hilfreich als Ergänzung zur Fehlersuche • Einfache Integration • Instrumentalisierung gängiger Spring Boot Funktionen unterstützt • Informationen über fachlichen Kontext in Traces integrierbar • Einigung auf eine Tracing-Implementierung ist (aktuell) notwendig

Slide 18

Slide 18 text

Fährtenlesen für Microservices: Tracing in der Cloud Links © msg | Februar 2019 | Fährtenlesen für Microservices: Tracing in der Cloud 18 • Entwurf der Tracing-Header Spezifikation des W3Cs https://w3c.github.io/trace-context/ • Webseite des OpenTracing Projekts https://opentracing.io • Webseite des Jaeger Tracing Projekts https://www.jaegertracing.io • Spring Boot Integration von OpenTracing mit Jaeger Tracing https://github.com/opentracing-contrib/java-spring-jaeger https://github.com/opentracing-contrib/java-spring-cloud • Code des Beispiel-Projekts https://github.com/bjkastel/sb2-jaeger-sample

Slide 19

Slide 19 text

.consulting .solutions .partnership Björn Kasteleiner Senior Consultant [email protected] msg systems ag Robert-Buerkle-Str. 1, 85737 Ismaning Germany www.msg.group