mirror of
https://github.com/caddyserver/caddy.git
synced 2025-11-11 00:56:56 -05:00
create otel transport in Provision
Signed-off-by: Mohammed Al Sahaf <msaa1990@gmail.com>
This commit is contained in:
parent
9dfc038d38
commit
e50e3ed93a
@ -257,6 +257,7 @@ func (h *Handler) Provision(ctx caddy.Context) error {
|
|||||||
if module, ok := h.Transport.(caddy.Module); ok && module.CaddyModule().ID.Name() == "fastcgi" && h.RequestBuffers == 0 {
|
if module, ok := h.Transport.(caddy.Module); ok && module.CaddyModule().ID.Name() == "fastcgi" && h.RequestBuffers == 0 {
|
||||||
h.RequestBuffers = 4096
|
h.RequestBuffers = 4096
|
||||||
}
|
}
|
||||||
|
h.Transport = otelhttp.NewTransport(h.Transport)
|
||||||
}
|
}
|
||||||
if h.LoadBalancing != nil && h.LoadBalancing.SelectionPolicyRaw != nil {
|
if h.LoadBalancing != nil && h.LoadBalancing.SelectionPolicyRaw != nil {
|
||||||
mod, err := ctx.LoadModule(h.LoadBalancing, "SelectionPolicyRaw")
|
mod, err := ctx.LoadModule(h.LoadBalancing, "SelectionPolicyRaw")
|
||||||
@ -867,8 +868,7 @@ func (h *Handler) reverseProxy(rw http.ResponseWriter, req *http.Request, origRe
|
|||||||
|
|
||||||
// do the round-trip
|
// do the round-trip
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
otelTransport := otelhttp.NewTransport(h.Transport)
|
res, err := h.Transport.RoundTrip(req)
|
||||||
res, err := otelTransport.RoundTrip(req)
|
|
||||||
duration := time.Since(start)
|
duration := time.Since(start)
|
||||||
|
|
||||||
// record that the round trip is done for the 1xx response handler
|
// record that the round trip is done for the 1xx response handler
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user