Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Ability To Separate Frontend / Adminhtml in New Relic #12935

Conversation

@mpchadwick
Copy link
Contributor

@mpchadwick mpchadwick commented Dec 31, 2017

Description

Adds a new setting which, when enabled, reports frontend and adminhtml as separate apps to New Relic.

frontend and adminhtml are in addition to the "main" app which includes both (for backwards compatibility). The user needs to set "New Relic Application Name" to use this feature as the area is appended to the appname setting, separated by and underscore.

image

image

Useful as slow transactions in admin activity can cause false positives New Relic alerts / skew average response time metrics. Using this feature allows monitoring and alerting on only frontend traffic by configuring alerts for just the frontend New Relic app.

Manual testing scenarios

  1. Pull in changes to a testing environment with New Relic agent installed
  2. Ensure "Enable New Relic Intergration" is set to yes
  3. Ensure "New Relic Application Name" is set
  4. Turn on "Send Adminhtml and Frontend as Separate Apps Setting"
  5. Navigate the frontend and backend of Magento
  6. Login to New Relic and observe 3 apps ("main" app, "adminhtml" app, and "frontend" app).

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)
@mpchadwick
Copy link
Contributor Author

@mpchadwick mpchadwick commented Dec 31, 2017

Just to document, based on testing done in response to this conversation on Twitter, this will also catch other area codes such as webapi_rest.

image

@ihor-sviziev
Copy link
Contributor

@ihor-sviziev ihor-sviziev commented Feb 21, 2018

I reopened this PR in order to restart build in travis

Copy link
Contributor

@ihor-sviziev ihor-sviziev left a comment

In general looks good, but here is some small issues. Can you also cover your changes with tests?

* @param string $appName
* @return void
*/
public function setAppName($appName)

This comment has been minimized.

@ihor-sviziev

ihor-sviziev Feb 21, 2018
Contributor

I'd like to define variable type to "string" there, we're not supporting php 5.6 anymore

try {
$this->newRelicWrapper->setAppName($this->appName($state));
} catch (LocalizedException $e) {
return;

This comment has been minimized.

@ihor-sviziev

ihor-sviziev Feb 21, 2018
Contributor

  1. Why should we ignore such exception?
  2. Probably we should have return $result here
public function afterSetAreaCode(State $state, $result)
{
if (!$this->shouldSetAppName()) {
return;

This comment has been minimized.

@ihor-sviziev

ihor-sviziev Feb 21, 2018
Contributor

Probably we should have return $result here

}
}

private function appName(State $state)

This comment has been minimized.

@ihor-sviziev

ihor-sviziev Feb 21, 2018
Contributor

Would be better to rename it to "setAppName"

This comment has been minimized.

@mpchadwick

mpchadwick Feb 27, 2018
Author Contributor

This is a getter. Would you prefer getAppName?

mpchadwick added 3 commits Feb 27, 2018
This would happen if for some reason the area code wasn't set
@ihor-sviziev
Copy link
Contributor

@ihor-sviziev ihor-sviziev commented Feb 27, 2018

Hi @mpchadwick,
Your changes looks good, could you cover them with tests in order to prevent regression in this place?

@mpchadwick
Copy link
Contributor Author

@mpchadwick mpchadwick commented Feb 27, 2018

@ihor-sviziev I will add tests. May take a little while. Still trying to get the integration tests to run in my local environment.

Copy link
Contributor

@ihor-sviziev ihor-sviziev left a comment

@mpchadwick please review static test, they are failing currently

@mpchadwick
Copy link
Contributor Author

@mpchadwick mpchadwick commented May 28, 2018

@magento-engcom-team
Copy link
Contributor

@magento-engcom-team magento-engcom-team commented Jun 5, 2018

Hi @ihor-sviziev, thank you for the review.
ENGCOM-1860 has been created to process this Pull Request

@magento-engcom-team magento-engcom-team merged commit 24d7d4a into magento:2.2-develop Jun 7, 2018
2 of 3 checks passed
2 of 3 checks passed
Codacy/PR Quality Review Not up to standards. This pull request quality could be better.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
licence/cla Contributor License Agreement is signed.
Details
magento-engcom-team pushed a commit that referenced this pull request Jun 7, 2018
@magento-engcom-team
Copy link
Contributor

@magento-engcom-team magento-engcom-team commented Jun 7, 2018

Hi @mpchadwick. Thank you for your contribution.
Changes from your Pull Request will be available with the upcoming 2.2.6 release.

Please, consider to port this solution to 2.3 release line.
You may use Porting tool to port commits automatically.

@ihor-sviziev
Copy link
Contributor

@ihor-sviziev ihor-sviziev commented Jul 25, 2018

Hi @mpchadwick,
I don't have enough time for fixing all the issues that appeared in #15947. Could you create own forwardport with requested changes from #15947?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants