middleware

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DispatcherReceived = "received"
	DispatcherExecuted = "executed"
)

Variables

View Source
var (

	// Views
	OpenCensusExecCount = &view.View{
		Name:        "execution_count",
		Measure:     ocExecCount,
		Description: "Number of command executions",
		Aggregation: view.Count(),
	}

	OpenCensusErrCount = &view.View{
		Name:        "error_count",
		Measure:     ocErrCount,
		Description: "Number of command error",
		Aggregation: view.Count(),
	}

	OpenCensusExecCountByCommand = &view.View{
		Name:        "execution_count_by_command",
		Measure:     ocExecCount,
		Description: "Number of command executions by command",
		TagKeys:     []tag.Key{commandName},
		Aggregation: view.Count(),
	}

	OpenCensusErrCountByCommand = &view.View{
		Name:        "error_count_by_command",
		Measure:     ocErrCount,
		Description: "Number of command error by command",
		TagKeys:     []tag.Key{commandName},
		Aggregation: view.Count(),
	}
)

DefaultOpenCensusConfig is the default OpenCensus middleware config.

Functions

func Dispatcher added in v0.3.0

func Dispatcher(d dispatcher.Dispatcher) commandbus.MiddlewareFunc

Dispatcher will dispatch events when a command was received and executed.

func Logger

func Logger(next commandbus.HandlerFunc) commandbus.HandlerFunc

func OpenCensus added in v0.3.0

func OpenCensus() commandbus.MiddlewareFunc

OpenCensus returns a middleware that collect the command metrics.

func OpenCensusWithConfig added in v0.3.0

func OpenCensusWithConfig(cfg OpenCensusConfig) commandbus.MiddlewareFunc

OpenCensusWithConfig returns a OpenCensus middleware with config. See: `OpenCensus()`.

Types

type OpenCensusConfig added in v0.3.0

type OpenCensusConfig struct {
	// Views it is a OpenCensus views list.
	Views []*view.View
}

OpenCensusConfig defines the config for OpenCensus middleware.

Jump to

Keyboard shortcuts

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