common

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2018 License: Apache-2.0 Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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