Skip to content

Commit 76921c2

Browse files
committed
⭐ hl: change audit path config to audit url.
1 parent d383ce3 commit 76921c2

12 files changed

Lines changed: 93 additions & 116 deletions

File tree

README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -241,22 +241,22 @@ it will use default value and do not raise any error to you.
241241
> The config value that you will set on the environment should combine with
242242
> prefix, component, and name which is `WORKFLOW_{component}_{name}` (Upper case).
243243
244-
| Name | Component | Default | Description |
245-
|:----------------------------|:---------:|:----------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------|
246-
| **REGISTRY_CALLER** | CORE | `.` | List of importable string for the call stage. |
247-
| **REGISTRY_FILTER** | CORE | `ddeutil.workflow.templates` | List of importable string for the filter template. |
248-
| **CONF_PATH** | CORE | `./conf` | The config path that keep all template `.yaml` files. |
249-
| **TIMEZONE** | CORE | `Asia/Bangkok` | A Timezone string value that will pass to `ZoneInfo` object. |
250-
| **STAGE_DEFAULT_ID** | CORE | `false` | A flag that enable default stage ID that use for catch an execution output. |
251-
| **GENERATE_ID_SIMPLE_MODE** | CORE | `true` | A flog that enable generating ID with `md5` algorithm. |
252-
| **DEBUG_MODE** | LOG | `true` | A flag that enable logging with debug level mode. |
253-
| **FORMAT** | LOG | `%(asctime)s.%(msecs)03d (%(name)-10s, %(process)-5d,%(thread)-5d) [%(levelname)-7s] %(message)-120s (%(filename)s:%(lineno)s)` | A trace message console format. |
254-
| **FORMAT_FILE** | LOG | `{datetime} ({process:5d}, {thread:5d}) {message:120s} ({filename}:{lineno})` | A trace message format that use to write to target pointer. |
255-
| **DATETIME_FORMAT** | LOG | `%Y-%m-%d %H:%M:%S` | A datetime format of the trace log. |
256-
| **TRACE_URL** | LOG | `file:./logs` | A pointer URL of trace log that use to emit log message. |
257-
| **TRACE_ENABLE_WRITE** | LOG | `false` | A flag that enable writing trace log. |
258-
| **AUDIT_PATH** | LOG | `./audits` | A pointer of audit log that use to store. |
259-
| **AUDIT_ENABLE_WRITE** | LOG | `true` | A flag that enable writing audit log after end execution in the workflow release step. |
244+
| Name | Component | Default | Description |
245+
|:----------------------------|:---------:|:--------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------|
246+
| **REGISTRY_CALLER** | CORE | `.` | List of importable string for the call stage. |
247+
| **REGISTRY_FILTER** | CORE | `ddeutil.workflow.templates` | List of importable string for the filter template. |
248+
| **CONF_PATH** | CORE | `./conf` | The config path that keep all template `.yaml` files. |
249+
| **TIMEZONE** | CORE | `Asia/Bangkok` | A Timezone string value that will pass to `ZoneInfo` object. |
250+
| **STAGE_DEFAULT_ID** | CORE | `false` | A flag that enable default stage ID that use for catch an execution output. |
251+
| **GENERATE_ID_SIMPLE_MODE** | CORE | `true` | A flog that enable generating ID with `md5` algorithm. |
252+
| **DEBUG_MODE** | LOG | `true` | A flag that enable logging with debug level mode. |
253+
| **FORMAT** | LOG | `%(asctime)s.%(msecs)03d (%(name)-10s, %(process)-5d,%(thread)-5d) [%(levelname)-7s] %(message)-120s (%(filename)s:%(lineno)s)` | A trace message console format. |
254+
| **FORMAT_FILE** | LOG | `{datetime} ({process:5d}, {thread:5d}) {message:120s} ({filename}:{lineno})` | A trace message format that use to write to target pointer. |
255+
| **DATETIME_FORMAT** | LOG | `%Y-%m-%d %H:%M:%S` | A datetime format of the trace log. |
256+
| **TRACE_URL** | LOG | `file:./logs` | A pointer URL of trace log that use to emit log message. |
257+
| **TRACE_ENABLE_WRITE** | LOG | `false` | A flag that enable writing trace log. |
258+
| **AUDIT_URL** | LOG | `file:./audits` | A pointer URL of audit log that use to write audit metrix. |
259+
| **AUDIT_ENABLE_WRITE** | LOG | `true` | A flag that enable writing audit log after end execution in the workflow release step. |
260260

