# Content

# Setup

Install package with composer:

composer require contributte/newrelic
1

Register as nette extension:

extensions:
  newrelic: Contributte\NewRelic\DI\NewRelicExtension
1
2

# Usage

newrelic:
  enabled: Yes #default
  appName: YourApplicationName #optional
  license: yourLicenseCode #optional
  actionKey: action # default - optional - action parameter name
  logLevel: #defaults
    - critical
    - exception
    - error

  # optional options with default values
  rum:
    enabled: auto # other options are Yes/No
  transactionTracer:
    enabled: Yes
    detail: 1
    recordSql: obfuscated
    slowSql: Yes
    threshold: apdex_f
    stackTraceThreshold: 500
    explainThreshold: 500
  errorCollector:
    enabled: Yes
    recordDatabaseErrors: Yes
  parameters:
    capture: No
    ignored: []
  customParameters:
    paramName: paramValue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

# Realtime User Monitoring

Add this component factory to your base presenter:

/**
 * @var \Contributte\NewRelic\RUM\HeaderControl
 * @inject
 */
protected $headerControl;

/**
 * @var \Contributte\NewRelic\RUM\FooterControl
 * @inject
 */
protected $footerControl;

protected function createComponentNewRelicHeader()
{
    $this->headerControl->disableScriptTag(); // optional
    return $this->headerControl;
}

protected function createComponentNewRelicFooter()
{
    $this->footerControl->disableScriptTag(); // optional
    return $this->footerControl;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

And add this to your @layout header (before </head>):

{control newRelicHeader}
1

And add this to your @layout footer (before </body>):

{control newRelicFooter}
1

# Tracy

$logLevel = [ // default (NULL means default)
    \Tracy\Logger::CRITICAL,
    \Tracy\Logger::EXCEPTION,
    \Tracy\Logger::ERROR,
];
$appName = 'PHP Application'; // default (NULL means default)
$license = 'your_licence_key';

\Contributte\NewRelic\Tracy\Bootstrap::init($logLevel, $appName, $license); // all parameters are optional
1
2
3
4
5
6
7
8
9