File tree Expand file tree Collapse file tree 3 files changed +27
-5
lines changed Expand file tree Collapse file tree 3 files changed +27
-5
lines changed Original file line number Diff line number Diff line change 11import os
2- import sys
3- sys . path . append ( "/Users/pglombardo/Projects/ instana/python-sensor" )
2+ import opentracing
3+ import instana . tracer
44os .environ ["INSTANA_TEST" ] = "true"
5+
6+ opentracing .global_tracer = instana .tracer .InstanaTracer ()
Original file line number Diff line number Diff line change 44from nose .tools import assert_equals
55
66
7- def test_span_basics ():
8- opentracing .global_tracer = instana .tracer .InstanaTracer ()
7+ def test_span_interface ():
98 span = opentracing .global_tracer .start_span ("blah" )
109 assert hasattr (span , "finish" )
1110 assert hasattr (span , "set_tag" )
@@ -15,3 +14,25 @@ def test_span_basics():
1514 assert hasattr (span , "get_baggage_item" )
1615 assert hasattr (span , "context" )
1716 assert hasattr (span , "log" )
17+
18+
19+ def test_span_ids ():
20+ count = 0
21+ while count <= 1000 :
22+ count += 1
23+ span = opentracing .global_tracer .start_span ("test_span_ids" )
24+ context = span .context
25+ assert - 9223372036854775808 <= context .span_id <= 9223372036854775807
26+ assert - 9223372036854775808 <= context .trace_id <= 9223372036854775807
27+
28+
29+ def test_span_fields ():
30+ span = opentracing .global_tracer .start_span ("mycustom" )
31+ assert_equals ("mycustom" , span .operation_name )
32+ assert span .context
33+
34+ span .set_tag ("tagone" , "string" )
35+ span .set_tag ("tagtwo" , 150 )
36+
37+ assert_equals ("string" , span .tags ['tagone' ])
38+ assert_equals (150 , span .tags ['tagtwo' ])
Original file line number Diff line number Diff line change 55
66def test_tracer_basics ():
77 assert hasattr (instana .tracer , 'InstanaTracer' )
8- opentracing .global_tracer = instana .tracer .InstanaTracer ()
98 assert hasattr (opentracing .global_tracer , "start_span" )
109 assert hasattr (opentracing .global_tracer , "inject" )
1110 assert hasattr (opentracing .global_tracer , "extract" )
You can’t perform that action at this time.
0 commit comments