openedx / edx-django-utils

edX utilities for Django Application development.
https://edx.readthedocs.io/projects/edx-django-utils/en/latest/
Apache License 2.0
26 stars 20 forks source link

fix: NRQL search script using updated api #130

Closed robrap closed 3 years ago

robrap commented 3 years ago

Description:

The original search script was using the New Relic REST API v2, which has gaps and bugs. It was not clearly documented that the preferred method is to use the new GraphQL API.

The script has been updated to use the new GraphQL API.

Note: it may make sense to introduce Graphene, or some other library to work with GraphQL, but to start I avoided adding a new dependency and was able to use New Relic's GUI to play with different queries here: https://api.newrelic.com/graphiql

Testing instructions:

Was tested locally with the following:

python edx_django_utils/monitoring/scripts/new_relic_nrql_search.py --regex "'(arch|platform-arch)'"

python edx_django_utils/monitoring/scripts/new_relic_nrql_search.py --regex "'(arch|platform-arch)'" --policy_id 1148306 --policy_id 1160889 --policy_id 1160905 --dashboard_guid ODgxNzh8VklafERBU0hCT0FSRHwxMjI3MDI3 --dashboard_guid ODgxNzh8VklafERBU0hCT0FSRHwxNDI2ODEw

Merge checklist: