**Fresh install or upgraded from other version?**Fresh
Description of the problem: we are creating transaction using vb.net in console application(using httplistener).so we want create multiple spans in single transaction in vb.net using httplistener. Also is there any other method to creating multiple span excluding httplistener?
we want create multiple spans in single transaction
You can do that, that's part of the Public Agent API , once you have an ITransaction instance you can just call either the StartSpan or the CaptureSpan function - each time you do this you'll capture a new span for your transaction. The CaptureSpan method receives a lambda, so you can basically just wrap any code into that method, the StartSpan gives you an ISpan instance that you need to end by calling .End() on it.
I also drafted a small sample for you - maybe that's helpful. I don't use HttpListener here, but it does not really change anything - instead of Sub Main you can do the same in the part where the incoming HTTP request is handled.
Imports System
Imports System.Threading
Module Program
Sub Main(args As String())
Dim transaction = Elastic.Apm.Agent.Tracer.StartTransaction("MyTransaction", "SampleTransaction")
'Start 1. span on the transaction:
Dim span1 = transaction.StartSpan("Span1", "SampleSpan")
'Execute code here which encapsulated into span1
'Start 2. span on the transaction:
Dim span2 = transaction.StartSpan("Span2", "SampleSpan")
'Execute code here which encapsulated into span2
'Start a subspan on span1
Dim span3 = span1.StartSpan("Span3", "SampleSpan")
'Execute code here which encapsulated into span3
'end all spans
span1.End()
span2.End()
span3.End()
'end the transaction
transaction.End()
'Make sure the process does not terminate before the agent sends all data
Thread.Sleep(15000)
End Sub
End Module
We did the same thing but kibana does not show the transaction and span. I think spans and transactions together are not getting captured in apm. Please help for this issue.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.