Documentation ¶
Index ¶
- func BuildDBEvent(bld *libhoney.Builder, stats sql.DBStats, query string, args ...interface{}) (*libhoney.Event, func(error))
- func BuildDBSpan(ctx context.Context, bld *libhoney.Builder, stats sql.DBStats, query string, ...) (context.Context, *trace.Span, func(error))
- func GetRequestProps(req *http.Request) map[string]interface{}
- func StartSpanOrTraceFromHTTP(r *http.Request) (context.Context, *trace.Span)
- func StartSpanOrTraceFromHTTPWithTraceParserHook(r *http.Request, parserHook config.HTTPTraceParserHook) (context.Context, *trace.Span)
- type ResponseWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildDBEvent ¶
func BuildDBEvent(bld *libhoney.Builder, stats sql.DBStats, query string, args ...interface{}) (*libhoney.Event, func(error))
BuildDBEvent tries to bring together most of the things that need to happen for an event to wrap a DB call in both the sql and sqlx packages. It returns a function which, when called, dispatches the event that it created. This lets it finish a timer around the call automatically. This function is only used when no context (and therefore no beeline trace) is available to the caller - if context is available, use BuildDBSpan() instead to tie it in to the active trace.
func BuildDBSpan ¶
func BuildDBSpan(ctx context.Context, bld *libhoney.Builder, stats sql.DBStats, query string, args ...interface{}) (context.Context, *trace.Span, func(error))
BuildDBSpan does the same things as BuildDBEvent except that it has access to a trace from the context and takes advantage of that to add the DB events into the trace.
func GetRequestProps ¶
GetRequestProps is a convenient method to grab all common http request properties and get them back as a map.
func StartSpanOrTraceFromHTTP ¶
StartSpanOrTraceFromHTTP creates and returns a span for the provided http.Request. If there is an existing span in the Context, this function will create the new span as a child span and return it. If not, it will create a new trace object and return the root span.
func StartSpanOrTraceFromHTTPWithTraceParserHook ¶ added in v0.6.0
func StartSpanOrTraceFromHTTPWithTraceParserHook(r *http.Request, parserHook config.HTTPTraceParserHook) (context.Context, *trace.Span)
StartSpanOrTraceFromHTTPWithTraceParserHook is a version of StartSpanOrTraceFromHTTP that accepts a TraceParserHook which will be invoked when creating a new trace for the incoming HTTP request.
Types ¶
type ResponseWriter ¶
type ResponseWriter struct { // Wrapped is not embedded to prevent ResponseWriter from directly // fulfilling the http.ResponseWriter interface. Wrapping in this // way would obscure optional http.ResponseWriter interfaces. Wrapped http.ResponseWriter Status int }
func NewResponseWriter ¶
func NewResponseWriter(w http.ResponseWriter) *ResponseWriter