mirror of
https://github.com/mohamadihsan/topuponline.git
synced 2026-12-05 10:46:28 +00:00
docs: improve Grafana top-up log investigation
This commit is contained in:
@@ -81,9 +81,12 @@ Sesi yang berhenti sebelum detail tersimpan belum memiliki hubungan ini.
|
||||
{app="topuponline"} | json | request_id="e6aa798c-c8c2-440e-a39b-66bcfbde2f58"
|
||||
{app="topuponline"} | json | route="/api/login" | message="Password is wrong."
|
||||
{app="topuponline"} | json | event="reservation_topup_link" | reservation_number="RBLTEST261124000023"
|
||||
{app="topuponline"} | json | unique_code="1234567890121"
|
||||
{app="topuponline"} | json | event=~"http_request|http_response|http_request_aborted|reservation_topup_link" | (reservation_number="RBLTEST261124000023" or unique_code="1234567890121")
|
||||
```
|
||||
|
||||
Lihat [panduan investigasi Grafana](docs/grafana/topup-observability.md)
|
||||
untuk menelusuri detail `application_log` saat ada error.
|
||||
|
||||
## Kapasitas koneksi PostgreSQL
|
||||
|
||||
Pengaturan pool utama dan pool tambahan ada di `knexfile.js`.
|
||||
|
||||
@@ -14,8 +14,9 @@ request ID, atau durasi minimum.
|
||||
`request_id` dari header. ID ini unik untuk satu request. ID HSM dapat dipakai
|
||||
oleh beberapa request, sehingga hasil `trx_id` bisa lebih dari satu baris.
|
||||
- Loki menyimpan `trx_id`, `request_id`, dan `response_time_ms` di isi JSON log.
|
||||
ID HSM dicatat dalam huruf kecil. Log respons sukses dipublikasikan di level
|
||||
`info`, sedangkan respons gagal dipublikasikan di level `error`.
|
||||
ID HSM dicatat dalam huruf kecil. Respons sukses pada route transaksi
|
||||
dicatat di level `info`. Penolakan aplikasi dicatat di `warn` dan kegagalan
|
||||
backend di `error`.
|
||||
- `http_status` memuat status HTTP, sedangkan `status_code` memuat kode aplikasi.
|
||||
|
||||
```logql
|
||||
@@ -30,14 +31,40 @@ request ID, atau durasi minimum.
|
||||
{app="topuponline"} |= "http_response" | json | event="http_response" | response_time_ms >= 1000 | __error__=""
|
||||
```
|
||||
|
||||
## Menelusuri reservasi sampai Top Up Step 8
|
||||
|
||||
1. Ambil `unique_code` dari event penghubung Step 6.
|
||||
|
||||
```logql
|
||||
{app="topuponline"} | json | event="reservation_topup_link" | reservation_number="<RBL>"
|
||||
```
|
||||
|
||||
2. Tampilkan timeline HTTP dan event penghubung dengan RBL serta kode sesi.
|
||||
|
||||
```logql
|
||||
{app="topuponline"}
|
||||
| json
|
||||
| event=~"http_request|http_response|http_request_aborted|reservation_topup_link"
|
||||
| (reservation_number="<RBL>" or unique_code="<KODE_SESI>")
|
||||
```
|
||||
|
||||
Respons Step 1 bisa ditemukan lewat kode sesi. Event request awal Step 1
|
||||
ditulis sebelum kode sesi dibuat. Cari langsung berdasarkan `request_id`
|
||||
untuk melihat baris awal tersebut. Tambahkan filter `event="application_log"`
|
||||
untuk melihat detail handler saat ada error.
|
||||
|
||||
```logql
|
||||
{app="topuponline"} | json | event="application_log" | request_id="<X-Request-Id>"
|
||||
```
|
||||
|
||||
## Mengambil stdout melalui Promtail
|
||||
|
||||
Aplikasi menulis satu objek JSON per baris ke stdout. URL tujuan Loki berada
|
||||
di konfigurasi Promtail. Tambahkan label stream `app=topuponline` di target
|
||||
scrape agar dashboard dan kueri di atas tetap menemukan log.
|
||||
Respons terpantau menggunakan `event=http_response`; log Winston menggunakan
|
||||
`event=application_log`. Request tidak dicatat sebagai event terpisah karena
|
||||
ID request dan statusnya tersedia pada event respons. Field `timestamp`
|
||||
Respons terpantau menggunakan `event=http_response`. Awal request pada route
|
||||
tertentu menggunakan `event=http_request`. Log internal Winston menggunakan
|
||||
`event=application_log`. Field `timestamp`
|
||||
menggunakan WIB dengan offset `+07:00`, misalnya
|
||||
`2026-11-25T00:30:00.000+07:00`.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user