Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMonitor ¶
func NewMonitor(opts ...Option) *event.CommandMonitor
NewMonitor creates a new mongodb event CommandMonitor.
Types ¶
type CommandTransformer ¶
CommandTransformer defines a function that transforms a MongoDB command attribute. If the function returns an empty string, the attribute will not be added to the Span.
type Event ¶
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.
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 Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option specifies instrumentation configuration options.
func WithCommandAttributeDisabled ¶
WithCommandAttributeDisabled specifies if the MongoDB command is added as an attribute to Spans or not. This is disabled by default and the MongoDB command will not be added as an attribute to Spans if this option is not provided.
func WithCommandAttributeTransformer ¶
func WithCommandAttributeTransformer(transformer CommandTransformer) Option
WithCommandAttributeTransformer specifies a function to transform the MongoDB command attribute.
func WithTracerProvider ¶
func WithTracerProvider(provider trace.TracerProvider) Option
WithTracerProvider specifies a tracer provider to use for creating a tracer. If none is specified, the global provider is used.