Skip to content

Commit

Permalink
remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
refs committed Aug 18, 2021
1 parent 06fda51 commit 46f0d6f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
12 changes: 0 additions & 12 deletions proxy/pkg/middleware/accesslog.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package middleware

import (
"context"
"net/http"
"time"

Expand Down Expand Up @@ -31,14 +30,3 @@ func AccessLog(logger log.Logger) func(http.Handler) http.Handler {
})
}
}

// ExtractRequestID extracts the request ID from the context. Since we now use the go-chi middleware to write the request
// id, this is propagated using the context, therefore read it from there.
func ExtractRequestID(ctx context.Context) string {
var rid string
if v, ok := ctx.Value(chimiddleware.RequestIDKey).(string); ok {
rid = v
}

return rid
}
4 changes: 2 additions & 2 deletions proxy/pkg/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"strings"
"time"

"github.com/owncloud/ocis/proxy/pkg/middleware"
chimiddleware "github.com/go-chi/chi/middleware"

"go.opentelemetry.io/otel/attribute"

Expand Down Expand Up @@ -231,7 +231,7 @@ func (p *MultiHostReverseProxy) ServeHTTP(w http.ResponseWriter, r *http.Request
span.SetAttributes(
attribute.KeyValue{
Key: "x-request-id",
Value: attribute.StringValue(middleware.ExtractRequestID(r.Context())),
Value: attribute.StringValue(chimiddleware.GetReqID(r.Context())),
})

pkgtrace.Propagator.Inject(ctx, propagation.HeaderCarrier(r.Header))
Expand Down

0 comments on commit 46f0d6f

Please sign in to comment.