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);
}
// ----------------------------------------------------------------------