Skip to content

Commit

Permalink
lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
trajano committed Aug 10, 2024
1 parent c7a802d commit 8124258
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
5 changes: 3 additions & 2 deletions caddyconfig/httploader.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ import (
"os"
"time"

"github.com/caddyserver/caddy/v2"
"go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace"
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"

"github.com/caddyserver/caddy/v2"
)

func init() {
Expand Down Expand Up @@ -102,7 +103,7 @@ func (hl HTTPLoader) LoadConfig(ctx caddy.Context) ([]byte, error) {

// ctx, span := tr.Start(ctx, "httploader")
// defer span.End()

url := repl.ReplaceAll(hl.URL, "")
req, err := http.NewRequestWithContext(ctx, method, url, nil)
if err != nil {
Expand Down
12 changes: 10 additions & 2 deletions modules/caddyhttp/reverseproxy/healthchecks.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@ import (
"io"
"net"
"net/http"
"net/http/httptrace"
"net/url"
"regexp"
"runtime/debug"
"strconv"
"time"

"go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace"
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
"go.opentelemetry.io/otel"
"go.uber.org/zap"

Expand Down Expand Up @@ -171,8 +174,13 @@ func (a *ActiveHealthChecks) Provision(ctx caddy.Context, h *Handler) error {
}

a.httpClient = &http.Client{
Timeout: timeout,
Transport: h.Transport,
Timeout: timeout,
Transport: otelhttp.NewTransport(
h.Transport,
otelhttp.WithClientTrace(func(ctx context.Context) *httptrace.ClientTrace {
return otelhttptrace.NewClientTrace(ctx)
}),
),
CheckRedirect: func(req *http.Request, via []*http.Request) error {
if !a.FollowRedirects {
return http.ErrUseLastResponse
Expand Down

0 comments on commit 8124258

Please sign in to comment.