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

Instrument using custom attributes + add Worker tests #18

Merged
merged 6 commits into from
Dec 18, 2023

Conversation

hammady
Copy link
Member

@hammady hammady commented Dec 17, 2023

This refactors the Worker class with the below notable changes:

  1. It now reports transaction custom attributes to Newrelic instead of custom metrics
  2. Both transient and permanent errors (failures) are now reported as Boolean attributes
  3. Major functions are now fully tested, also with a new GitHub action to run on PRs and master branch pushes

Other changes:

  1. The worker does not sleep between handling jobs. It only sleeps when no jobs are found on the queue
  2. Unsupported jobs are now instrumented
  3. Job handling logic is extracted out in a new function to simplify the worker infinite running loop

Future work:

  1. Report enqueue time attributes
  2. Introduce a simple way for applications using this library to report more custom attributes
  3. Test other classes
  4. Report test coverage
  5. Cherry-pick commits to support python2.7 in the corresponding branch

@hammady hammady self-assigned this Dec 17, 2023
@hammady hammady changed the title Newrelic custom reporting Instrument using custom attributes + add tests Dec 17, 2023
@hammady hammady changed the title Instrument using custom attributes + add tests Instrument using custom attributes + add Worker tests Dec 18, 2023
@hammady hammady merged commit 03e31c6 into master Dec 18, 2023
1 check passed
@hammady hammady deleted the newrelic-custom-reporting branch December 18, 2023 19:16
hammady added a commit that referenced this pull request Dec 20, 2023
* Refactor worker to instrument errors
* Set up tests and test worker.run
* Add tests for worker.handle_job
* Add Github action to run tests
hammady added a commit that referenced this pull request Dec 21, 2023
* Instrument using custom attributes + add Worker tests (#18)
* Add tests to the Job class (#19)
* Add support for reporting extra fields if configured (#20)
* Add Reporter class for Newrelic abstraction and job utility (#21)
* Fix integration bugs + add report_raw and flatten dicts (#23)

* Patch GH action to work on python 2.7 only
* Downgrade pytest, PyYAML, psycopg2-binary to work with python 2.7
* Fix tests and job to be python 2.7 compatible
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants