1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2026-06-03 18:35:08 +02:00

Correct status transform in OTLP exporter (#2102)

* Correct status transform in OTLP exporter

* Add changes to changelog
This commit is contained in:
Tyler Yahn
2021-07-20 09:06:18 -07:00
committed by GitHub
parent 9b1a5f7001
commit 63dfe64aae
3 changed files with 10 additions and 2 deletions
+2
View File
@@ -29,6 +29,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- When using WithNewRoot, don't use the parent context for making sampling decisions. (#2032)
- `oteltest.Tracer` now creates a valid `SpanContext` when using `WithNewRoot`. (#2073)
- OS type detector now sets the correct `dragonflybsd` value for DragonFly BSD. (#2092)
- The OTel span status is correctly transformed into the OTLP status in the `go.opentelemetry.io/otel/exporters/otlp/otlptrace` package.
This fix will by default set the status to `Unset` if it is not explicitly set to `Ok` or `Error`. (#2099 #2102)
### Security
@@ -132,10 +132,12 @@ func span(sd tracesdk.ReadOnlySpan) *tracepb.Span {
func status(status codes.Code, message string) *tracepb.Status {
var c tracepb.Status_StatusCode
switch status {
case codes.Ok:
c = tracepb.Status_STATUS_CODE_OK
case codes.Error:
c = tracepb.Status_STATUS_CODE_ERROR
default:
c = tracepb.Status_STATUS_CODE_OK
c = tracepb.Status_STATUS_CODE_UNSET
}
return &tracepb.Status{
Code: c,
@@ -169,7 +169,11 @@ func TestStatus(t *testing.T) {
{
codes.Unset,
"test Unset",
tracepb.Status_STATUS_CODE_OK,
tracepb.Status_STATUS_CODE_UNSET,
},
{
message: "default code is unset",
otlpStatus: tracepb.Status_STATUS_CODE_UNSET,
},
{
codes.Error,