Documentation ¶
Index ¶
- Variables
- func AddDynamicTags(context *echo.Context, tags map[string]interface{})
- func GetTracingHeadersToInjectFromContext(context echo.Context) map[string]string
- func GetTracingHeadersToInjectFromSpan(tracer opentracing.Tracer, serverSpan opentracing.Span) map[string]string
- func InitTracer(cfg Config) error
- func InjectTracerHTTP(tracer opentracing.Tracer, serverSpan opentracing.Span, httpReq *http.Request) error
- func StartTraceSpan(c echo.Context, appSpecificOperationName string, tags map[string]string) (opentracing.Span, string)
- func TracingHandler(next echo.HandlerFunc) echo.HandlerFunc
- type Config
- type SpanLogger
- func (wavefrontLogger *SpanLogger) Fatal(v ...interface{})
- func (wavefrontLogger *SpanLogger) Fatalf(format string, v ...interface{})
- func (wavefrontLogger *SpanLogger) Fatalln(v ...interface{})
- func (wavefrontLogger *SpanLogger) Flags() int
- func (wavefrontLogger *SpanLogger) Output(calldepth int, s string) error
- func (wavefrontLogger *SpanLogger) Panic(v ...interface{})
- func (wavefrontLogger *SpanLogger) Panicf(format string, v ...interface{})
- func (wavefrontLogger *SpanLogger) Panicln(v ...interface{})
- func (wavefrontLogger *SpanLogger) Prefix() string
- func (wavefrontLogger *SpanLogger) Print(v ...interface{})
- func (wavefrontLogger *SpanLogger) Printf(format string, v ...interface{})
- func (wavefrontLogger *SpanLogger) Println(v ...interface{})
- func (wavefrontLogger *SpanLogger) SetFlags(flag int)
- func (wavefrontLogger *SpanLogger) SetOutput(w io.Writer)
- func (wavefrontLogger *SpanLogger) SetPrefix(prefix string)
- type Writer
Constants ¶
This section is empty.
Variables ¶
var Tracer opentracing.Tracer
Tracer Global Tracer
Functions ¶
func AddDynamicTags ¶
AddDynamicTags injects the dyanmic tags to the span
func GetTracingHeadersToInjectFromContext ¶
GetTracingHeadersToInjectFromContext returns the headers which Should be added to the request to inject from the echo context To be used when using middleware
func GetTracingHeadersToInjectFromSpan ¶
func GetTracingHeadersToInjectFromSpan(tracer opentracing.Tracer, serverSpan opentracing.Span) map[string]string
GetTracingHeadersToInjectFromSpan returns the headers which Should be added to the request to inject from the current span. To be used when manually starting span inside process
func InitTracer ¶
InitTracer initialize tracer object, initialize the GlobalTracer with this newly created, tracer object. Call utils/wavefront.Tracer to access the tracer object For proxy sender send token as empty string
func InjectTracerHTTP ¶
func InjectTracerHTTP(tracer opentracing.Tracer, serverSpan opentracing.Span, httpReq *http.Request) error
InjectTracerHTTP injects the current span into the trace. By Adding the context of the current span to the headers of the Http request.
func StartTraceSpan ¶
func StartTraceSpan(c echo.Context, appSpecificOperationName string, tags map[string]string) (opentracing.Span, string)
StartTraceSpan looks for existing context from the headers of the request. If context is found, it starts a child span to the parent span, Else it starts a root span. Tags are added to the respective spans created. If parent span exists parent span id is returned along with child span otherwise root span and "" is returned
func TracingHandler ¶
func TracingHandler(next echo.HandlerFunc) echo.HandlerFunc
TracingHandler custom echoWeb middleware. Enables tracing for the routes defined in tracer-config.go. Injects respective tags for each route defined in the span of each trace.
Types ¶
type Config ¶
type Config struct { DirectCfg *senders.DirectConfiguration ProxyCfg *senders.ProxyConfiguration CfgFile string RoutesFile string EchoWeb *echo.Echo }
Config stores the middleware config
type SpanLogger ¶
type SpanLogger struct {
// contains filtered or unexported fields
}
SpanLogger custom implementation of Go standard Logger Exposes the same functions as Standard Logger
func NewSpanLogger ¶
func NewSpanLogger(context echo.Context) *SpanLogger
NewSpanLogger returns a new custom logger instance with TraceId and SpanId injected. It exposes the same functions as the standard Golang Logger, with added function of injecting span info info to the logs. And sending span logs to wavefront.
func (*SpanLogger) Fatal ¶
func (wavefrontLogger *SpanLogger) Fatal(v ...interface{})
Fatal is equivalent to Print() followed by a call to os.Exit(1). Sends the log object to wavefront.
func (*SpanLogger) Fatalf ¶
func (wavefrontLogger *SpanLogger) Fatalf(format string, v ...interface{})
Fatalf is equivalent to Printf() followed by a call to os.Exit(1). Sends the log object to wavefront.
func (*SpanLogger) Fatalln ¶
func (wavefrontLogger *SpanLogger) Fatalln(v ...interface{})
Fatalln is equivalent to Println() followed by a call to os.Exit(1). Sends the log object to wavefront.
func (*SpanLogger) Flags ¶
func (wavefrontLogger *SpanLogger) Flags() int
Flags returns the output flags for the logger.
func (*SpanLogger) Output ¶
func (wavefrontLogger *SpanLogger) Output(calldepth int, s string) error
Output writes the output for a logging event. The string s contains the text to print after the prefix specified by the flags of the Logger. A newline is appended if the last character of s is not already a newline. Calldepth is the count of the number of frames to skip when computing the file name and line number if Llongfile or Lshortfile is set; a value of 1 will print the details for the caller of Output.
func (*SpanLogger) Panic ¶
func (wavefrontLogger *SpanLogger) Panic(v ...interface{})
Panic is equivalent to Print() followed by a call to panic(). Sends the log object to wavefront.
func (*SpanLogger) Panicf ¶
func (wavefrontLogger *SpanLogger) Panicf(format string, v ...interface{})
Panicf is equivalent to Printf() followed by a call to panic(). Sends the log object to wavefront.
func (*SpanLogger) Panicln ¶
func (wavefrontLogger *SpanLogger) Panicln(v ...interface{})
Panicln is equivalent to Println() followed by a call to panic(). Sends the log object to wavefront.
func (*SpanLogger) Prefix ¶
func (wavefrontLogger *SpanLogger) Prefix() string
Prefix returns the output prefix for the logger.
func (*SpanLogger) Print ¶
func (wavefrontLogger *SpanLogger) Print(v ...interface{})
Print formats using the default formats for its operands and writes to standard output. Spaces are added between operands when neither is a string. It returns the number of bytes written and any write error encountered. Sends the log object to wavefront.
func (*SpanLogger) Printf ¶
func (wavefrontLogger *SpanLogger) Printf(format string, v ...interface{})
Printf formats according to a format specifier and writes to standard output. It returns the number of bytes written and any write error encountered. Sends the log object to wavefront.
func (*SpanLogger) Println ¶
func (wavefrontLogger *SpanLogger) Println(v ...interface{})
Println formats using the default formats for its operands and writes to standard output. Spaces are always added between operands and a newline is appended. It returns the number of bytes written and any write error encountered. Sends the log object to wavefront.
func (*SpanLogger) SetFlags ¶
func (wavefrontLogger *SpanLogger) SetFlags(flag int)
SetFlags sets the output flags for the logger.
func (*SpanLogger) SetOutput ¶
func (wavefrontLogger *SpanLogger) SetOutput(w io.Writer)
SetOutput sets the output destination for the logger.
func (*SpanLogger) SetPrefix ¶
func (wavefrontLogger *SpanLogger) SetPrefix(prefix string)
SetPrefix sets the output prefix in addition to trace Prefix for the logger.