Files
Athul 1897ee621e UN-2679 [FEAT] Add support for external usage tracking plugins (#1496)
* feat(UN-2679): Add support for external usage tracking plugins

- Pass request metadata through workflow execution chain
- Add execution context passing for plugin systems
- Support caching of request metadata during async execution

This enables the workflow execution system to pass context data
to optional plugins. All changes are backward compatible.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* refactor(UN-2679): Update API usage tracking with review feedback

- Pass request object to plugin instead of exposing headers in OSS
- Improve error handling and logging for resilience
- Remove internal implementation comments
- Make header caching non-fatal with proper error messages

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* UN-2679 Pass request.META instead of full request to plugin

Improve security by passing only request.META dictionary to the plugin
instead of the entire request object. This limits what the plugin can access
and provides a cleaner interface.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* UN-2679 Optimize to pass only request.META instead of full request

Since the request parameter was introduced in this PR for API hub usage tracking,
optimize it to only pass request.META which is all that's needed. This provides:
- Better interface clarity (parameter name shows what's needed)
- Improved security (no full request object passed around)
- Cleaner separation of concerns

Changes:
- api_deployment_views.py: Pass request.META instead of full request
- deployment_helper.py: Accept request_meta parameter instead of request

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* UN-2679 Clean up API hub usage tracking and switch to request.headers

Major improvements to API hub usage tracking:
- Switch from request.META to request.headers following doc-splitter pattern
- Simplify Celery task to call store_usage() directly with no header conversion
- Eliminate double header format conversion for better performance

Changes:
- api_deployment_views.py: Pass dict(request.headers) instead of request.META
- deployment_helper.py: Accept request_headers parameter
- file_execution_tasks.py: Direct store_usage() call, no double conversion

Performance: Eliminates unnecessary header format conversion
Security: Only passes required headers, not full request object

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Refactoring

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* improvements

* Updated usage_metrics to get page_count aloen

* Updated usage_metrics to page_count

* updated logic for fiel based usage tracking

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Refactoring as per git comments

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Removign unwanted code

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-08-26 15:53:49 +05:30
..
2025-08-08 10:22:19 +05:30