MCPcopy Create free account
hub / github.com/zalando/skipper / loopbackInternal

Method loopbackInternal

proxy/context.go:326–355  ·  view source on GitHub ↗
(discardResponse bool)

Source from the content-addressed store, hash-verified

324}
325
326func (c *context) loopbackInternal(discardResponse bool) {
327 loopSpan := c.tracer.StartSpan(c.proxy.tracing.initialOperationName, opentracing.ChildOf(c.parentSpan.Context()))
328 defer loopSpan.Finish()
329 err := c.proxy.do(c, loopSpan)
330 if discardResponse && c.response != nil && c.response.Body != nil {
331 if _, err := io.Copy(io.Discard, c.response.Body); err != nil {
332 c.Logger().Errorf("context: error while discarding remainder response body: %v.", err)
333 }
334 err := c.response.Body.Close()
335 if err != nil {
336 c.Logger().Errorf("context: error during closing the response body: %v", err)
337 }
338
339 // span tag `shadow: true` should only be set if the response is discarded
340 c.proxy.tracing.setTag(c.proxySpan, "shadow", "true")
341 }
342
343 if c.proxySpan != nil {
344 c.proxySpan.Finish()
345 }
346
347 perr, ok := err.(*proxyError)
348 if ok && perr.handled {
349 return
350 }
351
352 if err != nil {
353 c.Logger().Errorf("context: failed to execute loopback request: %v", err)
354 }
355}
356
357func (m *filterMetrics) IncCounter(key string) {
358 m.impl.IncCounter(m.prefix + key)

Callers 2

LoopbackMethod · 0.95
LoopbackWithResponseMethod · 0.95

Calls 9

LoggerMethod · 0.95
ContextMethod · 0.80
FinishMethod · 0.80
doMethod · 0.80
ErrorfMethod · 0.65
CloseMethod · 0.65
StartSpanMethod · 0.45
CopyMethod · 0.45
setTagMethod · 0.45

Tested by

no test coverage detected