Skip to content

Commit 1e484c9

Browse files
authored
fix(observability): store usage audit sqlite under system data (volcengine#2149)
1 parent 05fe851 commit 1e484c9

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

openviking/observability/usage_audit/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Observability Event Bus
8383
| --- | --- | --- |
8484
| `enabled` | `true` | 是否启用 Usage/Audit |
8585
| `backend` | `"sqlite"` | 当前仅支持 SQLite |
86-
| `sqlite_path` | `null` | SQLite 文件路径;为空时使用 OpenViking workspace 下的 `usage_audit.sqlite3` |
86+
| `sqlite_path` | `null` | SQLite 文件路径;为空时使用 OpenViking workspace 下的 `_system/usage_audit/usage_audit.sqlite3` |
8787
| `queue_size` | `10000` | 后台写入队列大小 |
8888
| `batch_size` | `500` | 单次批量写入的最大事件数 |
8989
| `flush_interval_seconds` | `1.0` | worker 定时 flush 间隔 |
@@ -409,7 +409,7 @@ Console BFF 查询的是账号级聚合和审计明细,当前只允许 `ROOT`
409409
如果没有配置 `sqlite_path`,默认在 OpenViking workspace 下:
410410

411411
```text
412-
<workspace>/usage_audit.sqlite3
412+
<workspace>/_system/usage_audit/usage_audit.sqlite3
413413
```
414414

415415
可以通过 `server.observability.usage_audit.sqlite_path` 显式指定。

openviking/observability/usage_audit/runtime.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
logger = logging.getLogger(__name__)
2525

2626
_SUBSCRIBER_NAME = "usage_audit"
27+
_DEFAULT_SQLITE_RELATIVE_PATH = Path("_system") / "usage_audit" / "usage_audit.sqlite3"
2728

2829

2930
@dataclass(slots=True)
@@ -45,7 +46,7 @@ def _resolve_sqlite_path(config: ServerConfig) -> Path:
4546
workspace = Path(ov_config.storage.workspace).expanduser().resolve()
4647
except Exception: # noqa: BLE001
4748
workspace = DEFAULT_CONFIG_DIR
48-
return workspace / "usage_audit.sqlite3"
49+
return workspace / _DEFAULT_SQLITE_RELATIVE_PATH
4950

5051

5152
async def init_usage_audit_from_server_config(

0 commit comments

Comments
 (0)