Skip to content

Commit

Permalink
ext/jaeger: export span kind (#387)
Browse files Browse the repository at this point in the history
Encode the span kind as a "span.kind" tag.
  • Loading branch information
mauriciovasquezbernal authored Jan 30, 2020
1 parent 31f5726 commit 682ecc2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions ext/opentelemetry-ext-jaeger/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Unreleased

- Export span status ([#367](https://github.com/open-telemetry/opentelemetry-python/pull/367))
- Export span kind ([#387](https://github.com/open-telemetry/opentelemetry-python/pull/387))

## 0.3a0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ def _translate_to_jaeger(spans: Span):
[
_get_long_tag("status.code", status.canonical_code.value),
_get_string_tag("status.message", status.description),
_get_string_tag("span.kind", span.kind.name),
]
)

Expand Down
17 changes: 14 additions & 3 deletions ext/opentelemetry-ext-jaeger/tests/test_jaeger_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def test_translate_to_jaeger(self):
context=other_context, attributes=link_attributes
)

default_status_tags = [
default_tags = [
jaeger.Tag(
key="status.code",
vType=jaeger.TagType.LONG,
Expand All @@ -165,6 +165,11 @@ def test_translate_to_jaeger(self):
jaeger.Tag(
key="status.message", vType=jaeger.TagType.STRING, vStr=None,
),
jaeger.Tag(
key="span.kind",
vType=jaeger.TagType.STRING,
vStr=trace_api.SpanKind.INTERNAL.name,
),
]

otel_spans = [
Expand All @@ -174,6 +179,7 @@ def test_translate_to_jaeger(self):
parent=parent_context,
events=(event,),
links=(link,),
kind=trace_api.SpanKind.CLIENT,
),
trace.Span(
name=span_names[1], context=parent_context, parent=None
Expand Down Expand Up @@ -234,6 +240,11 @@ def test_translate_to_jaeger(self):
vType=jaeger.TagType.STRING,
vStr="Example description",
),
jaeger.Tag(
key="span.kind",
vType=jaeger.TagType.STRING,
vStr=trace_api.SpanKind.CLIENT.name,
),
jaeger.Tag(
key="error", vType=jaeger.TagType.BOOL, vBool=True,
),
Expand Down Expand Up @@ -283,7 +294,7 @@ def test_translate_to_jaeger(self):
startTime=start_times[1] // 10 ** 3,
duration=durations[1] // 10 ** 3,
flags=0,
tags=default_status_tags,
tags=default_tags,
),
jaeger.Span(
operationName=span_names[2],
Expand All @@ -294,7 +305,7 @@ def test_translate_to_jaeger(self):
startTime=start_times[2] // 10 ** 3,
duration=durations[2] // 10 ** 3,
flags=0,
tags=default_status_tags,
tags=default_tags,
),
]

Expand Down

0 comments on commit 682ecc2

Please sign in to comment.