This repository was archived by the owner on Oct 29, 2021. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99# Create a remote appdash collector.
1010collector = appdash .RemoteCollectorFactory (reactor , debug = True )
1111
12+ # Create a trace.
13+ trace = appdash .SpanID (root = True )
1214
13- # TODO(slimsag): do not require direct usage of protobuf.
14- import appdash .collector_pb2 as wire
15-
16- # Send a few packets.
17- traceID = appdash .generateID ()
15+ # Generate a few spans with some annotations.
16+ span = trace
1817for i in range (0 , 7 ):
19- # Create a collect packet
20- p = wire .CollectPacket ()
21- p .spanid .trace = traceID
22- p .spanid .span = appdash .generateID ()
23- p .spanid .parent = 0
24-
25- # Annotation 1
26- a = p .annotation .add ()
27- a .key = "HTTPClient"
28- a .value = "/foo/bar?eq=1"
29-
30- # Annotation 2
31- a2 = p .annotation .add ()
32- a2 .key = "SQL"
33- a2 .value = "select * from table;"
34-
35- # Collect the packet.
36- collector .collect (p )
37-
18+ # Collect some annotations.
19+ a1 = appdash .Annotation (
20+ key = "HTTPClient" ,
21+ value = "/foo/bar?eq=1" ,
22+ )
23+ a2 = appdash .Annotation (
24+ key = "SQL" ,
25+ value = "select * from table;" ,
26+ )
27+ collector .collect (span , a1 , a2 )
28+
29+ # Create a new child span whose parent is the last span we created.
30+ span = appdash .SpanID (parent = span )
3831
3932# Have Twisted perform the connection and run.
4033reactor .connectTCP ("" , 7701 , collector )
You can’t perform that action at this time.
0 commit comments