BPMN reporting decorator for Azure Functions
Project description
BPMN Reporting Decorator
A Pythonic decorator to track function execution and report events (STARTED, COMPLETED, ERROR) in the background.
Features
- Non-blocking: Uses
asyncio.create_taskto fire events while your code runs. - Async & Sync: Works with both
async defand standarddeffunctions. - Masking: Built-in support for Mustache-based payload transformation.
- Error Tracking: Automatically reports exceptions before re-raising them.
Usage
1. Basic Setup
Wrap any function to track its lifecycle.
import asyncio
from bpmn_reporting import bpmn_element
@bpmn_element(id="User_Task_01", process_id="Order_Process")
async def my_business_logic(data):
# Do work here
return {"status": "processed"}
# Execute
if __name__ == "__main__":
asyncio.run(my_business_logic({"id": 123}))
2. Masking & Transformations
Use mask_params to remove sensitive data or reformat payloads using Mustache templates or functions.
@bpmn_element(
id="Process_Payment",
mask_params={
"password": None, # Removes field from reporting
"total": "{{amount}} {{ccy}}", # Recomputes field using Mustache
"user": lambda p: p['email'] # Recomputes using a function
}
)
async def process_payment(payload):
# original payload: {"password": "123", "amount": 10, "ccy": "EUR", "email": "mario@test.com"}
return {"tx_id": "ABC-123"}
Configuration
Set the following environment variables in your local .env or Azure Function App settings:
| Variable | Required | Description | Default |
|---|---|---|---|
| REPORTING_SERVER | true | Base URL of the reporting API | |
| REPORTING_PROCESS_ID | Default Process ID if not set in decorator | ||
| REPORTING_PROCESS_VERSION | Version of the process | 1.0 | |
| REPORTING_PROCESS_DEBUG | Set to true to see event logs | false |
Testing
python3 -m pytest tests/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file process_reporting-1.1.5.tar.gz.
File metadata
- Download URL: process_reporting-1.1.5.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b256f773cf41f61d099a99bf0c2a65211e71a5d34f33ea32a6aa1c974ae9d21d
|
|
| MD5 |
232d0d0ed837ba82d316541520fd1f29
|
|
| BLAKE2b-256 |
f68ae72c74189b42d5b31da5ea37ddf71f1af83517bc3bfc03a6a575617a3443
|
File details
Details for the file process_reporting-1.1.5-py2.py3-none-any.whl.
File metadata
- Download URL: process_reporting-1.1.5-py2.py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e6fd41383f8dc913682670cd514fbaa5f78359c933fda84122f2e9e273910bb0
|
|
| MD5 |
8f859bbd12e977ab0c1abf62850373b5
|
|
| BLAKE2b-256 |
182635fc5f4cc97dfeda450296b7106088c5df8e45543738620ba2569e83a7e7
|