Skip to content

[Forwardport] Add Ability To Separate Frontend / Adminhtml in New Relic #15947

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

Merged

Conversation

ihor-sviziev
Copy link
Contributor

@ihor-sviziev ihor-sviziev commented Jun 8, 2018

Original Pull Request

#12935

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)

@magento-cicd2
Copy link
Contributor

magento-cicd2 commented Jun 8, 2018

CLA assistant check
All committers have signed the CLA.

@mpchadwick
Copy link
Contributor

lol @ihor-sviziev was just about to do this and noticed you already took care of it. thanks! https://github.com/magento/magento2/compare/2.3-develop...mpchadwick:feature/2.3/new-relic-separate-areas?expand=1

@ihor-sviziev
Copy link
Contributor Author

ihor-sviziev commented Jun 21, 2018

@magento/open-source-maintainers please review my PR

@julian-van-drielen
Copy link

@ihor-sviziev Your code is not up to the Magento coding standards. Please resolve these issues before we can review your pull request.

See codacy for more information.

@ihor-sviziev
Copy link
Contributor Author

ihor-sviziev commented Jun 21, 2018

@cream-julian In tests we can use ObjectManager, it's allowed. Original PR with the same changes was already merged

*
* @param State $subject
* @param null $result
* @return void
Copy link

@igortregub igortregub Jun 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

your code returns some data, please update doc-block or fix code

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also wouldn't be wrong to auto-format this so that the variable names are aligned under each other. I'm not sure if this is required in the magento coding standards though...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@igortregub we can use "mixed", but actually it doesn't matter. Will update PR
@abbasalis it's not required in magento coding standards


/**
* @param Config $config
* @param NewRelicWrapper $newRelicWrapper
Copy link
Member

@imadphp imadphp Jun 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add $logger param

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. will Update PR

return false;
}

return true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd simply say

return (
$this->config->isSeparateApps()
&& $this->config->getNewRelicAppName()
&& $this->config->isNewRelicEnabled()
)

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will update it

*/
private $objectManager;

protected function setUp()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add your docblocks here please

* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you use strict type, would be great to use return types as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

* @magentoConfigFixture default/newrelicreporting/general/app_name beverly_hills
* @magentoConfigFixture default/newrelicreporting/general/separate_apps 1
*/
public function testAppNameIsSetWhenConfiguredCorrectly()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't check case if adjusting is disabled and exception

@ihor-sviziev
Copy link
Contributor Author

ihor-sviziev commented Sep 14, 2018

Hi @ishakhsuvarov,
Thank you for fixing these issues in my PR.
Also would be great to add these changes to 2.2.x release line. Should I create PR?

@ishakhsuvarov
Copy link
Contributor

@ihor-sviziev Happy to help.

I think it would make sense to hold on with a 2.2 PR while this gets delivered

@ihor-sviziev
Copy link
Contributor Author

@ishakhsuvarov sure!

@magento-engcom-team magento-engcom-team merged commit b9e20c7 into magento:2.3-develop Sep 16, 2018
@magento-engcom-team
Copy link
Contributor

Hi @ihor-sviziev. Thank you for your contribution.
We will aim to release these changes as part of 2.3.0.
Please check the release notes for final confirmation.

magento-engcom-team added a commit that referenced this pull request Sep 24, 2018
 - Merge Pull Request #18113 from ihor-sviziev/magento2:new-relic-15947-fixes
 - Merged commits:
   1. be7e142
   2. 2a709c1
   3. 63c51f4
   4. 3eec546
magento-engcom-team added a commit that referenced this pull request Sep 24, 2018
Accepted Public Pull Requests:
 - #18126: [Backport] [2.2] Changed intval($val) to (int) $val, since it is faster: (by @dmytro-ch)
 - #18000: Fix sitemap grid render incorrect base urls for multiple stores (by @nntoan)
 - #18098: Fix shipping discount failed to apply during place order (by @torreytsui)
 - #18113: [Backport] Fixes from #15947 (by @ihor-sviziev)
 - #18097: [Backport] Fix import grouped products #12853 (by @insanityinside)
 - #17993: fix #17582 ./bin/magento config:show fails with a fatal error (by @keyurshah070)
 - #17679: Update shipment collection to unserialize `packages` attribute after load (by @dnsv)
 - #18055: fix: reset search mini-form when we have no data / an empty response (by @DanielRuf)
 - #14065: Correctly convert config integration api resources (by @therool)


Fixed GitHub Issues:
 - #17999: Sitemap grid display incorrect base URL in the grid if using multiple stores (reported by @nntoan) has been fixed in #18000 by @nntoan in 2.2-develop branch
   Related commits:
     1. 1172aae

 - #17582: ./bin/magento config:show fails with a fatal error (reported by @simonworkhouse) has been fixed in #17993 by @keyurshah070 in 2.2-develop branch
   Related commits:
     1. ae503f6

 - #12095: Update 2.2.1: One or more integrations have been reset because of a change to their xml configs. (reported by @thomvanderboon) has been fixed in #14065 by @therool in 2.2-develop branch
   Related commits:
     1. 89a0a09
     2. 5815a20
     3. 406935b
     4. 3868e81
     5. 42eab52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants