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

Merged
merged 9 commits into from Jun 7, 2018

Conversation

@mpchadwick
Contributor

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

This comment has been minimized.

Contributor

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

This comment has been minimized.

Contributor

ihor-sviziev commented Feb 21, 2018

I reopened this PR in order to restart build in travis

@ihor-sviziev

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

Contributor

This is a getter. Would you prefer getAppName?

mpchadwick added some commits Feb 27, 2018

Log exceptions
This would happen if for some reason the area code wasn't set
@ihor-sviziev

This comment has been minimized.

Contributor

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

This comment has been minimized.

Contributor

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.

@ihor-sviziev

@mpchadwick please review static test, they are failing currently

@mpchadwick

This comment has been minimized.

Contributor

mpchadwick commented May 28, 2018

@magento-engcom-team

This comment has been minimized.

Contributor

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 moved this from TODO to Testing In Progress in Community Pull Requests Jun 5, 2018

@magento-engcom-team magento-engcom-team moved this from Testing In Progress to Merging In Progress in Community Pull Requests Jun 6, 2018

@magento-engcom-team magento-engcom-team merged commit 24d7d4a into magento:2.2-develop Jun 7, 2018

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

Community Pull Requests automation moved this from Merging In Progress to Done Jun 7, 2018

magento-engcom-team pushed a commit that referenced this pull request Jun 7, 2018

@magento-engcom-team

This comment has been minimized.

Contributor

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

This comment has been minimized.

Contributor

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?

@sidolov sidolov added this to Port to 2.3 Created in Ports Wanted Sep 14, 2018

@magento-engcom-team magento-engcom-team moved this from Port to 2.3 Created to Port to 2.3 Merged in Ports Wanted Sep 16, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment