chore: run telemetry cleanup on page start

This commit is contained in:
Cui Hongwei
2026-07-28 09:47:27 +08:00
parent d2136d125b
commit e1ec0213f5
2 changed files with 27 additions and 9 deletions

View File

@@ -5,7 +5,7 @@
1. 创建前端埋点日志表 dbo.TV_前端埋点事件日志
2. 创建写入存储过程 dbo.TV_前端埋点事件_写入
3. 创建清理存储过程 dbo.TV_前端埋点事件日志_清理
4. 写入时自动小批量清理 365 天以前的数据
4. 前端页面启动时调用清理过程,小批量清理 365 天以前的数据
*/
IF OBJECT_ID(N'dbo.TV_前端埋点事件日志', N'U') IS NULL
@@ -126,13 +126,6 @@ BEGIN
TRY_CONVERT(INT, NULLIF(@duration_ms, N'')), @success_bit, NULLIF(@error_code, N''), NULLIF(@error_message, N'')
);
DECLARE @insert_id BIGINT = CAST(SCOPE_IDENTITY() AS BIGINT);
EXEC dbo.[TV_前端埋点事件日志_清理]
@retention_days = 365,
@batch_size = 2000,
@return_result = 0;
SELECT @insert_id AS ID, N'1' AS result, N'写入成功' AS message;
SELECT CAST(SCOPE_IDENTITY() AS BIGINT) AS ID, N'1' AS result, N'写入成功' AS message;
END;
GO