Documentation ¶
Overview ¶
No op implementation for non linux platforms (new relix agent sdk only support linux right now)
Index ¶
- Variables
- func Init(app, key string)
- func NewBackgroundTx(name string, category string) *tx
- func NewRequestTx(name string, url string) *tx
- func NewTx(name string) *tx
- func RecordMetrics(interval time.Duration)
- func RecordMetricsWithRecorder(r Recorder)
- func WithTx(ctx context.Context, t Tx) context.Context
- type NRTxReporter
- type NRTxTracer
- func (t *NRTxTracer) BeginDatastoreSegment(txnID, parentID int64, table, operation, sql, rollupName string) (int64, error)
- func (t *NRTxTracer) BeginExternalSegment(txnID, parentID int64, host, name string) (int64, error)
- func (t *NRTxTracer) BeginGenericSegment(txnID, parentID int64, name string) (int64, error)
- func (t *NRTxTracer) BeginTransaction() (int64, error)
- func (t *NRTxTracer) EndSegment(txnID, parentID int64) error
- func (t *NRTxTracer) EndTransaction(txnID int64) error
- func (t *NRTxTracer) SetTransactionCategory(txnID int64, category string) error
- func (t *NRTxTracer) SetTransactionName(txnID int64, name string) error
- func (t *NRTxTracer) SetTransactionRequestURL(txnID int64, url string) error
- func (t *NRTxTracer) SetTransactionType(txnID int64, txnType TransactionType) error
- type Recorder
- type SegmentStack
- type Trace
- func TraceDatastore(ctx context.Context, table, operation, sql, rollupName string) *Trace
- func TraceExternal(ctx context.Context, host, name string) *Trace
- func TraceFunc(ctx context.Context) *Trace
- func TraceGeneric(ctx context.Context, name string) *Trace
- func TraceRequest(ctx context.Context, name string, req *http.Request) (context.Context, *Trace)
- type TransactionType
- type Tx
- type TxReporter
- type TxTracer
Constants ¶
This section is empty.
Variables ¶
var ErrTxAlreadyStarted = errors.New("transaction already started")
Functions ¶
func NewBackgroundTx ¶
NewBackgroundTx returns a new background transaction
func NewRequestTx ¶
NewRequestTx returns a new transaction with a request url.
func RecordMetrics ¶
RecordMetrics records metrics with the default metric recorder.
func RecordMetricsWithRecorder ¶
func RecordMetricsWithRecorder(r Recorder)
RecordMetricsWithRecorder records metrics with the given recorder.
Types ¶
type NRTxReporter ¶
type NRTxReporter struct{}
func (*NRTxReporter) ReportCustomMetric ¶
func (r *NRTxReporter) ReportCustomMetric(name string, value float64) (int, error)
func (*NRTxReporter) ReportError ¶
func (r *NRTxReporter) ReportError(txnID int64, exceptionType, errorMessage, stackTrace, stackFrameDelim string) (int, error)
type NRTxTracer ¶
type NRTxTracer struct{}
func (*NRTxTracer) BeginDatastoreSegment ¶
func (t *NRTxTracer) BeginDatastoreSegment(txnID, parentID int64, table, operation, sql, rollupName string) (int64, error)
func (*NRTxTracer) BeginExternalSegment ¶
func (t *NRTxTracer) BeginExternalSegment(txnID, parentID int64, host, name string) (int64, error)
func (*NRTxTracer) BeginGenericSegment ¶
func (t *NRTxTracer) BeginGenericSegment(txnID, parentID int64, name string) (int64, error)
func (*NRTxTracer) BeginTransaction ¶
func (t *NRTxTracer) BeginTransaction() (int64, error)
func (*NRTxTracer) EndSegment ¶
func (t *NRTxTracer) EndSegment(txnID, parentID int64) error
func (*NRTxTracer) EndTransaction ¶
func (t *NRTxTracer) EndTransaction(txnID int64) error
func (*NRTxTracer) SetTransactionCategory ¶
func (t *NRTxTracer) SetTransactionCategory(txnID int64, category string) error
func (*NRTxTracer) SetTransactionName ¶
func (t *NRTxTracer) SetTransactionName(txnID int64, name string) error
func (*NRTxTracer) SetTransactionRequestURL ¶
func (t *NRTxTracer) SetTransactionRequestURL(txnID int64, url string) error
func (*NRTxTracer) SetTransactionType ¶
func (t *NRTxTracer) SetTransactionType(txnID int64, txnType TransactionType) error
type SegmentStack ¶
func NewSegmentStack ¶
func NewSegmentStack() *SegmentStack
func (*SegmentStack) Peek ¶
func (s *SegmentStack) Peek() int64
Peek returns id from the top of the stack. It returns rootSegment if the stack is empty.
func (*SegmentStack) Pop ¶
func (s *SegmentStack) Pop() (int64, bool)
Pop pops a segment id off of the segment stack. It returns false if the stack is empty.
func (*SegmentStack) Push ¶
func (s *SegmentStack) Push(id int64)
Push pushes a segment id onto the segment stack.
type Trace ¶
type Trace struct {
// contains filtered or unexported fields
}
func TraceDatastore ¶
TraceDatastore adds a datastore segment to the newrelic transaction, if one exists in the context.
func TraceExternal ¶
TraceExternal adds an external segment to the newrelic transaction, if one exists in the context.
func TraceFunc ¶
TraceFunc adds a generic segment, autodetecting the function name with runtime.Caller().
func TraceGeneric ¶
TraceGeneric adds a generic segment to the newrelic transaction, if one exists in the context.
func TraceRequest ¶
TraceReqest traces an http request. It returns a new context with the transaction included in it, and a trace object.
Usage:
ctx, t := TraceRequest(ctx, name, req) defer t.Done()
type TransactionType ¶
type TransactionType int
const ( WebTransaction TransactionType = iota OtherTransaction )
type Tx ¶
type Tx interface { Start() error End() error StartGeneric(name string) error StartDatastore(table, operation, sql, rollupName string) error StartExternal(host, name string) error EndSegment() error ReportError(exceptionType, errorMessage, stackTrace, stackFrameDelim string) error }
Tx represents a transaction.
type TxReporter ¶
type TxReporter interface { ReportError(txnID int64, exceptionType, errorMessage, stackTrace, stackFrameDelim string) (int, error) ReportCustomMetric(name string, value float64) (int, error) }
TxReporter reports the first error that occured during a transaction.
type TxTracer ¶
type TxTracer interface { BeginTransaction() (int64, error) EndTransaction(txnID int64) error SetTransactionName(txnID int64, name string) error SetTransactionRequestURL(txnID int64, url string) error SetTransactionType(txnID int64, txnType TransactionType) error SetTransactionCategory(txnID int64, category string) error BeginGenericSegment(txnID int64, parentID int64, name string) (int64, error) BeginDatastoreSegment(txnID int64, parentID int64, table string, operation string, sql string, rollupName string) (int64, error) BeginExternalSegment(txnID int64, parentID int64, host string, name string) (int64, error) EndSegment(txnID int64, parentID int64) error }
TxTracer handles transaction tracing.