[SE-3136] Add client instance name to New Relic monitoring condition name
This PR is adding client instance name to New Relic monitoring condition name to be able to find root cause of incidents faster and improve the investigation experience. In case the name is too long, it will be truncated due to limitations.
Dependencies: None
Screenshots:
Merge deadline: None
Testing instructions:
- If you don't already have
ADMINS
setting set in your local.env
file, set it to your email (ie.ADMINS='[["Gabor Admin", "gabor@opencraft.com"]]'
. - Set
NEWRELIC_ADMIN_USER_API_KEY
andNEWRELIC_LICENSE_KEY
in your local.env
file. You can find them on the production Ocim VM's.env
file. - Start the django shell (
make shell
). - Get a reference to an
OpenEdXInstace
(or create a new one if you don't have an existing instance in your devstack). - Run
instance.enable_monitoring()
. Make sure that there are no errors. - Log into NewRelic and go to 'Alerts & AI -> Policies'. Search by the URL of your test instance and verify that the policy alerts look correct.
- Run
instance.disable_monitoring()
. - Verify that the policy for your instance has been removed from NewRelic.
- Don't forget to remove
NEWRELIC_ADMIN_USER_API_KEY
andNEWRELIC_LICENSE_KEY
from your local.env
file!
Author notes and concerns:
- The format of the condition name was not finalized beforehand, so I'm opened to discuss other ideas too.
- In case the condition name reaches the maximum (64) characters and the instance name is one long word, the instance name will be replaced by
...
. Example faulty condition name:Preview of ...
[1] [2]
[1] In my opinion, this shouldn't be an issue since it would mean that the instance name should be at least 42 characters long without any whitespace. Number 42 is built up from: length of the longest "prefix" with formatting extracted from 64, the current maximum length. So: 64 - len("Extended heartbeat of ")
[2] The 64 length is not confirmed by NewRelic developers yet. Currently, I'm investigating the max length with the help of New Relic, but I think, this shouldn't be a blocker, since an institution name which is equal to or longer than 42 chars is really rare.
UPDATE: 64 chars max length is confirmed by New Relic