Skip to content

Commit bbd9ad3

Browse files
return nil ocStatus when only message is provided
1 parent 5acb4a0 commit bbd9ad3

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

translator/trace/zipkin/status_code.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func (m *statusMapper) ocStatus() *tracepb.Status {
7474
}
7575
}
7676

77-
if s.codePtr != nil || s.message != "" {
77+
if s.codePtr != nil {
7878
code := int32(0)
7979
if s.codePtr != nil {
8080
code = *s.codePtr

translator/trace/zipkin/status_code_test.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,14 @@ func TestStatusCodeMapperCases(t *testing.T) {
116116
},
117117
},
118118

119+
{
120+
name: "http: message only, nil",
121+
expected: nil,
122+
attributes: map[string]string{
123+
"http.status_message": "something",
124+
},
125+
},
126+
119127
{
120128
name: "http: 500",
121129
expected: &tracepb.Status{Code: 13, Message: "a message"},
@@ -161,8 +169,8 @@ func TestStatusCodeMapperCases(t *testing.T) {
161169
},
162170

163171
{
164-
name: "oc: description only, status ok",
165-
expected: &tracepb.Status{Code: 0, Message: "a description"},
172+
name: "oc: description only, no status",
173+
expected: nil,
166174
attributes: map[string]string{
167175
"opencensus.status_description": "a description",
168176
},

0 commit comments

Comments
 (0)