Documentation ¶
Overview ¶
Package nrmock contains mock implementations of newrelic.Application and newrelic.Transaction
Index ¶
- type Application
- func (a *Application) RecordCustomEvent(eventType string, params map[string]interface{}) error
- func (a *Application) RecordCustomMetric(name string, value float64) error
- func (a *Application) Shutdown(timeout time.Duration)
- func (a *Application) StartTransaction(name string, w http.ResponseWriter, r *http.Request) newrelic.Transaction
- func (a *Application) WaitForConnection(timeout time.Duration) error
- type Transaction
- func (t *Transaction) AddAttribute(key string, value interface{}) error
- func (t *Transaction) End() error
- func (t *Transaction) Header() http.Header
- func (t *Transaction) Ignore() error
- func (t *Transaction) NoticeError(err error) error
- func (t *Transaction) SetName(name string) error
- func (t *Transaction) StartSegmentNow() newrelic.SegmentStartTime
- func (t *Transaction) Write(b []byte) (int, error)
- func (t *Transaction) WriteHeader(code int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Application ¶
type Application struct { AllTransactions []*Transaction LatestTransaction *Transaction CustomEvents map[string][]map[string]interface{} CustomMetrics map[string][]float64 }
Application is a mock implementation of newrelic.Application
func NewApplication ¶
func NewApplication(options ...func(*Application)) *Application
NewApplication creates a new *Application
func (*Application) RecordCustomEvent ¶
func (a *Application) RecordCustomEvent(eventType string, params map[string]interface{}) error
RecordCustomEvent stores the provided eventType and params for later inspection
func (*Application) RecordCustomMetric ¶ added in v0.2.0
func (a *Application) RecordCustomMetric(name string, value float64) error
RecordCustomMetric records a custom metric.
func (*Application) Shutdown ¶
func (a *Application) Shutdown(timeout time.Duration)
Shutdown does nothing
func (*Application) StartTransaction ¶
func (a *Application) StartTransaction(name string, w http.ResponseWriter, r *http.Request) newrelic.Transaction
StartTransaction creates a mocked transaction, stores it for later inspection, and returns it
func (*Application) WaitForConnection ¶
func (a *Application) WaitForConnection(timeout time.Duration) error
WaitForConnection does nothing
type Transaction ¶
type Transaction struct { Name string Ended bool Ignored bool Errors int Code int Attributes map[string]interface{} }
Transaction is a mock implementation of newrelic.Transaction
func NewTransaction ¶
func NewTransaction(name string, options ...func(*Transaction)) *Transaction
NewTransaction creates a new *Transaction
func (*Transaction) AddAttribute ¶
func (t *Transaction) AddAttribute(key string, value interface{}) error
AddAttribute adds the provided key and value to the transaction attributes for later inspection
func (*Transaction) Header ¶
func (t *Transaction) Header() http.Header
Header returns and empty header map
func (*Transaction) Ignore ¶
func (t *Transaction) Ignore() error
Ignore marks the transaction as ignored
func (*Transaction) NoticeError ¶
func (t *Transaction) NoticeError(err error) error
NoticeError increments the errors counter
func (*Transaction) SetName ¶
func (t *Transaction) SetName(name string) error
SetName sets the transaction name
func (*Transaction) StartSegmentNow ¶
func (t *Transaction) StartSegmentNow() newrelic.SegmentStartTime
StartSegmentNow returns a blank newrelic.SegmentStartTime
func (*Transaction) WriteHeader ¶
func (t *Transaction) WriteHeader(code int)
WriteHeader stores the provided status code for later inspection