From the course: DevOps Foundations: Distributed Tracing

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Adding metadata to your traces

Adding metadata to your traces

From the course: DevOps Foundations: Distributed Tracing

Start my 1-month free trial

Adding metadata to your traces

- [Instructor] Zip King can also report errors when an exception is thrown in the code being traced. Let's add another span to our backend service. This time we'll add some metadata to the span as well. So first, we'll create a new span, we'll call it errorSpan. Again, we'll retrieve tracer, we'll call nextSpan which will create this new span under the parents code that we created. We'll give it a name. We'll call this something is wrong. Okay. Then we'll actually start this tracer. We'll again create a try catch block. So start our errorSpan. Again this will start timing all the code execution that will follow. We'll add a special tag. With a tag method, again this is arbitrary key valid pairs that we can attach to the span. So call this receipt number. Again it can be an arbitrary piece of information. And we'll just add one, two, three, four. Then I'm going to do a quick wait on the thread which will again enable us to simulate a delay in this method. This method will generate…

Contents