@@ -63,7 +63,7 @@ func NewOriginProxy(
6363// a simple roundtrip or a tcp/websocket dial depending on ingres rule setup.
6464func (p * Proxy ) ProxyHTTP (
6565 w connection.ResponseWriter ,
66- tr * tracing.TracedHTTPRequest ,
66+ tr * tracing.TracedRequest ,
6767 isWebsocket bool ,
6868) error {
6969 incrementRequests ()
@@ -108,7 +108,7 @@ func (p *Proxy) ProxyHTTP(
108108 }
109109
110110 rws := connection .NewHTTPResponseReadWriterAcker (w , req )
111- if err := p .proxyStream (tr . ToTracedContext (), rws , dest , originProxy ); err != nil {
111+ if err := p .proxyStream (req . Context (), rws , dest , originProxy ); err != nil {
112112 rule , srv := ruleField (p .ingressRules , ruleNum )
113113 p .logRequestError (err , cfRay , "" , rule , srv )
114114 return err
@@ -137,11 +137,9 @@ func (p *Proxy) ProxyTCP(
137137 serveCtx , cancel := context .WithCancel (ctx )
138138 defer cancel ()
139139
140- tracedCtx := tracing .NewTracedContext (serveCtx , req .CfTraceID , p .log )
141-
142140 p .log .Debug ().Str (LogFieldFlowID , req .FlowID ).Msg ("tcp proxy stream started" )
143141
144- if err := p .proxyStream (tracedCtx , rwa , req .Dest , p .warpRouting .Proxy ); err != nil {
142+ if err := p .proxyStream (serveCtx , rwa , req .Dest , p .warpRouting .Proxy ); err != nil {
145143 p .logRequestError (err , req .CFRay , req .FlowID , "" , ingress .ServiceWarpRouting )
146144 return err
147145 }
@@ -162,7 +160,7 @@ func ruleField(ing ingress.Ingress, ruleNum int) (ruleID string, srv string) {
162160// ProxyHTTPRequest proxies requests of underlying type http and websocket to the origin service.
163161func (p * Proxy ) proxyHTTPRequest (
164162 w connection.ResponseWriter ,
165- tr * tracing.TracedHTTPRequest ,
163+ tr * tracing.TracedRequest ,
166164 httpService ingress.HTTPOriginProxy ,
167165 isWebsocket bool ,
168166 disableChunkedEncoding bool ,
@@ -213,7 +211,7 @@ func (p *Proxy) proxyHTTPRequest(
213211 }
214212
215213 // Add spans to response header (if available)
216- tr .AddSpans (resp .Header )
214+ tr .AddSpans (resp .Header , p . log )
217215
218216 err = w .WriteRespHeaders (resp .StatusCode , resp .Header )
219217 if err != nil {
@@ -250,23 +248,17 @@ func (p *Proxy) proxyHTTPRequest(
250248// proxyStream proxies type TCP and other underlying types if the connection is defined as a stream oriented
251249// ingress rule.
252250func (p * Proxy ) proxyStream (
253- tr * tracing. TracedContext ,
251+ ctx context. Context ,
254252 rwa connection.ReadWriteAcker ,
255253 dest string ,
256254 connectionProxy ingress.StreamBasedOriginProxy ,
257255) error {
258- ctx := tr .Context
259- _ , connectSpan := tr .Tracer ().Start (ctx , "stream_connect" )
260256 originConn , err := connectionProxy .EstablishConnection (ctx , dest )
261257 if err != nil {
262- tracing .EndWithErrorStatus (connectSpan , err )
263258 return err
264259 }
265- connectSpan .End ()
266-
267- encodedSpans := tr .GetSpans ()
268260
269- if err := rwa .AckConnection (encodedSpans ); err != nil {
261+ if err := rwa .AckConnection (); err != nil {
270262 return err
271263 }
272264
0 commit comments