Skip to content

Commit c085d9f

Browse files
committed
test trace id for validation app
1 parent 1b13ee7 commit c085d9f

File tree

1 file changed

+5
-0
lines changed
  • exporters/aws-otel-otlp-udp-exporter/validation-app

1 file changed

+5
-0
lines changed

exporters/aws-otel-otlp-udp-exporter/validation-app/app.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ def udp_server():
4141
# Create a span for testing with various attributes
4242
tracer = trace.get_tracer(__name__)
4343
with tracer.start_as_current_span("test_parent_span") as parent:
44+
span_context = parent.get_span_context()
45+
trace_id = span_context.trace_id
46+
xray_trace_id = f"1-{format(trace_id, '032x')[0:8]}-{format(trace_id, '032x')[8:32]}"
47+
print(f"X-Ray Trace ID: {xray_trace_id}")
48+
4449
parent.set_attribute("service.name", "validation-app")
4550
parent.set_attribute("test.attribute", "test_value")
4651
parent.add_event("test-event", {"event.data": "some data"})

0 commit comments

Comments
 (0)