github.com/vseinstrumentiru/lego@v1.0.2/internal/lego/monitor/propagation/http.go (about)

     1  package propagation
     2  
     3  import (
     4  	"go.opencensus.io/trace"
     5  	"go.opencensus.io/trace/propagation"
     6  	"net/http"
     7  )
     8  
     9  var DefaultHTTPFormat propagation.HTTPFormat
    10  
    11  type HTTPFormatCollection []propagation.HTTPFormat
    12  
    13  func (c HTTPFormatCollection) SpanContextFromRequest(req *http.Request) (sc trace.SpanContext, ok bool) {
    14  	for _, f := range c {
    15  		if sc, ok := f.SpanContextFromRequest(req); ok {
    16  			return sc, ok
    17  		}
    18  	}
    19  
    20  	return trace.SpanContext{}, false
    21  }
    22  
    23  func (c HTTPFormatCollection) SpanContextToRequest(sc trace.SpanContext, req *http.Request) {
    24  	for _, f := range c {
    25  		f.SpanContextToRequest(sc, req)
    26  	}
    27  }