Skip to content

Commit

Permalink
New Relic can be enabled only for certain ratio of requests
Browse files Browse the repository at this point in the history
  • Loading branch information
kukulich authored and Vrtak-CZ committed Oct 9, 2013
1 parent 2c6a455 commit c2a6c35
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -21,6 +21,7 @@ Config
```yaml
newrelic:
enabled: Yes #default
ratio: 1
appName: YourApplicationName #optional
license: yourLicenseCode #optional
actionKey: action # default - optional - action parameter name
Expand Down
4 changes: 4 additions & 0 deletions src/VrtakCZ/NewRelic/Extension.php
Expand Up @@ -76,6 +76,10 @@ public function loadConfiguration()

$this->setupApplicationOnRequest();
$this->setupApplicationOnError();

if (isset($config['ratio']) && mt_rand(0, 99) > round($config['ratio'] * 100) - 1) {
newrelic_ignore_transaction();
}
}

public function afterCompile(ClassType $class)
Expand Down

0 comments on commit c2a6c35

Please sign in to comment.