261261
## :rocket: Deployment
262262

docs/api/audits.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ File-based audit implementation that persists audit logs to the local filesystem
5454
audit.save()
5555

5656
# Log is saved to:
57-
# {audit_path}/workflow=data-pipeline/release=20240115103000/workflow-123.log
57+
# {audit_url.path}/workflow=data-pipeline/release=20240115103000/workflow-123.log
5858
```
5959

6060
#### Audit File Structure
@@ -183,17 +183,17 @@ The `context` field contains comprehensive execution information:
183183

184184
## Audit Factory
185185

186-
### `get_audit`
186+
### `get_audit_model`
187187

188188
Factory function that returns the appropriate audit implementation based on configuration.
189189

190190
!!! example "Dynamic Audit Creation"
191191

192192
```python
193-
from ddeutil.workflow.audits import get_audit
193+
from ddeutil.workflow.audits import get_audit_model
194194

195195
# Automatically selects appropriate audit implementation
196-
audit = get_audit(
196+
audit = get_audit_model(
197197
name="data-pipeline",
198198
type="scheduled",
199199
release=datetime.now(),
@@ -240,11 +240,11 @@ Audits are automatically created and managed during workflow execution:
240240

241241
Audit behavior is controlled by environment variables:
242242

243-
| Variable | Default | Description |
244-
|----------|---------|-------------|
245-
| `WORKFLOW_CORE_AUDIT_PATH` | `./logs/audits` | Path for audit file storage |
246-
| `WORKFLOW_CORE_ENABLE_WRITE_AUDIT` | `false` | Enable/disable audit logging |
247-
| `WORKFLOW_CORE_AUDIT_EXCLUDED` | `[]` | Fields to exclude from audit logs |
243+
| Variable | Default | Description |
244+
|------------------------------------|-----------------|-----------------------------------|
245+
| `WORKFLOW_CORE_AUDIT_URL` | `./logs/audits` | Path for audit file storage |
246+
| `WORKFLOW_CORE_ENABLE_WRITE_AUDIT` | `false` | Enable/disable audit logging |
247+
| `WORKFLOW_CORE_AUDIT_EXCLUDED` | `[]` | Fields to exclude from audit logs |
248248

249249
!!! example "Configuration"
250250

@@ -253,7 +253,7 @@ Audit behavior is controlled by environment variables:
253253
export WORKFLOW_CORE_ENABLE_WRITE_AUDIT=true
254254

255255
# Set custom audit path
256-
export WORKFLOW_CORE_AUDIT_PATH=/var/log/workflow/audits
256+
export WORKFLOW_CORE_AUDIT_URL=/var/log/workflow/audits
257257

258258
# Exclude sensitive fields
259259
export WORKFLOW_CORE_AUDIT_EXCLUDED='["params.password", "context.secrets"]'

docs/configuration.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,22 @@ The main configuration that use to dynamic changing with your objective of this
1414
application. If any configuration values do not set yet, it will use default value
1515
and do not raise any error to you.
1616

17-
| Name | Component | Default | Description |
18-
|:----------------------------|:---------:|:----------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------|
19-
| **REGISTRY_CALLER** | CORE | `.` | List of importable string for the call stage. |
20-
| **REGISTRY_FILTER** | CORE | `ddeutil.workflow.templates` | List of importable string for the filter template. |
21-
| **CONF_PATH** | CORE | `./conf` | The config path that keep all template `.yaml` files. |
22-
| **TIMEZONE** | CORE | `Asia/Bangkok` | A Timezone string value that will pass to `ZoneInfo` object. |
23-
| **STAGE_DEFAULT_ID** | CORE | `false` | A flag that enable default stage ID that use for catch an execution output. |
24-
| **GENERATE_ID_SIMPLE_MODE** | CORE | `true` | A flog that enable generating ID with `md5` algorithm. |
25-
| **DEBUG_MODE** | LOG | `true` | A flag that enable logging with debug level mode. |
26-
| **FORMAT** | LOG | `%(asctime)s.%(msecs)03d (%(name)-10s, %(process)-5d,%(thread)-5d) [%(levelname)-7s] %(message)-120s (%(filename)s:%(lineno)s)` | A trace message console format. |
27-
| **FORMAT_FILE** | LOG | `{datetime} ({process:5d}, {thread:5d}) {message:120s} ({filename}:{lineno})` | A trace message format that use to write to target pointer. |
28-
| **DATETIME_FORMAT** | LOG | `%Y-%m-%d %H:%M:%S` | A datetime format of the trace log. |
29-
| **TRACE_URL** | LOG | `file:./logs` | A pointer URL of trace log that use to emit log message. |
30-
| **TRACE_ENABLE_WRITE** | LOG | `false` | A flag that enable writing trace log. |
31-
| **AUDIT_PATH** | LOG | `./audits` | A pointer of audit log that use to store. |
32-
| **AUDIT_ENABLE_WRITE** | LOG | `true` | A flag that enable writing audit log after end execution in the workflow release step. |
17+
| Name | Component | Default | Description |
18+
|:----------------------------|:---------:|:--------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------|
19+
| **REGISTRY_CALLER** | CORE | `.` | List of importable string for the call stage. |
20+
| **REGISTRY_FILTER** | CORE | `ddeutil.workflow.templates` | List of importable string for the filter template. |
21+
| **CONF_PATH** | CORE | `./conf` | The config path that keep all template `.yaml` files. |
22+
| **TIMEZONE** | CORE | `Asia/Bangkok` | A Timezone string value that will pass to `ZoneInfo` object. |
23+
| **STAGE_DEFAULT_ID** | CORE | `false` | A flag that enable default stage ID that use for catch an execution output. |
24+
| **GENERATE_ID_SIMPLE_MODE** | CORE | `true` | A flog that enable generating ID with `md5` algorithm. |
25+
| **DEBUG_MODE** | LOG | `true` | A flag that enable logging with debug level mode. |
26+
| **FORMAT** | LOG | `%(asctime)s.%(msecs)03d (%(name)-10s, %(process)-5d,%(thread)-5d) [%(levelname)-7s] %(message)-120s (%(filename)s:%(lineno)s)` | A trace message console format. |
27+
| **FORMAT_FILE** | LOG | `{datetime} ({process:5d}, {thread:5d}) {message:120s} ({filename}:{lineno})` | A trace message format that use to write to target pointer. |
28+
| **DATETIME_FORMAT** | LOG | `%Y-%m-%d %H:%M:%S` | A datetime format of the trace log. |
29+
| **TRACE_URL** | LOG | `file:./logs` | A pointer URL of trace log that use to emit log message. |
30+
| **TRACE_ENABLE_WRITE** | LOG | `false` | A flag that enable writing trace log. |
31+
| **AUDIT_URL** | LOG | `file:./audits` | A pointer URL of audit log that use to write audit metrix. |
32+
| **AUDIT_ENABLE_WRITE** | LOG | `true` | A flag that enable writing audit log after end execution in the workflow release step. |
3333

3434
## Execution Override
3535

src/ddeutil/workflow/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
from .audits import (
5353
Audit,
5454
FileAudit,
55-
get_audit,
55+
get_audit_model,
5656
)
5757
from .conf import *
5858
from .errors import (

0 commit comments

Comments
 (0)