feat(observability): add structured application logging

Emit correlated JSON logs from the API and FunASR services, propagate request IDs to the client, and configure bounded opt-in Docker logging.

Document the host-wide Grafana/Loki query workflow and keep observability deployment ownership outside the application repository.
This commit is contained in:
2026-07-22 13:52:40 +08:00
parent a63e9a1705
commit a875fe9f63
30 changed files with 1261 additions and 817 deletions

View File

@@ -1,7 +1,9 @@
import {
copyApiRequestId,
createProfile,
deleteProfile as deleteProfileRequest,
getApiErrorMessage,
getApiRequestId,
getProfileDefaults,
listFeedbackRecords,
listProfiles
@@ -107,7 +109,8 @@ Page({
loading: false,
saving: false,
deletingId: '',
errorMessage: ''
errorMessage: '',
errorRequestId: ''
},
onShow() {
@@ -119,7 +122,7 @@ Page({
},
async refreshProfiles(showSuccess = false) {
this.setData({ loading: true, errorMessage: '' })
this.setData({ loading: true, errorMessage: '', errorRequestId: '' })
try {
const profiles = (await listProfiles()).map(withAcademicTermLabel)
const filteredProfiles = filterProfiles(
@@ -139,7 +142,7 @@ Page({
})
if (showSuccess) wx.showToast({ title: '档案已刷新', icon: 'success' })
} catch (error) {
this.setData({ errorMessage: getApiErrorMessage(error) })
this.setData({ errorMessage: getApiErrorMessage(error), errorRequestId: getApiRequestId(error) })
} finally {
this.setData({ loading: false })
}
@@ -153,6 +156,10 @@ Page({
void this.refreshProfiles()
},
copyRequestId() {
copyApiRequestId(this.data.errorRequestId)
},
onSearch(event: InputEvent) {
const query = event.detail.value
this.setData({