Skip to content

Commit cc0290a

Browse files
committed
Support py2 + py3 queue (versus Queue)
1 parent 6bedf12 commit cc0290a

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

instana/recorder.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,22 @@
44
import opentracing.ext.tags as ext
55
import socket
66
import instana.span as sd
7-
import Queue
87
import time
98
import os
109

10+
import sys
11+
if sys.version_info.major is 2:
12+
import Queue as queue
13+
else:
14+
import queue
15+
1116

1217
class InstanaRecorder(SpanRecorder):
1318
sensor = None
1419
registered_spans = ("django", "memcache", "rpc-client", "rpc-server")
1520
entry_kind = ["entry", "server", "consumer"]
1621
exit_kind = ["exit", "client", "producer"]
17-
queue = Queue.Queue()
22+
queue = queue.Queue()
1823

1924
def __init__(self, sensor):
2025
super(InstanaRecorder, self).__init__()
@@ -46,7 +51,7 @@ def queued_spans(self):
4651
while True:
4752
try:
4853
s = self.queue.get(False)
49-
except Queue.Empty:
54+
except queue.Empty:
5055
break
5156
else:
5257
spans.append(s)

0 commit comments

Comments
 (0)