Documentation ¶
Overview ¶
Package newrelicutil provides a set of helpers for working with objects of New Relic Go Agent.
Index ¶
- func DatastoreSegment(ctx context.Context) newrelic.DatastoreSegment
- func ExternalSegment(ctx context.Context) newrelic.ExternalSegment
- func Segment(ctx context.Context) newrelic.Segment
- func Transaction(ctx context.Context) newrelic.Transaction
- func WithDatastoreSegment(ctx context.Context, sgm newrelic.DatastoreSegment) context.Context
- func WithExternalSegment(ctx context.Context, sgm newrelic.ExternalSegment) context.Context
- func WithSegment(ctx context.Context, sgm newrelic.Segment) context.Context
- func WithTransaction(ctx context.Context, txn newrelic.Transaction) context.Context
- func WrapHandler(app newrelic.Application, name string, handler http.Handler) http.Handler
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DatastoreSegment ¶
DatastoreSegment returns the New Relic DatastoreSegment object from context.
func ExternalSegment ¶
ExternalSegment returns the New Relic ExternalSegment object from context.
func Transaction ¶
Transaction returns the New Relic Transaction object from context.
func WithDatastoreSegment ¶
WithDatastoreSegment puts the New Relic ExternalSegment object to the given context and returns the new context.
func WithExternalSegment ¶
WithExternalSegment puts the New Relic ExternalSegment object to the given context and returns the new context.
func WithSegment ¶
WithSegment puts the New Relic Segment object to the given context and returns the new context.
func WithTransaction ¶
WithTransaction puts the New Relic Transaction object to the given context and returns the new context.
func WrapHandler ¶
WrapHandler return the given http handler that is wrapped to New Relic Transaction. Current New Relic Transaction is placed in the context.
Example ¶
config := newrelic.NewConfig("app_test", "") config.Enabled = false nrapp, _ := newrelic.NewApplication(config) handler := http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {}) wrapped_handler := newrelicutil.WrapHandler(nrapp, "HandlerName", handler) mux := http.NewServeMux() mux.Handle("/some/path", wrapped_handler)
Output:
Types ¶
This section is empty.