common

package
v0.4.11 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

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

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 {
	// 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

Jump to

Keyboard shortcuts

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