Skip to content

Overridable classes to record and export events and audit logs #10545

Open
bsekachev wants to merge 21 commits intodevelopfrom
bs/refactored_events
Open

Overridable classes to record and export events and audit logs #10545
bsekachev wants to merge 21 commits intodevelopfrom
bs/refactored_events

Conversation

@bsekachev
Copy link
Copy Markdown
Member

@bsekachev bsekachev commented Apr 28, 2026

Motivation and context

This PR is mainly a code restructuring change for events and audit logging. The goal is to make both recording and export logic overridable via settings, without changing the existing behavior.

What changed

  • Added a new cvat/apps/events/record.py module with DefaultEventsRecorder

  • Moved core event recording logic there: request_info, record_server_event, record_client_events

  • Updated handlers.py so event handler functions keep their current role, but delegate recording to the recorder class

  • Enhanced event serializer class (payload must be an object)

  • Updated views.py so client event logging also goes through the same recorder abstraction

  • Added a settings-based extension point for the recorder: EVENTS_RECORDER_CLASS

  • Refactored cvat/apps/events/export.py around DefaultEventsExporter

    • Moved CSV creation into the exporter class
    • Extracted ClickHouse querying into a separate exporter method
  • Added a settings-based extension point for the exporter: EVENTS_EXPORTER_CLASS

  • Updated export entry points to use the resolved exporter class

Result
Functionally, this PR is intended to preserve the current implementation. The main change is structural: event recording and export are now organized around explicit, overridable classes, which makes them easier to customize in downstream repositories.

How has this been tested?

Checklist

  • I submit my changes into the develop branch
  • I have created a changelog fragment
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • I have linked related issues (see GitHub docs)

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.

@bsekachev bsekachev requested a review from SpecLad as a code owner April 28, 2026 15:32
@bsekachev bsekachev changed the title [WIP] Overridable classes to record and export events and audit logs Overridable classes to record and export events and audit logs Apr 28, 2026
@bsekachev
Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 28, 2026

Codecov Report

❌ Patch coverage is 80.95238% with 24 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cvat/apps/events/export.py 46.66% 16 Missing ⚠️
cvat/apps/events/record.py 93.15% 5 Missing ⚠️
cvat/apps/events/serializers.py 33.33% 2 Missing ⚠️
cvat/apps/events/handlers.py 93.33% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@bsekachev
Copy link
Copy Markdown
Member Author

@SpecLad review pls

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.

1 participant