Skip to content

Commit 5ba467a

Browse files
AptS-1547AptS-1548
andcommitted
release: v0.5.0-beta.2
Co-Authored-By: AptS-1548 <apts-1548@esaps.net>
1 parent c11f532 commit 5ba467a

1 file changed

Lines changed: 59 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,63 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [v0.5.0-beta.2] - 2026-02-06
9+
10+
### 🎉 Release Highlights
11+
12+
v0.5.0-beta.2 是一次性能优化与架构改进版本,主要亮点:
13+
14+
- **Analytics 异步处理架构** - 使用 crossbeam-channel 将详细日志处理从热路径移出,减少重定向延迟
15+
- **点击日志采样率控制** - 新增 `analytics.sample_rate``analytics.max_log_rows` 配置,按需控制日志量
16+
- **数据库索引优化** - 新增 4 个索引优化分析查询性能
17+
- **链接导出游标分页** - 大数据量导出性能提升 10-100 倍
18+
19+
### Added
20+
- **点击日志采样率控制** - 新增运行时配置
21+
- `analytics.sample_rate` (float, 默认 1.0) - 点击日志采样率,支持 0.0-1.0
22+
- `analytics.max_log_rows` (int, 默认 0) - `click_logs` 表最大行数限制,0 表示无限制
23+
- `analytics.max_rows_action` (enum, `cleanup`/`stop`) - 超过限制时的行为
24+
- **数据库索引优化** - 新增两个迁移文件
25+
- `idx_click_logs_source_time`: `(source, clicked_at)` 复合索引
26+
- `idx_click_logs_geo`: `(country, city, clicked_at)` 复合索引
27+
- `idx_stats_hourly_code`: `click_stats_hourly.short_code` 索引
28+
- `idx_user_agents_is_bot`: `user_agents.is_bot` 索引
29+
- **链接导出游标分页** - 使用 `short_code` 作为游标替代 OFFSET 分页
30+
- **新增 Metrics** - `shortlinker_clicks_channel_dropped` 统计详细点击事件丢弃次数
31+
32+
### Improved
33+
- **Analytics 异步处理** - 引入 crossbeam-channel 事件队列
34+
- 热路径只发送原始数据到 channel(无 spawn 开销)
35+
- 单独的 event_processor 协程消费 channel,批量处理详细日志
36+
- **小时汇总批量 Upsert** - 使用 `ON CONFLICT DO UPDATE` 单次数据库交互完成所有汇总写入
37+
- **Moka 缓存 TTL 抖动** - 为所有 TTL 添加 ±10% 随机抖动,避免缓存雪崩
38+
- **Bloom Filter 预留策略** - 分段预留(小规模 50%,中等 20%,大规模 10%)
39+
- **数据库连接池优化** - SQLite 最大连接数 5→10,通用后端 pool_size 10→20
40+
- **分析查询内存保护** - 时间范围限制 90 天,聚合 key 限制 1000
41+
42+
### Refactored
43+
- **Metrics 依赖注入** - 引入 `MetricsRecorder` trait 解耦指标收集
44+
- 测试时可使用 `NoopMetrics`
45+
- 模块不再依赖全局单例
46+
- **日志级别调整** - 多处 `warn!` 调整为 `info!`,减少正常运行时的 WARNING 噪音
47+
- **重试逻辑增强** - 新增死锁和锁超时检测(MySQL/PostgreSQL/SQLite)
48+
49+
### Fixed
50+
- **点击刷盘 SQLite 变量限制** - 分批处理,每批最多 400 条记录
51+
- **关闭时刷盘重试** - 增加 3 次重试机制,每次 30 秒超时
52+
53+
### Dependencies
54+
- 新增 `crossbeam-channel` 0.5 用于 Analytics 事件队列
55+
56+
### Docs
57+
- 更新配置文档,新增采样率相关配置说明
58+
- Cloudflare Worker 文档状态调整为"实验中"
59+
- Docker 文档示例版本号改为占位符
60+
61+
### Breaking Changes
62+
- **Metrics Feature API 签名变化** - `SeaOrmStorage::new``CompositeCache::create``ClickManager::new` 需要传入 `metrics` 参数
63+
- **JWT 配置需重启** - `api.jwt_secret``api.access_token_minutes``api.refresh_token_days` 现在需要重启生效
64+
865
## [v0.5.0-beta.1] - 2026-02-06
966

1067
### 🎉 Release Highlights
@@ -1402,7 +1459,8 @@ v0.3.0 是一个重大版本更新,包含大量安全增强、性能优化和
14021459
- Update README.md
14031460
- Initial commit
14041461

1405-
[Unreleased]: https://github.com/AptS-1547/shortlinker/compare/v0.5.0-beta.1...HEAD
1462+
[Unreleased]: https://github.com/AptS-1547/shortlinker/compare/v0.5.0-beta.2...HEAD
1463+
[v0.5.0-beta.2]: https://github.com/AptS-1547/shortlinker/compare/v0.5.0-beta.1...v0.5.0-beta.2
14061464
[v0.5.0-beta.1]: https://github.com/AptS-1547/shortlinker/compare/v0.5.0-alpha.6...v0.5.0-beta.1
14071465
[v0.5.0-alpha.6]: https://github.com/AptS-1547/shortlinker/compare/v0.5.0-alpha.5...v0.5.0-alpha.6
14081466
[v0.5.0-alpha.5]: https://github.com/AptS-1547/shortlinker/compare/v0.5.0-alpha.4...v0.5.0-alpha.5

0 commit comments

Comments
 (0)