feat: accept, store and expose client diagnostics
CI / chart (push) Successful in 3s
CI / test (push) Successful in 2m20s
CI / chart-push (push) Successful in 6s
CI / image (push) Successful in 3m39s

- V11 client_logs table with per-user storage and retention/pruning
- POST/GET/DELETE /logs with batch validation, rate limit and admin access
- redact bearer tokens, Authorization headers and query/JSON secrets twice
- add X-Request-Id to responses and include it in the server log pattern
- report client error entries immediately in the server log
- scripts/logs.sh for source-side retrieval and clearing
- chart knobs CLIENT_LOG_RETENTION_DAYS and CLIENT_LOG_MAX_ROWS_PER_USER
This commit is contained in:
TapTap committed 2026-11-20 13:43:05 +00:00
1 parent 91312faa1c
commit 44b75c4d4d
19 files changed
+981 -5

No files matched your search

@@ -44,6 +44,49 @@ data class DeviceDto(
val current: Boolean,
)
@Serializable
data class ClientLogEntryDto(
/** Device clock in epoch milliseconds; informational, the server clamps it. */
val timestamp: Long = 0,
val level: String,
val tag: String,
val message: String,
val detail: String? = null,
val sessionId: String? = null,
)
@Serializable
data class ClientLogBatchDto(
val deviceId: String = "unknown",
val platform: String = "unknown",
val appVersion: String = "unknown",
val entries: List<ClientLogEntryDto> = emptyList(),
)
@Serializable
data class ClientLogDto(
val id: Long,
val deviceId: String,
val platform: String,
val appVersion: String,
val sessionId: String? = null,
val level: String,
val tag: String,
val message: String,
val detail: String? = null,
val createdAt: String,
val receivedAt: String,
)
@Serializable
data class ClientLogsDto(val logs: List<ClientLogDto>)
@Serializable
data class ClientLogsAcceptedDto(val accepted: Int)
@Serializable
data class ClientLogsDeletedDto(val deleted: Int)
@Serializable
data class ServerInfoDto(
val defaultSource: String,
@@ -51,6 +94,8 @@ data class ServerInfoDto(
val deezerQuality: Int,
val loudnessEnabled: Boolean,
val loudnessTargetLufs: Double,
/** How long the server keeps uploaded client diagnostics. */
val clientLogRetentionDays: Int,
)
@Serializable