common

package
v0.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildDBEvent

func BuildDBEvent(bld *libhoney.Builder, 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 bot 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, 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

func GetRequestProps(req *http.Request) map[string]interface{}

GetRequestProps is a convenient method to grab all common http request properties and get them back as a map.

func StartSpanOrTraceFromHTTP

func StartSpanOrTraceFromHTTP(r *http.Request) (context.Context, *trace.Span)

Types

type ResponseWriter

type ResponseWriter struct {
	http.ResponseWriter
	Status int
}

func NewResponseWriter

func NewResponseWriter(w http.ResponseWriter) *ResponseWriter

func (*ResponseWriter) WriteHeader

func (h *ResponseWriter) WriteHeader(statusCode int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL