SlideShare a Scribd company logo
1 of 38
qaware.de
Go on a Bughunt in production, but without
a map!
Dirk Kröhan
dirk.kroehan@qaware.de
QAware | 2
Dirk Kröhan
Software-Architekt
#qaware #mainz
#cloudnative #spring
#architektur
QAware | 3
Automatisierte
Unit-,
Integration-,
E2E-Tests
Manuelle Tests
Code-Reviews
Pair-Programming Dediziertes QA &
Testing-Team
Statische Code
Analyse
(SonarQube,
FindBugs, …)
Wie vermeiden wir Bugs?
QAware | 4
Testing shows the presence, not the absence of
bugs.
- EDSGER DIJKSTRA -
QAware | 5
Bugs passieren
Auch in Produktion!
QAware | 6
Fehlersuche ist…
…anstrengend…
…und zeitintensiv!
QAware | 7
Bug in
Produktion
Debugging
lokal
QAware | 8
Entwickler-Liebling #1: Logs
Quelle: https://github.com/topics/logging-server
Entwickler-Liebling #2: Stacktrace
QAware | 9
Quelle: https://stackoverflow.com/questions/3988788/what-is-a-stack-trace-and-how-can-i-use-it-to-debug-my-application-errors
Logs in Produktion
QAware | 10
Loglevel
Datenschutz
Zu hohes Log-
Volumen
■ Keine sensitiven Daten
■ Anonymisierte Logs
■ Speicherplatz
■ Kosten
ERROR < WARN < INFO < DEBUG < TRACE
Damit soll ich Bugs beheben?
QAware | 11
QAware | 12
QAware | 13
On
Demand
Debug
Logging
QAware | 14
Unsere Architektur
Service A Service C
API-Gateway
Service B
Service E
Service D
QAware | 15
Beispiel: Fehlerhafter Request
Service A Service C
API-Gateway
Service B
Service E
Service D
QAware | 16
QAware | 17
Follow the
Trace!
Beispiel: Logs gefiltert auf eine TraceId
QAware | 18
Beispiel: Aktiviere Debug Logs via Admin UI
QAware | 19
Beispiel: Logs gefiltert auf eine TraceId mit aktivem On-Demand-
Debug-Logging
QAware | 20
QAware | 21
Aber wie funktioniert das nur?
■ Schritt 1:
– Requests gehen durch ein API-Gateway
QAware | 22
Unsere Architektur
Service A Service C
API-Gateway
Service B
Service E
Service D
QAware | 23
Aber wie funktioniert das nur?
■ Schritt 1:
– Requests gehen durch ein API-Gateway
■ Schritt 2:
– Alle Services nutzen eine Tracing-Library
QAware | 24
Spring Cloud Sleuth
Open-Source Tracing Libraries
Tracing 1o1
QAware | 25
Quelle: https://www.jaegertracing.io/docs/1.43/
Trace Propagation
QAware | 26
■ Es gibt verschiedene Wege um Trace Daten zu propagieren
– W3C Trace Context: https://www.w3.org/TR/trace-context-1/
– Zipking B3 Propagation: https://github.com/openzipkin/b3-propagation
Quelle: https://github.com/openzipkin/b3-propagation
QAware | 27
Aber wie funktioniert das nur?
■ Schritt 1:
– Requests gehen durch ein API-Gateway
■ Schritt 2:
– Alle Services nutzen eine Tracing-Library
■ Schritt 3:
– Debug Information propagieren
Baggage Propagation
QAware | 28
■ W3C Propagation format for distributed context: Baggage
– https://www.w3.org/TR/baggage/
■ Spring Cloud Sleuth (Spring Boot 2.x)
– https://docs.spring.io/spring-cloud-sleuth/docs/current/reference/htmlsingle/spring-cloud-sleuth.html#features-
baggage
■ Micrometer Tracing (Spring Boot 3.x)
– https://micrometer.io/docs/tracing#_micrometer_tracing_baggage_api
=> Wir setzen x-user-debug-log als Baggage Feld im API-Gateway
QAware | 29
Aber wie funktioniert das nur?
■ Schritt 1:
– Requests gehen durch ein API-Gateway
■ Schritt 2:
– Alle Services nutzen eine Tracing-Library
■ Schritt 3:
– Debug Information propagieren
■ Schritt 4:
– Logger loggt auf DEBUG, wenn Debug Info
gesetzt ist
Logback Turbofilter
QAware | 30
■ Gedacht für: “high performance filtering of logging events”
■ Werden bei jedem Logging statement aufgerufen
– noch vor der Erstellung des LoggingEvent-Objekts
■ Entscheidet ob:
– NEUTRAL: Entscheidung wird nicht getroffen
– ACCEPT: Log Statement wird geschrieben
– DENY: Log Statement wird nicht geschrieben
■ Mehr Infos unter: https://logback.qos.ch/manual/filters.html#TurboFilter
QAware | 31
QAware | 32
Elementar, mein lieber Watson!
■ Schritt 1:
– Requests gehen durch ein API-Gateway
■ Schritt 2:
– Alle Services nutzen eine Tracing-Library
■ Schritt 3:
– Debug Information propagieren
■ Schritt 4:
– Logger loggt auf DEBUG, wenn Debug Info
gesetzt ist
QAware | 33
Zusammenfassung
Service A Service C
API-Gateway
Service B
Service E
Service D
1. API-Gateway dekodiert
Access-Token um User-ID
zu ermitteln
2. Überprüft ob für die
User-Id On-Deman-Debug-
Log aktiviert ist.
3. Setzt x-user-debug-
log als Baggage Header.
6. Leitet x-user-debug-
log als Baggage Header
weiter
5. DebugLogTurboFilter
entscheidet:
FilterReply.ACCEPT
4. Verarbeitet Tracing +
Baggage Header
7. Leitet x-user-debug-
log als Baggage Header
weiter
TraceId als HTTP Response Header
curl GET 'https://api.my-awesome-service.de/login' 
--header 'Content-Type: application/json' 
--header 'Authorization: Bearer ...' 
--header 'apikey:my-secret-api-key'
--verbose
QAware | 34
> GET /login HTTP/1.1
> Host: api.my-awesome-service.de
> User-Agent: curl/7.86.0
> Accept: */*
> Content-Type: application/json
> Authorization: Bearer ...
> apikey: my-secret-api-key
< HTTP/1.1 401 Unauthorized
< Vary: Origin
< Vary: Access-Control-Request-Method
< Vary: Access-Control-Request-Headers
< X-TraceId: 20f3cde76728ebf3
< Connection: Keep-Alive
< Keep-Alive: timeout=60, max=100
On-Demand-Debug-Logging
QAware | 35
■ Vorteile
– Fehlerdiagnose auf der Umgebung, wo der Fehler passiert
– Schnellere Fehlerdiagnose
– Jeder Request ist eindeutig per TraceId auffindbar
– Debug Logging sofort aktiv, kein Deployment notwendig
– Kein Problem mit zu hohem Log-Volumen
– Kein Problem mit Datenschutz
■ Nachteile
– Jeder Service im Cluster braucht Tracing Support
– Benötigt zur einfachen Umsetzung ein API-Gateway
QAware | 36
Verbesserte
Mean Time To Repair
Silverado Rotunde
qaware.de
QAware GmbH Mainz
Rheinstraße 4 C
55116 Mainz
Tel. +49 6131 21569-0
info@qaware.de
twitter.com/qaware
linkedin.com/company/qaware-gmbh
xing.com/companies/qawaregmbh
slideshare.net/qaware
github.com/qaware

More Related Content

Similar to Go on a Bughunt in production, but without a map! @ JavaLand 2023

GitLab: CI-Pipelines | PHP Usergroup Hamburg 20.03.2018
GitLab: CI-Pipelines | PHP Usergroup Hamburg 20.03.2018GitLab: CI-Pipelines | PHP Usergroup Hamburg 20.03.2018
GitLab: CI-Pipelines | PHP Usergroup Hamburg 20.03.2018Christian Mücke
 
Cloud Native Computing
Cloud Native ComputingCloud Native Computing
Cloud Native ComputingAarno Aukia
 
EventDB - Hamburg 2013
EventDB - Hamburg 2013EventDB - Hamburg 2013
EventDB - Hamburg 2013NETWAYS
 
A Hitchhiker's Guide to the Cloud Native Stack
A Hitchhiker's Guide to the Cloud Native StackA Hitchhiker's Guide to the Cloud Native Stack
A Hitchhiker's Guide to the Cloud Native StackQAware GmbH
 
A Hitchhiker’s Guide to the Cloud Native Stack. #ContainerConf
A Hitchhiker’s Guide to the Cloud Native Stack. #ContainerConfA Hitchhiker’s Guide to the Cloud Native Stack. #ContainerConf
A Hitchhiker’s Guide to the Cloud Native Stack. #ContainerConfMario-Leander Reimer
 
OpenShift-Build-Pipelines: Build ► Test ► Run!
OpenShift-Build-Pipelines: Build ► Test ► Run!OpenShift-Build-Pipelines: Build ► Test ► Run!
OpenShift-Build-Pipelines: Build ► Test ► Run!Tobias Schneck
 
Autodesk Productstream Inventor Dateien importieren
Autodesk Productstream Inventor Dateien importierenAutodesk Productstream Inventor Dateien importieren
Autodesk Productstream Inventor Dateien importierenwagi2
 
Docker und Kubernetes Patterns & Anti-Patterns
Docker und Kubernetes Patterns & Anti-PatternsDocker und Kubernetes Patterns & Anti-Patterns
Docker und Kubernetes Patterns & Anti-PatternsQAware GmbH
 
Docker und Kubernetes Patterns & Anti-Patterns
Docker und Kubernetes Patterns & Anti-PatternsDocker und Kubernetes Patterns & Anti-Patterns
Docker und Kubernetes Patterns & Anti-PatternsJosef Adersberger
 
DACHNUG50 CNX3 Monitoring.pdf
DACHNUG50 CNX3 Monitoring.pdfDACHNUG50 CNX3 Monitoring.pdf
DACHNUG50 CNX3 Monitoring.pdfDNUG e.V.
 
TYPO3 Monitoring mit t3monitoring
TYPO3 Monitoring mit t3monitoringTYPO3 Monitoring mit t3monitoring
TYPO3 Monitoring mit t3monitoringPeter Kraume
 
Monitoring Openstack - LinuxTag 2013
Monitoring Openstack - LinuxTag 2013Monitoring Openstack - LinuxTag 2013
Monitoring Openstack - LinuxTag 2013NETWAYS
 
Icinga 2: Integration von Graphite (Webinar vom 25.09.2014)
Icinga 2: Integration von Graphite (Webinar vom 25.09.2014)Icinga 2: Integration von Graphite (Webinar vom 25.09.2014)
Icinga 2: Integration von Graphite (Webinar vom 25.09.2014)NETWAYS
 
Kuck mal, Node.js! Einstieg für .NET Entwickler mit Visual Studio Code und Ty...
Kuck mal, Node.js! Einstieg für .NET Entwickler mit Visual Studio Code und Ty...Kuck mal, Node.js! Einstieg für .NET Entwickler mit Visual Studio Code und Ty...
Kuck mal, Node.js! Einstieg für .NET Entwickler mit Visual Studio Code und Ty...Gregor Biswanger
 
Tk roadschow-icinga-pdeneu
Tk roadschow-icinga-pdeneuTk roadschow-icinga-pdeneu
Tk roadschow-icinga-pdeneuWerner Fischer
 
German: Softwareprodukte aus einem Source Code mit Javascript
German: Softwareprodukte aus einem Source Code mit JavascriptGerman: Softwareprodukte aus einem Source Code mit Javascript
German: Softwareprodukte aus einem Source Code mit JavascriptRalf Schwoebel
 
DevOps: Automatisieren, was wir predigen
DevOps: Automatisieren, was wir predigenDevOps: Automatisieren, was wir predigen
DevOps: Automatisieren, was wir predigenFotiosKaramitsos
 
oVirt 3.5 - Einführung und Evaluierungsergebnisse
oVirt 3.5 - Einführung und EvaluierungsergebnisseoVirt 3.5 - Einführung und Evaluierungsergebnisse
oVirt 3.5 - Einführung und Evaluierungsergebnisseinovex GmbH
 
The Best Things in Life Are Free – Wie Sie Ihre IBM ConnecEons Umgebung koste...
The Best Things in Life Are Free – Wie Sie Ihre IBM ConnecEons Umgebung koste...The Best Things in Life Are Free – Wie Sie Ihre IBM ConnecEons Umgebung koste...
The Best Things in Life Are Free – Wie Sie Ihre IBM ConnecEons Umgebung koste...Klaus Bild
 
Security Lab: OIDC in der Praxis
Security Lab: OIDC in der PraxisSecurity Lab: OIDC in der Praxis
Security Lab: OIDC in der PraxisQAware GmbH
 

Similar to Go on a Bughunt in production, but without a map! @ JavaLand 2023 (20)

GitLab: CI-Pipelines | PHP Usergroup Hamburg 20.03.2018
GitLab: CI-Pipelines | PHP Usergroup Hamburg 20.03.2018GitLab: CI-Pipelines | PHP Usergroup Hamburg 20.03.2018
GitLab: CI-Pipelines | PHP Usergroup Hamburg 20.03.2018
 
Cloud Native Computing
Cloud Native ComputingCloud Native Computing
Cloud Native Computing
 
EventDB - Hamburg 2013
EventDB - Hamburg 2013EventDB - Hamburg 2013
EventDB - Hamburg 2013
 
A Hitchhiker's Guide to the Cloud Native Stack
A Hitchhiker's Guide to the Cloud Native StackA Hitchhiker's Guide to the Cloud Native Stack
A Hitchhiker's Guide to the Cloud Native Stack
 
A Hitchhiker’s Guide to the Cloud Native Stack. #ContainerConf
A Hitchhiker’s Guide to the Cloud Native Stack. #ContainerConfA Hitchhiker’s Guide to the Cloud Native Stack. #ContainerConf
A Hitchhiker’s Guide to the Cloud Native Stack. #ContainerConf
 
OpenShift-Build-Pipelines: Build ► Test ► Run!
OpenShift-Build-Pipelines: Build ► Test ► Run!OpenShift-Build-Pipelines: Build ► Test ► Run!
OpenShift-Build-Pipelines: Build ► Test ► Run!
 
Autodesk Productstream Inventor Dateien importieren
Autodesk Productstream Inventor Dateien importierenAutodesk Productstream Inventor Dateien importieren
Autodesk Productstream Inventor Dateien importieren
 
Docker und Kubernetes Patterns & Anti-Patterns
Docker und Kubernetes Patterns & Anti-PatternsDocker und Kubernetes Patterns & Anti-Patterns
Docker und Kubernetes Patterns & Anti-Patterns
 
Docker und Kubernetes Patterns & Anti-Patterns
Docker und Kubernetes Patterns & Anti-PatternsDocker und Kubernetes Patterns & Anti-Patterns
Docker und Kubernetes Patterns & Anti-Patterns
 
DACHNUG50 CNX3 Monitoring.pdf
DACHNUG50 CNX3 Monitoring.pdfDACHNUG50 CNX3 Monitoring.pdf
DACHNUG50 CNX3 Monitoring.pdf
 
TYPO3 Monitoring mit t3monitoring
TYPO3 Monitoring mit t3monitoringTYPO3 Monitoring mit t3monitoring
TYPO3 Monitoring mit t3monitoring
 
Monitoring Openstack - LinuxTag 2013
Monitoring Openstack - LinuxTag 2013Monitoring Openstack - LinuxTag 2013
Monitoring Openstack - LinuxTag 2013
 
Icinga 2: Integration von Graphite (Webinar vom 25.09.2014)
Icinga 2: Integration von Graphite (Webinar vom 25.09.2014)Icinga 2: Integration von Graphite (Webinar vom 25.09.2014)
Icinga 2: Integration von Graphite (Webinar vom 25.09.2014)
 
Kuck mal, Node.js! Einstieg für .NET Entwickler mit Visual Studio Code und Ty...
Kuck mal, Node.js! Einstieg für .NET Entwickler mit Visual Studio Code und Ty...Kuck mal, Node.js! Einstieg für .NET Entwickler mit Visual Studio Code und Ty...
Kuck mal, Node.js! Einstieg für .NET Entwickler mit Visual Studio Code und Ty...
 
Tk roadschow-icinga-pdeneu
Tk roadschow-icinga-pdeneuTk roadschow-icinga-pdeneu
Tk roadschow-icinga-pdeneu
 
German: Softwareprodukte aus einem Source Code mit Javascript
German: Softwareprodukte aus einem Source Code mit JavascriptGerman: Softwareprodukte aus einem Source Code mit Javascript
German: Softwareprodukte aus einem Source Code mit Javascript
 
DevOps: Automatisieren, was wir predigen
DevOps: Automatisieren, was wir predigenDevOps: Automatisieren, was wir predigen
DevOps: Automatisieren, was wir predigen
 
oVirt 3.5 - Einführung und Evaluierungsergebnisse
oVirt 3.5 - Einführung und EvaluierungsergebnisseoVirt 3.5 - Einführung und Evaluierungsergebnisse
oVirt 3.5 - Einführung und Evaluierungsergebnisse
 
The Best Things in Life Are Free – Wie Sie Ihre IBM ConnecEons Umgebung koste...
The Best Things in Life Are Free – Wie Sie Ihre IBM ConnecEons Umgebung koste...The Best Things in Life Are Free – Wie Sie Ihre IBM ConnecEons Umgebung koste...
The Best Things in Life Are Free – Wie Sie Ihre IBM ConnecEons Umgebung koste...
 
Security Lab: OIDC in der Praxis
Security Lab: OIDC in der PraxisSecurity Lab: OIDC in der Praxis
Security Lab: OIDC in der Praxis
 

More from QAware GmbH

50 Shades of K8s Autoscaling #JavaLand24.pdf
50 Shades of K8s Autoscaling #JavaLand24.pdf50 Shades of K8s Autoscaling #JavaLand24.pdf
50 Shades of K8s Autoscaling #JavaLand24.pdfQAware GmbH
 
Make Agile Great - PM-Erfahrungen aus zwei virtuellen internationalen SAFe-Pr...
Make Agile Great - PM-Erfahrungen aus zwei virtuellen internationalen SAFe-Pr...Make Agile Great - PM-Erfahrungen aus zwei virtuellen internationalen SAFe-Pr...
Make Agile Great - PM-Erfahrungen aus zwei virtuellen internationalen SAFe-Pr...QAware GmbH
 
Fully-managed Cloud-native Databases: The path to indefinite scale @ CNN Mainz
Fully-managed Cloud-native Databases: The path to indefinite scale @ CNN MainzFully-managed Cloud-native Databases: The path to indefinite scale @ CNN Mainz
Fully-managed Cloud-native Databases: The path to indefinite scale @ CNN MainzQAware GmbH
 
Down the Ivory Tower towards Agile Architecture
Down the Ivory Tower towards Agile ArchitectureDown the Ivory Tower towards Agile Architecture
Down the Ivory Tower towards Agile ArchitectureQAware GmbH
 
"Mixed" Scrum-Teams – Die richtige Mischung macht's!
"Mixed" Scrum-Teams – Die richtige Mischung macht's!"Mixed" Scrum-Teams – Die richtige Mischung macht's!
"Mixed" Scrum-Teams – Die richtige Mischung macht's!QAware GmbH
 
Der Tod der Testpyramide? – Frontend-Testing mit Playwright
Der Tod der Testpyramide? – Frontend-Testing mit PlaywrightDer Tod der Testpyramide? – Frontend-Testing mit Playwright
Der Tod der Testpyramide? – Frontend-Testing mit PlaywrightQAware GmbH
 
Was kommt nach den SPAs
Was kommt nach den SPAsWas kommt nach den SPAs
Was kommt nach den SPAsQAware GmbH
 
Cloud Migration mit KI: der Turbo
Cloud Migration mit KI: der Turbo Cloud Migration mit KI: der Turbo
Cloud Migration mit KI: der Turbo QAware GmbH
 
Migration von stark regulierten Anwendungen in die Cloud: Dem Teufel die See...
 Migration von stark regulierten Anwendungen in die Cloud: Dem Teufel die See... Migration von stark regulierten Anwendungen in die Cloud: Dem Teufel die See...
Migration von stark regulierten Anwendungen in die Cloud: Dem Teufel die See...QAware GmbH
 
Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster
Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster
Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster QAware GmbH
 
Endlich gute API Tests. Boldly Testing APIs Where No One Has Tested Before.
Endlich gute API Tests. Boldly Testing APIs Where No One Has Tested Before.Endlich gute API Tests. Boldly Testing APIs Where No One Has Tested Before.
Endlich gute API Tests. Boldly Testing APIs Where No One Has Tested Before.QAware GmbH
 
Kubernetes with Cilium in AWS - Experience Report!
Kubernetes with Cilium in AWS - Experience Report!Kubernetes with Cilium in AWS - Experience Report!
Kubernetes with Cilium in AWS - Experience Report!QAware GmbH
 
50 Shades of K8s Autoscaling
50 Shades of K8s Autoscaling50 Shades of K8s Autoscaling
50 Shades of K8s AutoscalingQAware GmbH
 
Kontinuierliche Sicherheitstests für APIs mit Testkube und OWASP ZAP
Kontinuierliche Sicherheitstests für APIs mit Testkube und OWASP ZAPKontinuierliche Sicherheitstests für APIs mit Testkube und OWASP ZAP
Kontinuierliche Sicherheitstests für APIs mit Testkube und OWASP ZAPQAware GmbH
 
Service Mesh Pain & Gain. Experiences from a client project.
Service Mesh Pain & Gain. Experiences from a client project.Service Mesh Pain & Gain. Experiences from a client project.
Service Mesh Pain & Gain. Experiences from a client project.QAware GmbH
 
50 Shades of K8s Autoscaling
50 Shades of K8s Autoscaling50 Shades of K8s Autoscaling
50 Shades of K8s AutoscalingQAware GmbH
 
Blue turns green! Approaches and technologies for sustainable K8s clusters.
Blue turns green! Approaches and technologies for sustainable K8s clusters.Blue turns green! Approaches and technologies for sustainable K8s clusters.
Blue turns green! Approaches and technologies for sustainable K8s clusters.QAware GmbH
 
Per Anhalter zu Cloud Nativen API Gateways
Per Anhalter zu Cloud Nativen API GatewaysPer Anhalter zu Cloud Nativen API Gateways
Per Anhalter zu Cloud Nativen API GatewaysQAware GmbH
 
Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster
Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster
Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster QAware GmbH
 
How to speed up Spring Integration Tests
How to speed up Spring Integration TestsHow to speed up Spring Integration Tests
How to speed up Spring Integration TestsQAware GmbH
 

More from QAware GmbH (20)

50 Shades of K8s Autoscaling #JavaLand24.pdf
50 Shades of K8s Autoscaling #JavaLand24.pdf50 Shades of K8s Autoscaling #JavaLand24.pdf
50 Shades of K8s Autoscaling #JavaLand24.pdf
 
Make Agile Great - PM-Erfahrungen aus zwei virtuellen internationalen SAFe-Pr...
Make Agile Great - PM-Erfahrungen aus zwei virtuellen internationalen SAFe-Pr...Make Agile Great - PM-Erfahrungen aus zwei virtuellen internationalen SAFe-Pr...
Make Agile Great - PM-Erfahrungen aus zwei virtuellen internationalen SAFe-Pr...
 
Fully-managed Cloud-native Databases: The path to indefinite scale @ CNN Mainz
Fully-managed Cloud-native Databases: The path to indefinite scale @ CNN MainzFully-managed Cloud-native Databases: The path to indefinite scale @ CNN Mainz
Fully-managed Cloud-native Databases: The path to indefinite scale @ CNN Mainz
 
Down the Ivory Tower towards Agile Architecture
Down the Ivory Tower towards Agile ArchitectureDown the Ivory Tower towards Agile Architecture
Down the Ivory Tower towards Agile Architecture
 
"Mixed" Scrum-Teams – Die richtige Mischung macht's!
"Mixed" Scrum-Teams – Die richtige Mischung macht's!"Mixed" Scrum-Teams – Die richtige Mischung macht's!
"Mixed" Scrum-Teams – Die richtige Mischung macht's!
 
Der Tod der Testpyramide? – Frontend-Testing mit Playwright
Der Tod der Testpyramide? – Frontend-Testing mit PlaywrightDer Tod der Testpyramide? – Frontend-Testing mit Playwright
Der Tod der Testpyramide? – Frontend-Testing mit Playwright
 
Was kommt nach den SPAs
Was kommt nach den SPAsWas kommt nach den SPAs
Was kommt nach den SPAs
 
Cloud Migration mit KI: der Turbo
Cloud Migration mit KI: der Turbo Cloud Migration mit KI: der Turbo
Cloud Migration mit KI: der Turbo
 
Migration von stark regulierten Anwendungen in die Cloud: Dem Teufel die See...
 Migration von stark regulierten Anwendungen in die Cloud: Dem Teufel die See... Migration von stark regulierten Anwendungen in die Cloud: Dem Teufel die See...
Migration von stark regulierten Anwendungen in die Cloud: Dem Teufel die See...
 
Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster
Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster
Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster
 
Endlich gute API Tests. Boldly Testing APIs Where No One Has Tested Before.
Endlich gute API Tests. Boldly Testing APIs Where No One Has Tested Before.Endlich gute API Tests. Boldly Testing APIs Where No One Has Tested Before.
Endlich gute API Tests. Boldly Testing APIs Where No One Has Tested Before.
 
Kubernetes with Cilium in AWS - Experience Report!
Kubernetes with Cilium in AWS - Experience Report!Kubernetes with Cilium in AWS - Experience Report!
Kubernetes with Cilium in AWS - Experience Report!
 
50 Shades of K8s Autoscaling
50 Shades of K8s Autoscaling50 Shades of K8s Autoscaling
50 Shades of K8s Autoscaling
 
Kontinuierliche Sicherheitstests für APIs mit Testkube und OWASP ZAP
Kontinuierliche Sicherheitstests für APIs mit Testkube und OWASP ZAPKontinuierliche Sicherheitstests für APIs mit Testkube und OWASP ZAP
Kontinuierliche Sicherheitstests für APIs mit Testkube und OWASP ZAP
 
Service Mesh Pain & Gain. Experiences from a client project.
Service Mesh Pain & Gain. Experiences from a client project.Service Mesh Pain & Gain. Experiences from a client project.
Service Mesh Pain & Gain. Experiences from a client project.
 
50 Shades of K8s Autoscaling
50 Shades of K8s Autoscaling50 Shades of K8s Autoscaling
50 Shades of K8s Autoscaling
 
Blue turns green! Approaches and technologies for sustainable K8s clusters.
Blue turns green! Approaches and technologies for sustainable K8s clusters.Blue turns green! Approaches and technologies for sustainable K8s clusters.
Blue turns green! Approaches and technologies for sustainable K8s clusters.
 
Per Anhalter zu Cloud Nativen API Gateways
Per Anhalter zu Cloud Nativen API GatewaysPer Anhalter zu Cloud Nativen API Gateways
Per Anhalter zu Cloud Nativen API Gateways
 
Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster
Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster
Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster
 
How to speed up Spring Integration Tests
How to speed up Spring Integration TestsHow to speed up Spring Integration Tests
How to speed up Spring Integration Tests
 

Go on a Bughunt in production, but without a map! @ JavaLand 2023

  • 1. qaware.de Go on a Bughunt in production, but without a map! Dirk Kröhan dirk.kroehan@qaware.de
  • 2. QAware | 2 Dirk Kröhan Software-Architekt #qaware #mainz #cloudnative #spring #architektur
  • 3. QAware | 3 Automatisierte Unit-, Integration-, E2E-Tests Manuelle Tests Code-Reviews Pair-Programming Dediziertes QA & Testing-Team Statische Code Analyse (SonarQube, FindBugs, …) Wie vermeiden wir Bugs?
  • 4. QAware | 4 Testing shows the presence, not the absence of bugs. - EDSGER DIJKSTRA -
  • 5. QAware | 5 Bugs passieren Auch in Produktion!
  • 6. QAware | 6 Fehlersuche ist… …anstrengend… …und zeitintensiv!
  • 7. QAware | 7 Bug in Produktion Debugging lokal
  • 8. QAware | 8 Entwickler-Liebling #1: Logs Quelle: https://github.com/topics/logging-server
  • 9. Entwickler-Liebling #2: Stacktrace QAware | 9 Quelle: https://stackoverflow.com/questions/3988788/what-is-a-stack-trace-and-how-can-i-use-it-to-debug-my-application-errors
  • 10. Logs in Produktion QAware | 10 Loglevel Datenschutz Zu hohes Log- Volumen ■ Keine sensitiven Daten ■ Anonymisierte Logs ■ Speicherplatz ■ Kosten ERROR < WARN < INFO < DEBUG < TRACE
  • 11. Damit soll ich Bugs beheben? QAware | 11
  • 14. QAware | 14 Unsere Architektur Service A Service C API-Gateway Service B Service E Service D
  • 15. QAware | 15 Beispiel: Fehlerhafter Request Service A Service C API-Gateway Service B Service E Service D
  • 17. QAware | 17 Follow the Trace!
  • 18. Beispiel: Logs gefiltert auf eine TraceId QAware | 18
  • 19. Beispiel: Aktiviere Debug Logs via Admin UI QAware | 19
  • 20. Beispiel: Logs gefiltert auf eine TraceId mit aktivem On-Demand- Debug-Logging QAware | 20
  • 21. QAware | 21 Aber wie funktioniert das nur? ■ Schritt 1: – Requests gehen durch ein API-Gateway
  • 22. QAware | 22 Unsere Architektur Service A Service C API-Gateway Service B Service E Service D
  • 23. QAware | 23 Aber wie funktioniert das nur? ■ Schritt 1: – Requests gehen durch ein API-Gateway ■ Schritt 2: – Alle Services nutzen eine Tracing-Library
  • 24. QAware | 24 Spring Cloud Sleuth Open-Source Tracing Libraries
  • 25. Tracing 1o1 QAware | 25 Quelle: https://www.jaegertracing.io/docs/1.43/
  • 26. Trace Propagation QAware | 26 ■ Es gibt verschiedene Wege um Trace Daten zu propagieren – W3C Trace Context: https://www.w3.org/TR/trace-context-1/ – Zipking B3 Propagation: https://github.com/openzipkin/b3-propagation Quelle: https://github.com/openzipkin/b3-propagation
  • 27. QAware | 27 Aber wie funktioniert das nur? ■ Schritt 1: – Requests gehen durch ein API-Gateway ■ Schritt 2: – Alle Services nutzen eine Tracing-Library ■ Schritt 3: – Debug Information propagieren
  • 28. Baggage Propagation QAware | 28 ■ W3C Propagation format for distributed context: Baggage – https://www.w3.org/TR/baggage/ ■ Spring Cloud Sleuth (Spring Boot 2.x) – https://docs.spring.io/spring-cloud-sleuth/docs/current/reference/htmlsingle/spring-cloud-sleuth.html#features- baggage ■ Micrometer Tracing (Spring Boot 3.x) – https://micrometer.io/docs/tracing#_micrometer_tracing_baggage_api => Wir setzen x-user-debug-log als Baggage Feld im API-Gateway
  • 29. QAware | 29 Aber wie funktioniert das nur? ■ Schritt 1: – Requests gehen durch ein API-Gateway ■ Schritt 2: – Alle Services nutzen eine Tracing-Library ■ Schritt 3: – Debug Information propagieren ■ Schritt 4: – Logger loggt auf DEBUG, wenn Debug Info gesetzt ist
  • 30. Logback Turbofilter QAware | 30 ■ Gedacht für: “high performance filtering of logging events” ■ Werden bei jedem Logging statement aufgerufen – noch vor der Erstellung des LoggingEvent-Objekts ■ Entscheidet ob: – NEUTRAL: Entscheidung wird nicht getroffen – ACCEPT: Log Statement wird geschrieben – DENY: Log Statement wird nicht geschrieben ■ Mehr Infos unter: https://logback.qos.ch/manual/filters.html#TurboFilter
  • 32. QAware | 32 Elementar, mein lieber Watson! ■ Schritt 1: – Requests gehen durch ein API-Gateway ■ Schritt 2: – Alle Services nutzen eine Tracing-Library ■ Schritt 3: – Debug Information propagieren ■ Schritt 4: – Logger loggt auf DEBUG, wenn Debug Info gesetzt ist
  • 33. QAware | 33 Zusammenfassung Service A Service C API-Gateway Service B Service E Service D 1. API-Gateway dekodiert Access-Token um User-ID zu ermitteln 2. Überprüft ob für die User-Id On-Deman-Debug- Log aktiviert ist. 3. Setzt x-user-debug- log als Baggage Header. 6. Leitet x-user-debug- log als Baggage Header weiter 5. DebugLogTurboFilter entscheidet: FilterReply.ACCEPT 4. Verarbeitet Tracing + Baggage Header 7. Leitet x-user-debug- log als Baggage Header weiter
  • 34. TraceId als HTTP Response Header curl GET 'https://api.my-awesome-service.de/login' --header 'Content-Type: application/json' --header 'Authorization: Bearer ...' --header 'apikey:my-secret-api-key' --verbose QAware | 34 > GET /login HTTP/1.1 > Host: api.my-awesome-service.de > User-Agent: curl/7.86.0 > Accept: */* > Content-Type: application/json > Authorization: Bearer ... > apikey: my-secret-api-key < HTTP/1.1 401 Unauthorized < Vary: Origin < Vary: Access-Control-Request-Method < Vary: Access-Control-Request-Headers < X-TraceId: 20f3cde76728ebf3 < Connection: Keep-Alive < Keep-Alive: timeout=60, max=100
  • 35. On-Demand-Debug-Logging QAware | 35 ■ Vorteile – Fehlerdiagnose auf der Umgebung, wo der Fehler passiert – Schnellere Fehlerdiagnose – Jeder Request ist eindeutig per TraceId auffindbar – Debug Logging sofort aktiv, kein Deployment notwendig – Kein Problem mit zu hohem Log-Volumen – Kein Problem mit Datenschutz ■ Nachteile – Jeder Service im Cluster braucht Tracing Support – Benötigt zur einfachen Umsetzung ein API-Gateway
  • 38. qaware.de QAware GmbH Mainz Rheinstraße 4 C 55116 Mainz Tel. +49 6131 21569-0 info@qaware.de twitter.com/qaware linkedin.com/company/qaware-gmbh xing.com/companies/qawaregmbh slideshare.net/qaware github.com/qaware