-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(agent): add support for Yii v2 (#848)
Implement Yii v2 instrumentation for auto transaction naming. Original work by @razvanphp in #823. Fixes #821. --------- Co-authored-by: Razvan Grigore <[email protected]>
- Loading branch information
Showing
8 changed files
with
227 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
/* | ||
* Copyright 2020 New Relic Corporation. All rights reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/*DESCRIPTION | ||
The agent should name Yii2 cli transactions | ||
*/ | ||
|
||
/*EXPECT_METRICS_EXIST | ||
Supportability/framework/Yii2/detected | ||
OtherTransaction/Action/test-integration-cli-action | ||
*/ | ||
|
||
/*EXPECT_ERROR_EVENTS null */ | ||
|
||
/* Yii2 mock */ | ||
require_once __DIR__.'/yii2/baseyii.php'; | ||
|
||
$a = new yii\base\InlineAction('test-integration-cli-action'); | ||
$a->runWithParams([]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
/* | ||
* Copyright 2020 New Relic Corporation. All rights reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/*DESCRIPTION | ||
The agent should name Yii2 web transactions | ||
*/ | ||
|
||
/*EXPECT_METRICS_EXIST | ||
Supportability/framework/Yii2/detected | ||
OtherTransaction/Action/test-integration-web-action | ||
*/ | ||
|
||
/*EXPECT_ERROR_EVENTS null */ | ||
|
||
/* Yii2 mock */ | ||
require_once __DIR__.'/yii2/baseyii.php'; | ||
|
||
$a = new yii\base\Action('test-integration-web-action'); | ||
$a->runWithParams([]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
/* | ||
* Copyright 2020 New Relic Corporation. All rights reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/* Mock enough bits of Yii2 infrastructure for naming tests. */ | ||
|
||
namespace yii\base { | ||
|
||
/* Web action */ | ||
class Action { | ||
private $uniqid; | ||
|
||
public function __construct($argument) { | ||
$this->uniqid = $argument; | ||
} | ||
|
||
public function getUniqueId ( ) { | ||
return $this->uniqid; | ||
} | ||
|
||
public function runWithParams($params) { | ||
return; | ||
} | ||
} | ||
|
||
/* Console action */ | ||
class InlineAction { | ||
private $uniqid; | ||
|
||
public function __construct($id) { | ||
$this->uniqid = $id; | ||
} | ||
|
||
public function getUniqueId ( ) { | ||
return $this->uniqid; | ||
} | ||
|
||
public function runWithParams($params) { | ||
return; | ||
} | ||
} | ||
echo ""; | ||
} |