Documentation ¶
Overview ¶
Package jaegertracing provides middleware to Opentracing using Jaeger.
Example: ``` package main import (
"github.com/labstack/echo-contrib/jaegertracing" "github.com/labstack/echo/v4"
)
func main() { e := echo.New() // Enable tracing middleware c := jaegertracing.New(e, nil) defer c.Close() e.Logger.Fatal(e.Start(":1323")) }
```
Index ¶
- Variables
- func CreateChildSpan(ctx echo.Context, name string) opentracing.Span
- func New(e *echo.Echo, skipper middleware.Skipper) io.Closer
- func NewTracedRequest(method string, url string, body io.Reader, span opentracing.Span) (*http.Request, error)
- func Trace(tracer opentracing.Tracer) echo.MiddlewareFunc
- func TraceFunction(ctx echo.Context, fn interface{}, params ...interface{}) (result []reflect.Value)
- func TraceWithConfig(config TraceConfig) echo.MiddlewareFunc
- type TraceConfig
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultTraceConfig is the default Trace middleware config. DefaultTraceConfig = TraceConfig{ Skipper: middleware.DefaultSkipper, // contains filtered or unexported fields } )
Functions ¶
func CreateChildSpan ¶
func CreateChildSpan(ctx echo.Context, name string) opentracing.Span
CreateChildSpan creates a new opentracing span adding tags for the span name and caller details. User must call defer `sp.Finish()`
func New ¶
func New(e *echo.Echo, skipper middleware.Skipper) io.Closer
New creates an Opentracing tracer and attaches it to Echo middleware. Returns Closer do be added to caller function as `defer closer.Close()`
func NewTracedRequest ¶
func NewTracedRequest(method string, url string, body io.Reader, span opentracing.Span) (*http.Request, error)
NewTracedRequest generates a new traced HTTP request with opentracing headers injected into it
func Trace ¶
func Trace(tracer opentracing.Tracer) echo.MiddlewareFunc
Trace returns a Trace middleware. Trace middleware traces http requests and reporting errors.
func TraceFunction ¶
func TraceFunction(ctx echo.Context, fn interface{}, params ...interface{}) (result []reflect.Value)
TraceFunction wraps funtion with opentracing span adding tags for the function name and caller details
func TraceWithConfig ¶
func TraceWithConfig(config TraceConfig) echo.MiddlewareFunc
TraceWithConfig returns a Trace middleware with config. See: `Trace()`.
Types ¶
type TraceConfig ¶
type TraceConfig struct { // Skipper defines a function to skip middleware. Skipper middleware.Skipper // OpenTracing Tracer instance which should be got before Tracer opentracing.Tracer // contains filtered or unexported fields }
TraceConfig defines the config for Trace middleware.