Documentation ¶
Index ¶
- func AddSpanError(span trace.Span, err error)
- func AddSpanEvents(span trace.Span, name string, events map[string]string)
- func AddSpanTags(span trace.Span, tags map[string]string)
- func FailSpan(span trace.Span, msg string)
- func HTTPHandler(handler http.Handler, name string) http.Handler
- func HTTPHandlerFunc(handler http.HandlerFunc, name string) http.HandlerFunc
- func NewSpan(ctx context.Context, name string) (context.Context, trace.Span)
- func SpanFromContext(ctx context.Context) trace.Span
- type Provider
- type ProviderConfig
- type SpanCustomiser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddSpanError ¶
AddSpanError adds a new event to the span. It will appear under the "Logs" section of the selected span. This is not going to flag the span as "failed". Use this if you think you should log any exceptions such as critical, error, warning, caution etc. Avoid logging sensitive data!
func AddSpanEvents ¶
AddSpanEvents adds a new events to the span. It will appear under the "Logs" section of the selected span. Use this if the event could mean anything valuable while debugging.
func AddSpanTags ¶
AddSpanTags adds a new tags to the span. It will appear under "Tags" section of the selected span. Use this if you think the tag and its value could be useful while debugging.
func FailSpan ¶
FailSpan flags the span as "failed" and adds "error" label on listed trace. Use this after calling the `AddSpanError` function so that there is some sort of relevant exception logged against it.
func HTTPHandler ¶
HTTPHandler is a convenience function which helps attaching tracing functionality to conventional HTTP handlers.
func HTTPHandlerFunc ¶
func HTTPHandlerFunc(handler http.HandlerFunc, name string) http.HandlerFunc
HTTPHandlerFunc is a convenience function which helps attaching tracing functionality to conventional HTTP handlers.
func NewSpan ¶
NewSpan returns a new span from the global tracer. Depending on the `cus` argument, the span is either a plain one or a customised one. Each resulting span must be completed with `defer span.End()` right after the call.
func SpanFromContext ¶
SpanFromContext returns the current span from a context. If you wish to avoid creating child spans for each operation and just rely on the parent span, use this function throughout the application. With such practise you will get flatter span tree as opposed to deeper version. You can always mix and match both functions.
Types ¶
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider represents the tracer provider. Depending on the `config.Disabled` parameter, it will either use a "live" provider or a "no operations" version. The "no operations" means, tracing will be globally disabled.
func NewProvider ¶
func NewProvider(config ProviderConfig) (Provider, error)
New returns a new `Provider` type. It uses Jaeger exporter and globally sets the tracer provider as well as the global tracer for spans.
type ProviderConfig ¶
type ProviderConfig struct { JaegerEndpoint string ServiceName string ServiceVersion string Environment string // Set this to `true` if you want to disable tracing completly. Disabled bool }
ProviderConfig represents the provider configuration and used to create a new `Provider` type.
type SpanCustomiser ¶
type SpanCustomiser interface {
// contains filtered or unexported methods
}
SpanCustomiser is used to enforce custom span options. Any custom concrete span customiser type must implement this interface.