refactor: streamline usage reporting by consolidating record publishing logic

- Introduced a new method `buildRecord` in `usageReporter` to encapsulate record creation, improving code readability and maintainability.
- Added latency tracking to usage records, ensuring accurate reporting of request latencies.
- Updated tests to validate the inclusion of latency in usage records and ensure proper functionality of the new reporting structure.
This commit is contained in:
clcc2019
2026-03-20 19:44:26 +08:00
parent db63f9b5d6
commit c1bf298216
5 changed files with 163 additions and 24 deletions
+1
View File
@@ -17,6 +17,7 @@ type Record struct {
AuthIndex string
Source string
RequestedAt time.Time
Latency time.Duration
Failed bool
Detail Detail
}