Skip to content

Enable the dynamic registration of context managers for request processing (i.e. event_tracking()) #18211

Closed
@jeremystretch

Description

@jeremystretch

NetBox version

v4.1.8

Feature type

Change to existing functionality

Triage priority

N/A

Proposed functionality

NetBox currently employs its event_tracking() context manager to process events triggered by a request, e.g. for change change logging. This function is invoked explicitly by the CoreMiddleware class.

Instead of calling this function directly, we can register it within NetBox's application registry, and consult the registry for all registered request processors whenever necessary, including within the middleware as well as for other purposes (such as running a background job).

Use case

This approach will enable to us to dynamically register additional request processors, such as those which may be introduced by plugins, without the need for explicit configuration. #18136 raises one such use case.

Database changes

N/A

External dependencies

N/A

Metadata

Metadata

Assignees

Labels

complexity: mediumRequires a substantial but not unusual amount of effort to implementstatus: acceptedThis issue has been accepted for implementationtype: featureIntroduction of new functionality to the application

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions