newrelic

package module
v2.15.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2022 License: MIT Imports: 9 Imported by: 0

README

RRv2 NewRelic HTTP middleware [DEPRECATED]

  • ✏️ [BETA] Support for the New Relic observability platform. Sample of the client library might be found here. (Thanks @arku31) New Relic middleware is a part of the HTTP plugin, thus configuration should be inside it:
http:
  address: 127.0.0.1:15389
  middleware: [ "new_relic" ] <------- NEW
  new_relic: <---------- NEW
    app_name: "app"
    license_key: "key"
  pool:
    num_workers: 10
    allocate_timeout: 60s
    destroy_timeout: 60s

License key and application name could be set via environment variables: (leave app_name and license_key empty)

  • license_key: NEW_RELIC_LICENSE_KEY.
  • app_name: NEW_RELIC_APP_NAME.

To set the New Relic attributes, the PHP worker should send headers values withing the rr_newrelic header key. Attributes should be separated by the :, for example foo:bar, where foo is a key and bar is a value. New Relic attributes sent from the worker will not appear in the HTTP response, they will be sent directly to the New Relic.

To see the sample of the PHP library, see the @arku31 implementation: https://github.com/arku31/roadrunner-newrelic

The special key which PHP may set to overwrite the transaction name is: transaction_name. For example: transaction_name:foo means: set transaction name as foo. By default, RequestURI is used as the transaction name.

        $resp = new \Nyholm\Psr7\Response();
        $rrNewRelic = [
            'shopId:1', //custom data
            'auth:password', //custom data
            'transaction_name:test_transaction' //name - special key to override the name. By default it will use requestUri.
        ];

        $resp = $resp->withHeader('rr_newrelic', $rrNewRelic);

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	AppName    string `mapstructure:"app_name"`
	LicenseKey string `mapstructure:"license_key"`
}

func (*Config) InitDefaults

func (c *Config) InitDefaults() error

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

func (*Plugin) Init

func (p *Plugin) Init(cfg config.Configurer) error

func (*Plugin) Middleware

func (p *Plugin) Middleware(next http.Handler) http.Handler

func (*Plugin) Name

func (p *Plugin) Name() string

Jump to

Keyboard shortcuts

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