Skip to content

Commit

Permalink
Add support for OTLP over HTTP/protobuf (honeycombio#279)
Browse files Browse the repository at this point in the history
Adds support for ingesting OTLP requests over HTTP with protobuf data. Changs in this PR:

- Move the existing gRPC export handler and helpers to to otlp_trace.go and tests into otlp_trace_test.go
- Add HTTP handler postOTLP that retrieves honeycomb headers, decodes the request body into a OTLP
- ExportTraceRequest and hands to internal function to process request
- Update OTLP grpc Export handler to retrieve honeycomb headers from metadata and hand request to new internal function to process
- Adds tests to verify rejection behaviour for non-protobuf based requests to postOTLP and test to pass request to postOTLP handler endpoint
  • Loading branch information
MikeGoldsmith authored Jul 14, 2021
1 parent 65f4f0a commit 2deb01c
Show file tree
Hide file tree
Showing 5 changed files with 760 additions and 479 deletions.
1 change: 1 addition & 0 deletions route/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ var (
ErrUpstreamUnavailable = handlerError{nil, "upstream target unavailable", http.StatusServiceUnavailable, true, true}
ErrReqToEvent = handlerError{nil, "failed to parse event", http.StatusBadRequest, false, true}
ErrBatchToEvent = handlerError{nil, "failed to parse event within batch", http.StatusBadRequest, false, true}
ErrInvalidContentType = handlerError{nil, "invalid content-type - only 'application/protobuf' is supported", http.StatusNotImplemented, false, true}
)

func (r *Router) handlerReturnWithError(w http.ResponseWriter, he handlerError, err error) {
Expand Down
Loading

0 comments on commit 2deb01c

Please sign in to comment.