bb-plane-fork/apps/api/plane
Nikhil 491b5bc6cc
[WEB-5575]feat: enhance APITokenLogMiddleware to support logging to MongoDB (#8241)
* feat: enhance APITokenLogMiddleware to support logging to MongoDB

- Added functionality to log external API requests to MongoDB, with a fallback to PostgreSQL if MongoDB is unavailable.
- Implemented error handling for MongoDB connection and logging operations.
- Introduced additional fields for MongoDB logs, including timestamps and user identifiers.
- Refactored request logging logic to streamline the process and improve maintainability.

* fix: improve MongoDB availability checks in APITokenLogMiddleware

- Enhanced the logic for determining MongoDB availability by checking if the collection is not None.
- Added a check for MongoDB configuration before attempting to retrieve the collection.
- Updated error handling to ensure the middleware correctly reflects the state of MongoDB connectivity.

* feat: implement logging functionality in logger_task for API activity

- Added a new logger_task module to handle logging of API activity to MongoDB and PostgreSQL.
- Introduced functions for safely decoding request/response bodies and processing logs based on MongoDB availability.
- Refactored APITokenLogMiddleware to utilize the new logging functions, improving code organization and maintainability.

* refactor: simplify MongoDB logging in logger_task and middleware

- Removed direct dependency on MongoDB collection in log_to_mongo function, now retrieving it internally.
- Updated process_logs to check MongoDB configuration before logging, enhancing error handling.
- Cleaned up logger.py by removing unused imports related to MongoDB.

* feat: add Celery task decorator to process_logs function in logger_task

- Introduced the @shared_task decorator to the process_logs function, enabling asynchronous processing of log data.
- Updated function signature to include a return type of None for clarity.
2025-12-10 01:01:10 +05:30
..
analytics chore: rename server to api (#7342) 2025-07-04 15:32:21 +05:30
api chore(deps): upgrade psycopg packages to version 3.3.0 (#8222) 2025-12-05 16:06:19 +05:30
app [WIKI-830] fix: copy clipboard functionality in the editor (#8229) 2025-12-10 00:24:36 +05:30
authentication [WEB-5583]feat: add avatar download and upload functionality in authentication adapter (#8247) 2025-12-09 15:48:27 +05:30
bgtasks [WEB-5575]feat: enhance APITokenLogMiddleware to support logging to MongoDB (#8241) 2025-12-10 01:01:10 +05:30
db [WEB-5285] feat: enhance ChangeTrackerMixin to capture changed fields on save (#8270) 2025-12-10 00:59:57 +05:30
license [WEB-5290] feat: selfhosted check (#8227) 2025-12-03 15:53:42 +05:30
middleware [WEB-5575]feat: enhance APITokenLogMiddleware to support logging to MongoDB (#8241) 2025-12-10 01:01:10 +05:30
seeds/data [WEB-5058] feat: enhance workspace seeding with cycles, modules, and views creation (#7951) 2025-10-11 20:55:48 +05:30
settings [WEB-5592] chore: add static files update settings for static files support (#8251) 2025-12-09 21:05:26 +05:30
space [WIKI-804] fix: refactor image uploader (#8210) 2025-12-05 13:20:15 +05:30
static [WEB-5592] chore: add static files update settings for static files support (#8251) 2025-12-09 21:05:26 +05:30
tests chore(deps): upgrade psycopg packages to version 3.3.0 (#8222) 2025-12-05 16:06:19 +05:30
throttles [WIKI-419] chore: new asset duplicate endpoint added (#7172) 2025-11-20 15:05:01 +05:30
utils [SILO-671] feat: add sticky external apis (#8139) 2025-12-01 18:57:54 +05:30
web chore: rename server to api (#7342) 2025-07-04 15:32:21 +05:30
__init__.py chore: rename server to api (#7342) 2025-07-04 15:32:21 +05:30
asgi.py chore: rename server to api (#7342) 2025-07-04 15:32:21 +05:30
celery.py [WEB-5044] fix: ruff lint and format errors (#7868) 2025-09-29 19:15:32 +05:30
urls.py [WEB-5044] fix: ruff lint and format errors (#7868) 2025-09-29 19:15:32 +05:30
wsgi.py chore: rename server to api (#7342) 2025-07-04 15:32:21 +05:30