Official Content

To create a Span, use the CreateSpan method of the Tracer external object.
The CreateSpan method is overloaded, and the simplest method receives the name of the Span to be created.

TestBasic3 procedure:

//Some code here
&span = Tracer.CreateSpan("Calculating Debt")

Suppose that you need to create a new span in an object "TestBasic4" (invoked by "TestBasic3"), and want to create a new span inside the invoked object (which should be a sibling of the parent span).

In the .NET generator, you just create the span inside the invoked procedure and the span will be automatically created as a sibling Span.

TestBasic3 procedure:

//Some code here
&span = Tracer.CreateSpan("Calculating Debt")
//Do more things

TestBasic4.Call()
&span.End()
TestBasic4 procedure:

&span = Tracer.CreateSpan("Processing User Debt")
// Do something else
&span.End()

The following is a view of the spans, using Grafana:

image_202431913168_1_png

In the Java generator, to get the same result it is necessary to pass to the called program the TraceContext obtained while creating the parent span.
The context variable in the example is represented as a TraceContext object.

TestBasic3 procedure:

&span = Tracer.CreateSpan("Calculating Debt")
&Context = &span.Context // Get the Trace Context. &Context is of type TraceContext External Object.

//Do more things
TestBasic4.Call(&Context)
&span.End()
The TraceContext is going to be used to set the parent of the newly created Span.
TestBasic4 procedure:

parm(&Context)

&span = Tracer.CreateSpan("Processing User Debt",&Context) //Pass the Context while creating the sibling span.
// Do something else
&span.End()

 

 Important Note
 Passing the context is compatible with both generators, Java and .NET.

 

 

Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant