metrics

package
v0.0.0-...-f05d2e9 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2015 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Increment

func Increment(key string)

Increment calls the Increment method on the current package-level backend.

func SetBackend

func SetBackend(b Backend)

SetBackend configures the package-global metrics Backend

func WrapC

func WrapC(h goji.Handler) goji.Handler

WrapC wraps a handler to track request counts and response status code counts namespaced by goji Pattern. It will only include patterns that implemnt fmt.Stringer. For example, if a request matches the pattern /foo/:bar and returns a 204 status code, it will increment "foo.:bar.request" and "foo.:bar.response.204".

WrapC is only safe to use once per request. If you have nested muxes, use WrapC in the outer mux and WrapSubmuxC on the inner mux.

func WrapSubmuxC

func WrapSubmuxC(h goji.Handler) goji.Handler

WrapSubmuxC is a helper for using WrapC with nested muxes. It stores the pattern matched in the current mux but does not track any metrics independently. It should be included in every mux except the outer one.

Types

type Backend

type Backend interface {
	Increment(string)
}

Backend acts as a sink for metrics

Jump to

Keyboard shortcuts

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