newrelicutil

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2019 License: MIT Imports: 3 Imported by: 0

README

New Relic Util Travis CI GoDoc

The New Relic Util provides a set of helpers for working with objects of New Relic Go Agent.

Documentation

Overview

Package newrelicutil provides a set of helpers for working with objects of New Relic Go Agent.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func DatastoreSegment

func DatastoreSegment(ctx context.Context) *newrelic.DatastoreSegment

DatastoreSegment returns the New Relic DatastoreSegment object from context.

func ExternalSegment

func ExternalSegment(ctx context.Context) *newrelic.ExternalSegment

ExternalSegment returns the New Relic ExternalSegment object from context.

func Segment

func Segment(ctx context.Context) *newrelic.Segment

Segment returns the New Relic Segment object from context.

func Transaction

func Transaction(ctx context.Context) newrelic.Transaction

Transaction returns the New Relic Transaction object from context.

func WithDatastoreSegment

func WithDatastoreSegment(ctx context.Context, sgm *newrelic.DatastoreSegment) context.Context

WithDatastoreSegment puts the New Relic ExternalSegment object to the given context and returns the new context.

func WithExternalSegment

func WithExternalSegment(ctx context.Context, sgm *newrelic.ExternalSegment) context.Context

WithExternalSegment puts the New Relic ExternalSegment object to the given context and returns the new context.

func WithSegment

func WithSegment(ctx context.Context, sgm *newrelic.Segment) context.Context

WithSegment puts the New Relic Segment object to the given context and returns the new context.

func WithTransaction

func WithTransaction(ctx context.Context, txn newrelic.Transaction) context.Context

WithTransaction puts the New Relic Transaction object to the given context and returns the new context.

func WrapHandler

func WrapHandler(app newrelic.Application, name string, handler http.Handler) http.Handler

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.

Directories

Path Synopsis
Package nrgorilla provides New Relic instruments for gorilla/mux tool.
Package nrgorilla provides New Relic instruments for gorilla/mux tool.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL