Skip to content

Commit 8124258

Browse files
committed
lint fix
1 parent c7a802d commit 8124258

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

caddyconfig/httploader.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ import (
2525
"os"
2626
"time"
2727

28-
"github.com/caddyserver/caddy/v2"
2928
"go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace"
3029
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
30+
31+
"github.com/caddyserver/caddy/v2"
3132
)
3233

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

103104
// ctx, span := tr.Start(ctx, "httploader")
104105
// defer span.End()
105-
106+
106107
url := repl.ReplaceAll(hl.URL, "")
107108
req, err := http.NewRequestWithContext(ctx, method, url, nil)
108109
if err != nil {

modules/caddyhttp/reverseproxy/healthchecks.go

+10-2
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@ import (
2020
"io"
2121
"net"
2222
"net/http"
23+
"net/http/httptrace"
2324
"net/url"
2425
"regexp"
2526
"runtime/debug"
2627
"strconv"
2728
"time"
2829

30+
"go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace"
31+
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
2932
"go.opentelemetry.io/otel"
3033
"go.uber.org/zap"
3134

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

173176
a.httpClient = &http.Client{
174-
Timeout: timeout,
175-
Transport: h.Transport,
177+
Timeout: timeout,
178+
Transport: otelhttp.NewTransport(
179+
h.Transport,
180+
otelhttp.WithClientTrace(func(ctx context.Context) *httptrace.ClientTrace {
181+
return otelhttptrace.NewClientTrace(ctx)
182+
}),
183+
),
176184
CheckRedirect: func(req *http.Request, via []*http.Request) error {
177185
if !a.FollowRedirects {
178186
return http.ErrUseLastResponse

0 commit comments

Comments
 (0)