Documentation
¶
Index ¶
- func ExtractAttrsFromReq(r *http.Request) []attribute.KeyValue
- func SpanPostProcessing(ctx context.Context, rww *ResponseWriterWrapper, rbw *RequestBodyWrapper)
- func StartSpan(r *http.Request, attrs []attribute.KeyValue) (ctx context.Context, end func(error))
- type Measure
- type RequestBodyWrapper
- type ResponseWriterWrapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractAttrsFromReq ¶
ExtractAttrsFromReq extracts OTEL attributes from the request. NOTE: In order to simplify the impl, we are assuming that the request is non-nil and always used with go-chi.
func SpanPostProcessing ¶
func SpanPostProcessing(ctx context.Context, rww *ResponseWriterWrapper, rbw *RequestBodyWrapper)
SpanPostProcessing adds post-processing attributes to the span
Types ¶
type Measure ¶
type Measure struct {
// contains filtered or unexported fields
}
Measure measures server's inbound HTTP call performance
func (*Measure) MeasurePostProcessing ¶
func (m *Measure) MeasurePostProcessing( ctx context.Context, rww *ResponseWriterWrapper, rbw *RequestBodyWrapper, elapsedTime time.Duration, attrs []attribute.KeyValue, )
MeasurePostProcessing records post processing metrics TODO: Why does this have to be a pointer?
type RequestBodyWrapper ¶
type RequestBodyWrapper struct { io.ReadCloser Ctx context.Context // contains filtered or unexported fields }
type ResponseWriterWrapper ¶
type ResponseWriterWrapper struct { http.ResponseWriter Ctx context.Context // contains filtered or unexported fields }
ResponseWriterWrapper is a wrapper around http.ResponseWriter to help with OTEL instrumentation
func (*ResponseWriterWrapper) Write ¶
func (w *ResponseWriterWrapper) Write(p []byte) (int, error)
Write satisfies the interface and records the status code
func (*ResponseWriterWrapper) WriteHeader ¶
func (w *ResponseWriterWrapper) WriteHeader(statusCode int)
WriteHeader satisfies the interface and records the status code
Click to show internal directories.
Click to hide internal directories.