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

feat!: switch code owner middleware to signals #866

Merged
merged 2 commits into from
Dec 5, 2024

Conversation

robrap
Copy link
Contributor

@robrap robrap commented Dec 4, 2024

Initial rollout of moving code_owner monitoring code from edx-django-utils proved that the new
CodeOwnerMonitoringMiddleware was not added high enough in the middleware stack. Instead, we have added signals to edx-django-utils's MonitoringSupportMiddleware, and this datadog_monitoring plugin now listens to those signals in order to automatically add code_owner custom span tags for django requests.

BREAKING CHANGE: Removes CodeOwnerMonitoringMiddleware.

See #784

Merge checklist:
Check off if complete or not applicable:

  • Version bumped
  • Changelog record added
  • Documentation updated (not only docstrings)
  • Fixup commits are squashed away
  • Unit tests added/updated
  • Manual testing instructions provided
  • Noted any: Concerns, dependencies, migration issues, deadlines, tickets

Copy link
Member

@timmc-edx timmc-edx left a comment

Choose a reason for hiding this comment

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

See suggestions and nits, but overall looks great. (Did not review tests.)

CHANGELOG.rst Outdated Show resolved Hide resolved
CHANGELOG.rst Outdated Show resolved Hide resolved
Comment on lines 25 to 26
if 'request' in kwargs:
set_code_owner_attribute(kwargs['request'])
Copy link
Member

Choose a reason for hiding this comment

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

It's probably worth just documenting the provided kwargs in edx-django-utils so we can put them directly in the receiver function's signature.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. I added directly to the signature, but I left the defensive code, since this is for monitoring. Thoughts?
  2. Can you explain where you want to see the kwargs documented? Do you mean here https://github.com/openedx/edx-django-utils/blob/master/edx_django_utils/monitoring/README.rst#monitoring-support-middleware-and-monitoring-plugins? Other? Do you think this is an important change, or is it close enough to simply allow someone to search for the implementation?

Copy link
Member

Choose a reason for hiding this comment

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

I don't think the defensive code is needed, since e-d-u is using send_robust.

I'd say document the kwargs where ever you've got other documentation -- either in the rST there or in docstrings. In my opinion it would be best for it to be as close to the code as possible, so that changes to the code are more likely to involve changes to docs/comments, but rST is probably fine too, since that's already where you describe the role and usage of the signals.

Initial rollout of moving code_owner monitoring code from
edx-django-utils proved that the new
CodeOwnerMonitoringMiddleware was not added high enough
in the middleware stack. Instead, we have added signals
to edx-django-utils's MonitoringSupportMiddleware, and
this datadog_monitoring plugin now listens to those
signals in order to automatically add code_owner custom
span tags for django requests.

BREAKING CHANGE: Removes CodeOwnerMonitoringMiddleware.

See #784
- add min constraint edx-django-utils>=7.1.0
- change changelog date and fix typo
- * add unreleased changelog to 6.0.0
- add request argument
@robrap robrap force-pushed the robrap/code-owner-middleware-to-signals branch from cf5a688 to 57ef2d5 Compare December 5, 2024 20:47
@robrap robrap merged commit f82e4d3 into main Dec 5, 2024
6 checks passed
@robrap robrap deleted the robrap/code-owner-middleware-to-signals branch December 5, 2024 20:56
@robrap
Copy link
Contributor Author

robrap commented Dec 5, 2024

Note: I confirmed that all uses of CodeOwnerMonitoringMiddleware have been removed.

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.

2 participants