Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // MetricsRecorder is used by the GetRecorder function to determine which recorder // to return. This allows an application to set a default recorder and simply call // GetRecorder. // Enum: // noop // newrelic MetricsRecorder = "noop" )
Functions ¶
This section is empty.
Types ¶
type NewRelic ¶
type NewRelic struct { Transaction *newrelic.Transaction DBName string Collection string Operation string }
NewRelic implements the transaction.metrics interface. Populate DBName, Table, Operation before calling DatabaseSegment.
func (*NewRelic) DatabaseSegment ¶
DatabaseSegment records a database segment that occured during the given transaction.
type NoOp ¶
type NoOp struct{}
NoOp satisfies the Recorder interface, but does nothing.
func (*NoOp) DatabaseSegment ¶
DatabaseSegment records a database segment that occured during the given transaction.
type Recorder ¶
type Recorder interface { // SetDBMeta assigns the Database meta data for the next DatabaseSegment call. Call before calling DatabaseSegment. SetDBMeta(string, string, string) // DatabaseSegment records a database segment that occured during the given transaction. DatabaseSegment(string, string, ...interface{}) func() // Segment records a segment that occured during the given transaction. Segment(string) func() }
Recorder is an interface for recording metrics about the application.
func GetRecorder ¶
GetRecorder returns an appropriate recorder based on the value of MetricsRecorder. Populate MetricsRecorder during setup in main to change which recorder is returned.
func NewRelicFromContext ¶
NewRelicFromContext creates a new NewRelic recorder from the given context, or a NoOp recorder if there is no NewRelic transaction in the context.