Repository navigation
Conversation
9b10059 to
b12a35e
Compare
|
@pwnage101 @feanil I took over openedx/openedx-filters#344 and brought the changes over to this PR, along with a rebase and fixes for the outstanding review comments. Could you review this so we can take it forward? |
Adds the ManagementCommandContextmanagerRequested filter under the openedx_filters.management package. The filter is invoked in manage.py before a Django management command is executed, allowing pipeline steps to wrap the command's execution in a context manager (for example, to add observability such as Datadog tracing and structured logging) without changing each command individually, since management commands don't go through Django's normal request middleware. Supersedes openedx#344, rebased onto main to resolve conflicts, with the version bump and changelog entry requested in review. # Conflicts: # src/openedx_filters/__init__.py
b12a35e to
a1b9159
Compare
feanil
left a comment
There was a problem hiding this comment.
The docs need an update too. Add a management section for this filter to docs/reference/filters.rst, and add the management subdomain to docs/reference/architecture-subdomains.rst since the new filter_type uses it.
Done. Added the Management section to docs/reference/filters.rst and added the Management architecture subdomain to docs/reference/architecture-subdomains.rst. |
feanil
left a comment
There was a problem hiding this comment.
@openedx/committers-openedx-filters I think this new filter is good to go but not sure if any of you want to review this?
felipemontoya
left a comment
There was a problem hiding this comment.
This looks useful, it is implemented according to the standard and is in good form.
I think the 'management' domain is a bit on the technical side, while the other domains came from the product lifecycle domains, but I can understand that management has it's own nuance.
|
@feanil / @pwnage101 Can you guys merge this PR? I’ll bump the dependency in openedx-platform#39194, replace the local class with an import from |
Summary
Adds the
ManagementCommandContextmanagerRequestedfilter underopenedx_filters.management. The filter is triggered inmanage.pybefore a Django management command executes, and lets pipeline steps wrap the command's execution in a context manager (for example, to add observability such as Datadog tracing, custom attributes, or structured logging).Management commands don't go through Django's normal request middleware, so this gives pipeline authors one shared instrumentation point instead of having to modify every command individually.
Why this PR (supersedes #344)
This supersedes #344 — that PR's branch lives on a fork that can no longer be updated, so this PR continues the same work on a new branch. All outstanding review feedback from #344 is carried over here: the output tuple now matches the input signature (command_contextmanager, command_name, service_variant); the trigger repository is corrected to openedx/openedx-platform; the docstring is expanded to explain why the filter exists (management commands skip middleware) and includes a usage example, addressing the request for "a more detailed docstring about the expected use case"; tests use pytest-style assert statements; the version is bumped 3.14.0 to 3.15.0 with a changelog fragment added via scriv; commits are squashed into one; and the branch is rebased onto current main.
Original implementation credit is preserved via the commit author.
Testing instructions
Ran
pytest openedx_filters/management/(1 test, passes) and the full suitepytest(116 passed). Also ranpycodestyle --max-line-length=120 openedx_filters/management/filters.pywith no violations.Other information
Supersedes #344, which will be closed with a link to this PR. Downstream, edx-platform PR 200, edx-filters-pipelines PR 16, and edx-internal PR 14130 depend on this being released to bump their openedx-filters pin. CI (Python CI / Lint Commit Messages) is queued behind maintainer approval since this is a first PR from this fork account, so it hasn't run yet.
Merge checklist status
Done: changelog entry added via scriv, docstring/documentation updated, no new dependencies, commits squashed into one, unit tests added. Not yet: reviewer approval, CI build (queued on maintainer approval to run). Post-merge steps (release workflow, PyPI check, branch deletion, bumping the package in downstream Open edX platform requirements) are not started.