Thuta Learning
Node.js
AdvancedWeb Developmentbeginner

Errors, Logging & Observability

Node.jsသင်ခန်းစာ 20

ဒီခန်းပြီးရင် ဘာတတ်သွားမလဲ

  • Errors, Logging & Observability ရဲ့ event-loop နဲ့ resource behavior ကိုရှင်းပြနိုင်ရန်
  • Failure နဲ့ concurrency cases စမ်းနိုင်ရန်
  • Secure, testable Node.js code ရေးနိုင်ရန်

Errors, Logging & Observability ကို validation, least privilege, structured errors/logs, health checks, timeouts, tests နဲ့ graceful shutdown တို့ပါသော production boundary အဖြစ်တည်ဆောက်ပါ။ Secrets မ log ဘဲ supported LTS ကို security patch များနှင့်အတူသုံးပါ။

ပိုပြီးနားလည်ထားရမယ့် အချက်

Errors, Logging & Observability ကို validation, least privilege, structured errors/logs, health checks, timeouts, tests နဲ့ graceful shutdown တို့ပါသော production boundary အဖြစ်တည်ဆောက်ပါ။ Secrets မ log ဘဲ supported LTS ကို security patch များနှင့်အတူသုံးပါ။

လက်တွေ့အသုံးချမှု

Errors, Logging & Observability example ကို concurrent requests, malformed input, timeout, cancellation, missing config, dependency failure နဲ့ shutdown cases ဖြင့်စမ်းပါ။ Blocking I/O, leaked handles နဲ့ unhandled rejection ရှိမရှိစစ်ပါ။

ဒီသင်ခန်းစာပြီးရင်

javascript
function logError(error, requestId) {
  console.error(JSON.stringify({ level:'error', requestId, name:error.name, message:error.message }));
}
process.on('unhandledRejection', error => { logError(error, 'process'); process.exitCode = 1; });
You should see
Secrets မပါသော searchable structured logs ရရှိမည်။

ကိုယ်တိုင်စမ်းကြည့်ရန်

Errors, Logging & Observability example ကို concurrent requests, malformed input, timeout, cancellation, missing config, dependency failure နဲ့ shutdown cases ဖြင့်စမ်းပါ။ Blocking I/O, leaked handles နဲ့ unhandled rejection ရှိမရှိစစ်ပါ။

Runtime သတိပေးချက်

Local happy path မှန်ရုံဖြင့် concurrency, timeout, security နဲ့ shutdown paths မှန်ပြီဟုယူဆခြင်း။

Node.js API DocumentationNode.js

ဒီနေရာမှာ လူအများမှားတတ်တယ်

  • Local happy path မှန်ရုံဖြင့် concurrency, timeout, security နဲ့ shutdown paths မှန်ပြီဟုယူဆခြင်း။
  • Synchronous I/O သို့ CPU-heavy work ကို request path ထဲထားခြင်း။

လက်တွေ့လေ့ကျင့်ခန်း

Errors, Logging & Observability example ကို concurrent requests, malformed input, timeout, cancellation, missing config, dependency failure နဲ့ shutdown cases ဖြင့်စမ်းပါ။ Blocking I/O, leaked handles နဲ့ unhandled rejection ရှိမရှိစစ်ပါ။

You'll know it worked when: Secrets မပါသော searchable structured logs ရရှိမည်။

Errors, Logging & Observability | Thuta Learning