Skip to content

Commit

Permalink
Rename gRPC to HTTP adapter
Browse files Browse the repository at this point in the history
Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
  • Loading branch information
jpkrohling committed May 22, 2023
1 parent 046b5dd commit a0e7a4a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions receiver/otlpreceiver/erroradapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@ import (
"google.golang.org/grpc/status"
)

func toHTTP(s *status.Status) int {
func gRPCToHTTP(s *status.Status) int {
switch s.Code() {
case codes.Aborted:
return http.StatusInternalServerError
case codes.AlreadyExists:
return http.StatusConflict
case codes.Canceled:
return http.StatusInternalServerError
case codes.DataLoss:
case codes.Canceled, codes.DataLoss:
return http.StatusInternalServerError
case codes.DeadlineExceeded:
return http.StatusRequestTimeout
Expand Down
2 changes: 1 addition & 1 deletion receiver/otlpreceiver/otlphttp.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func handleTraces(resp http.ResponseWriter, req *http.Request, tracesReceiver *t

// perhaps we had a gRPC exporter for this data returning an error?
if s, ok := status.FromError(err); ok {
httpStatus = toHTTP(s)
httpStatus = gRPCToHTTP(s)
}

// perhaps it was an HTTP exporter that failed?
Expand Down

0 comments on commit a0e7a4a

Please sign in to comment.