Skip to content

Update Jaeger exporter status code #1488

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jan 7, 2021
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,18 @@ def _translate_to_jaeger(spans: Span):
tags = _extract_tags(span.attributes)
tags.extend(_extract_tags(span.resource.attributes))

tags.extend(
[
_get_long_tag("status.code", status.status_code.value),
_get_string_tag("status.message", status.description),
_get_string_tag("span.kind", OTLP_JAEGER_SPAN_KIND[span.kind]),
]
if status.status_code is not StatusCode.UNSET:
tags.append(
_get_string_tag("otel.status_code", status.status_code.name)
)
if status.description is not None:
tags.append(
_get_string_tag(
"otel.status_description", status.description
)
)
tags.append(
_get_string_tag("span.kind", OTLP_JAEGER_SPAN_KIND[span.kind]),
)

if span.instrumentation_info is not None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,14 +216,6 @@ def test_translate_to_jaeger(self):
)

default_tags = [
jaeger.Tag(
key="status.code",
vType=jaeger.TagType.LONG,
vLong=StatusCode.UNSET.value,
),
jaeger.Tag(
key="status.message", vType=jaeger.TagType.STRING, vStr=None
),
jaeger.Tag(
key="span.kind", vType=jaeger.TagType.STRING, vStr="internal",
),
Expand Down Expand Up @@ -310,12 +302,12 @@ def test_translate_to_jaeger(self):
vStr="some_resource",
),
jaeger.Tag(
key="status.code",
vType=jaeger.TagType.LONG,
vLong=StatusCode.ERROR.value,
key="otel.status_code",
vType=jaeger.TagType.STRING,
vStr="ERROR",
),
jaeger.Tag(
key="status.message",
key="otel.status_description",
vType=jaeger.TagType.STRING,
vStr="Example description",
),
Expand Down Expand Up @@ -386,12 +378,12 @@ def test_translate_to_jaeger(self):
flags=0,
tags=[
jaeger.Tag(
key="status.code",
vType=jaeger.TagType.LONG,
vLong=StatusCode.OK.value,
key="otel.status_code",
vType=jaeger.TagType.STRING,
vStr="OK",
),
jaeger.Tag(
key="status.message",
key="otel.status_description",
vType=jaeger.TagType.STRING,
vStr="Example description",
),
Expand Down