File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
exporters/aws-otel-otlp-udp-exporter/validation-app Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 6
6
from opentelemetry .sdk .trace .export import BatchSpanProcessor
7
7
from amazon .opentelemetry .exporters .otlp .udp import OTLPUdpSpanExporter
8
8
9
+
9
10
# Set up a UDP server to verify data is sent
10
11
def udp_server ():
11
12
sock = socket .socket (socket .AF_INET , socket .SOCK_DGRAM )
12
- sock .bind ((' 127.0.0.1' , 2000 ))
13
+ sock .bind ((" 127.0.0.1" , 2000 ))
13
14
sock .settimeout (5 )
14
15
print ("UDP server listening on 127.0.0.1:2000" )
15
16
try :
@@ -24,6 +25,7 @@ def udp_server():
24
25
finally :
25
26
sock .close ()
26
27
28
+
27
29
# Start UDP server in a separate thread
28
30
server_thread = threading .Thread (target = udp_server )
29
31
server_thread .daemon = True
@@ -44,7 +46,7 @@ def udp_server():
44
46
parent .set_attribute ("service.name" , "validation-app" )
45
47
parent .set_attribute ("test.attribute" , "test_value" )
46
48
parent .add_event ("test-event" , {"event.data" : "some data" })
47
-
49
+
48
50
# Add a child span
49
51
with tracer .start_as_current_span ("test_child_span" ) as child :
50
52
child .set_attribute ("child.attribute" , "child_value" )
You can’t perform that action at this time.
0 commit comments