Skip to content
This repository was archived by the owner on Jul 31, 2023. It is now read-only.

Commit d851005

Browse files
lonnbladrghetia
authored andcommitted
Added handling of HTTP code 409 when parsing trace status in ochttp (#1190)
* Added handling of HTTP code 409 when parsing trace status on OCHTTP * Reverted the change of stats/view/aggregation_data.go and stats/view/view_to_metric_test.go
1 parent 643eada commit d851005

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ require (
88
golang.org/x/net v0.0.0-20190620200207-3b0461eec859
99
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd // indirect
1010
golang.org/x/text v0.3.2 // indirect
11-
google.golang.org/appengine v1.4.0 // indirect
1211
google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb // indirect
1312
google.golang.org/grpc v1.20.1
1413
)

go.sum

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZi
6767
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
6868
google.golang.org/grpc v1.20.1 h1:Hz2g2wirWK7H0qIIhGIqRGTuMwTE8HEKFnDZZ7lm9NU=
6969
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
70+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
7071
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
7172
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
7273
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

plugin/ochttp/trace.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,10 @@ func TraceStatus(httpStatusCode int, statusLine string) trace.Status {
204204
code = trace.StatusCodeUnavailable
205205
case http.StatusOK:
206206
code = trace.StatusCodeOK
207+
case http.StatusConflict:
208+
code = trace.StatusCodeAlreadyExists
207209
}
210+
208211
return trace.Status{Code: code, Message: codeToStr[code]}
209212
}
210213

plugin/ochttp/trace_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,10 @@ func TestStatusUnitTest(t *testing.T) {
677677
{403, trace.Status{Code: trace.StatusCodePermissionDenied, Message: `PERMISSION_DENIED`}},
678678
{301, trace.Status{Code: trace.StatusCodeOK, Message: `OK`}},
679679
{501, trace.Status{Code: trace.StatusCodeUnimplemented, Message: `UNIMPLEMENTED`}},
680+
{409, trace.Status{Code: trace.StatusCodeAlreadyExists, Message: `ALREADY_EXISTS`}},
681+
{429, trace.Status{Code: trace.StatusCodeResourceExhausted, Message: `RESOURCE_EXHAUSTED`}},
682+
{503, trace.Status{Code: trace.StatusCodeUnavailable, Message: `UNAVAILABLE`}},
683+
{504, trace.Status{Code: trace.StatusCodeDeadlineExceeded, Message: `DEADLINE_EXCEEDED`}},
680684
}
681685

682686
for _, tt := range tests {

0 commit comments

Comments
 (0)