metrics

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Install

func Install(options *Options)

Install registers the metrics under the given namespace and subsystem. This take effect only once; subsequent calls has no effect.

func RecordRPCRequest

func RecordRPCRequest(action, version string, code int, contentLength int, duration time.Duration)

RecordRPCRequest gathers the metric values of a RPC HTTP request. It should be called at the end of a request session.

func RecordRestfulRequest

func RecordRestfulRequest(path, verb string, code int, contentLength int, duration time.Duration)

RecordRestfulRequest gathers the metric values of a Restful HTTP request. It should be called at the end of a request session.

Types

type Options

type Options struct {
	NamespaceLabel string `desc:"label name for the metrics namespace"`
	NamespaceValue string `desc:"metrics namespace; also used as the value of the namespace label (if provided)"`
	SubsystemLabel string `desc:"label name for the metrics subsystem"`
	SubsystemValue string `desc:"metrics subsystem; also used as the value of the subsystem value (if provided)"`
}

Options provide a way to configure the name of the metrics (by setting Namespace and Subsystem) and control if and how these value should be used as label values. If you are unsure about these options, just use nil or empty Options.

func DefaultOptions

func DefaultOptions() *Options

DefaultOptions builds an Options object with default values; it is used automatically when a nil Options is provided.

Jump to

Keyboard shortcuts

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