Documentation ¶
Overview ¶
Package trace implements a OpenTelemetry middleware for labstack/echo.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultConfig = Config{ Skipper: middleware.DefaultSkipper, ComponentName: defaultComponentName, DumpBodies: false, LimitBodySize: defaultBodyLimit, }
Functions ¶
func WithConfig ¶
func WithConfig(config Config) echo.MiddlewareFunc
trunk-ignore(golangci-lint/cyclop)
Types ¶
type Config ¶
type Config struct { // Skipper defines a function to skip middleware. Skipper middleware.Skipper // Tracer is the default tracer that should be used. // If empty, a new tracer is retrieved using otel.Tracer("") Tracer trace.Tracer // ComponentName used for describing the tracing component. ComponentName string // DumpBodies should be set to true if the request and response // bodies should be dumped to spans. DumpBodies bool // LimitBodySize holds the maximum number of bytes that are appended to // a span. LimitBodySize int }
type ResponseRecorder ¶
type ResponseRecorder struct { http.ResponseWriter // contains filtered or unexported fields }
ResponseRecorder can record a labstack/echo response body.
func NewResponseRecorder ¶
func NewResponseRecorder(resp *echo.Response) *ResponseRecorder
New ResponseRecorder returns a new response recorder that stores the body written to resp.
func (*ResponseRecorder) GetResponse ¶
func (d *ResponseRecorder) GetResponse() string
GetResponse returns the response recorded in d.
Click to show internal directories.
Click to hide internal directories.