Skip to content

Commit

Permalink
support links
Browse files Browse the repository at this point in the history
  • Loading branch information
reyang committed Sep 27, 2019
1 parent 2de1d0f commit 2d435d9
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,22 @@ def span_to_envelope(self, span): # noqa pylint: disable=too-many-branches
data.resultCode = str(span.attributes["http.status_code"])
else: # SpanKind.INTERNAL
data.type = "InProc"
# TODO: links, tracestate, tags
for key in span.attributes:
data.properties[key] = span.attributes[key]
if span.links:
links = []
for link in span.links:
links.append(
{
"operation_Id": "{:032x}".format(
link.context.trace_id
),
"id": "|{:032x}.{:016x}.".format(
link.context.trace_id, link.context.span_id
),
}
)
data.properties["_MS.links"] = json.dumps(links)
print(data.properties["_MS.links"])
# TODO: tracestate, tags
return envelope

0 comments on commit 2d435d9

Please sign in to comment.