apm

package
v0.0.0-...-1b76716 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTags

func GetTags(ctx context.Context) []string

func SetTags

func SetTags(ctx context.Context, tags ...string) context.Context

Types

type Event

type Event interface {
	Message() message.Composer
	Document() *birch.Document
}

Event describes a single "event" produced by rotating the Client's cached storage. These events aren't single events from the perspective of the driver, but rather a window of events.

type Monitor

type Monitor interface {
	DriverAPM() *event.CommandMonitor
	Rotate() Event
}

Monitor provides a high level command monitoring total.

func NewBasicMonitor

func NewBasicMonitor(config *MonitorConfig) Monitor

NewBasicMonitor returns a simple monitor implementation that does not automatically rotate data. The MonitorConfig makes it possible to filter events. If this value is nil, no events will be filtered.

func NewFTDCMonitor

func NewFTDCMonitor(ctx context.Context, dur time.Duration, collector ftdc.Collector, m Monitor) Monitor

NewFTDCMonitor produces a monitor implementation that automatically flushes the event data to an FTDC data collector.

func NewLoggingMonitor

func NewLoggingMonitor(ctx context.Context, dur time.Duration, m Monitor) Monitor

NewLoggingMonitor wraps an existing logging monitor that automatically logs the output the default grip logger on the specified interval.

type MonitorConfig

type MonitorConfig struct {
	// PopulateEvents, when true, forces the collector to
	// preallocate the output structures, for all filtered
	// combinations of databases, collections, and commands as
	// well as namespaces and commands. This is primarily useful
	// when the output requires a predetermined schema or
	// structure and you want to maintain the shape of the data
	// even if no events for a particular command or namespace
	// occurred.
	//
	// When pre-populating events, you should specify commands to
	// filter and either a list of collections and databases or a
	// list of namespaces.
	PopulateEvents bool

	// Commands, Databases, and Collections give you the ability
	// to whitelist a number of operations to filter and exclude
	// other non-matching operations.
	Commands    []string
	Databases   []string
	Collections []string

	// Tags are added to operations via contexts and permit
	// more granular annotations. You must specify a tag in Tags
	// to tracked counters. If AllTags is set, all tags are
	// tracked and reported.
	Tags    []string
	AllTags bool

	// Namespaces allow you to declare a specific database and
	// collection name as a pair. When specified, only events that
	// match the namespace will be collected. Namespace filtering
	// occurs after the other filtering, including by command.
	Namespaces []Namespace
}

MonitorConfig makes it possible to configure the behavior of the Monitor. In most cases you can pass a nil value.

type Namespace

type Namespace struct {
	DB         string
	Collection string
}

Namespace defines a MongoDB collection and database.

Jump to

Keyboard shortcuts

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