@@ -33,6 +33,7 @@ class InstanaRecorder(SpanRecorder):
3333
3434 entry_kind = ["entry" , "server" , "consumer" ]
3535 exit_kind = ["exit" , "client" , "producer" ]
36+
3637 queue = queue .Queue ()
3738
3839 def __init__ (self ):
@@ -208,11 +209,16 @@ def build_sdk_span(self, span):
208209 logs = self .collect_logs (span ))
209210
210211 sdk_data = SDKData (name = span .operation_name ,
211- custom = custom_data )
212+ custom = custom_data ,
213+ Type = self .get_span_kind_as_string (span ))
214+
215+ if "arguments" in span .tags :
216+ sdk_data .arguments = span .tags ["arguments" ]
212217
213- sdk_data .Type = self .get_span_kind (span )
214- data = Data (service = instana .singletons .agent .sensor .options .service_name ,
215- sdk = sdk_data )
218+ if "return" in span .tags :
219+ sdk_data .Return = span .tags ["return" ]
220+
221+ data = Data (service = instana .singletons .agent .sensor .options .service_name , sdk = sdk_data )
216222 entity_from = {'e' : instana .singletons .agent .from_ .pid ,
217223 'h' : instana .singletons .agent .from_ .agentUuid }
218224
@@ -222,6 +228,7 @@ def build_sdk_span(self, span):
222228 s = span .context .span_id ,
223229 ts = int (round (span .start_time * 1000 )),
224230 d = int (round (span .duration * 1000 )),
231+ k = self .get_span_kind_as_int (span ),
225232 n = "sdk" ,
226233 f = entity_from ,
227234 data = data )
@@ -246,16 +253,40 @@ def get_http_host_name(self, span):
246253
247254 return "localhost"
248255
249- def get_span_kind (self , span ):
250- kind = ""
256+ def get_span_kind_as_string (self , span ):
257+ """
258+ Will retrieve the `span.kind` tag and return the appropriate string value for the Instana backend or
259+ None if the tag is set to something we don't recognize.
260+
261+ :param span: The span to search for the `span.kind` tag
262+ :return: String
263+ """
264+ kind = None
251265 if "span.kind" in span .tags :
252266 if span .tags ["span.kind" ] in self .entry_kind :
253267 kind = "entry"
254268 elif span .tags ["span.kind" ] in self .exit_kind :
255269 kind = "exit"
256270 else :
257271 kind = "intermediate"
272+ return kind
258273
274+ def get_span_kind_as_int (self , span ):
275+ """
276+ Will retrieve the `span.kind` tag and return the appropriate integer value for the Instana backend or
277+ None if the tag is set to something we don't recognize.
278+
279+ :param span: The span to search for the `span.kind` tag
280+ :return: Integer
281+ """
282+ kind = None
283+ if "span.kind" in span .tags :
284+ if span .tags ["span.kind" ] in self .entry_kind :
285+ kind = 1
286+ elif span .tags ["span.kind" ] in self .exit_kind :
287+ kind = 2
288+ else :
289+ kind = 3
259290 return kind
260291
261292 def collect_logs (self , span ):
0 commit comments