နားလည်ထားရမယ့် အချက်
Monitoring က ချက်ချင်း လိုအပ်တဲ့ မေးခွန်းတွေကို ဖြေပါတယ် — app run နေသေးလား၊ နှေးနေလား၊ error တက်နေလား၊ memory/CPU limit နဲ့ နီးနေလား။
| Pillar | ဘယ်မေးခွန်းကို ဖြေလဲ |
|---|---|
| Logs | ဘာဖြစ်ခဲ့လဲ? Event တစ်ခုစီရဲ့ discrete record။ |
| Metrics | ဘယ်လောက်၊ ဘယ်နှစ်ကြိမ်? Time ပေါ်မှာ ကိန်းဂဏန်း။ |
| Traces | အချိန်ဘယ်ကို သွားလဲ? Service တွေကို request သွားတဲ့ path။ |
Structured logging က log တစ်ခုစီကို consistent field တွေနဲ့ JSON object အနေနဲ့ ရေးပြီး၊ log တွေကို scale ကြီးမှာ search/aggregate လုပ်နိုင်စေပါတယ်။
Secret ကို logging မလုပ်ပါနဲ့
Password, API key, ဒါမှမဟုတ် auth token အပြည့်ကို log line ထဲ ဘယ်တော့မှ မရေးပါနဲ့ — ဥပမာ log statement ထဲမှာ "apiKey: sk_live_abc123..." လို။ Log တွေက database ထက် ပိုအလွယ်တကူ search, copy, ထိန်းသိမ်း ခံရလေ့ ရှိပါတယ်။
Health check တွေက status ရိုးရိုးလေးသာ ပြန်ပေးသင့်ပါတယ်၊ internal detail မဟုတ်ပါဘူး။ Error tracking နဲ့ uptime monitoring တို့ဟာ signal တူတူကို သုံးပြီး လိုအပ်တဲ့ မေးခွန်း မတူညီတာကို ဖြေပါတယ်။
- Metrics
- Time ပေါ်မှာ ပြောင်းလဲနေတဲ့ ကိန်းဂဏန်း measurement, request per second ဒါမှမဟုတ် error rate လိုမျိုး, 'ဘယ်လောက်၊ ဘယ်နှစ်ကြိမ်' ကို ဖြေဖို့။
- Traces
- Service အများကြီးကို request တစ်ခု ရွှေ့သွားတဲ့ path နဲ့ timing ကို မှတ်တမ်းတင်ထားတာ။
- Observability
- Log, metric, trace တွေကို အတူတကွသုံးပြီး run နေတဲ့ system အကြောင်း — ကြိုတင် မမျှော်လင့်ထားတဲ့ မေးခွန်းအပါအဝင် — ဖြေနိုင်တဲ့ ကျယ်ပြန့်တဲ့ စွမ်းရည်။
THREE PILLARS OF OBSERVABILITY
------------------------------
THREE PILLARS OF OBSERVABILITY
---------------------------------
[ LOGS ] [ METRICS ] [ TRACES ]
what happened how much/often where time went
| | |
+--------+--------+--------+--------+
|
v
"is the system healthy?"
|
+---------+---------+
v v v
health check error uptime
endpoint tracking monitoringလက်တွေ့ scenario နဲ့ ချိတ်ကြည့်မယ်
Structured log entry ဆိုတာ consistent field ပါတဲ့ object တစ်ခုကို JSON အဖြစ် ပြောင်းထားတာပါ — log aggregator တစ်ခု မျှော်လင့်ထားတဲ့ shape ပါ။
Print မလုပ်ခင် field name တစ်ခုစီကို secret-shaped key (password, apiKey, token, secret) နဲ့ စစ်ပြီး ကိုက်ညီရင် redact လုပ်ပါတယ်။
Redaction က auto ဖြစ်သင့်တယ်၊ မှတ်ထားစရာ မဖြစ်သင့်ဘူး
Log line ဆိုတာ secret leak ဖို့ နေရာတစ်ခုပါ။ Auto apply ဖြစ်တဲ့ redaction က developer တိုင်း deadline အောက်မှာ မှန်ကန်စွာ မှတ်ထားနိုင်မယ်လို့ မျှော်လင့်ထားတာထက် ပိုကောင်းပါတယ်။
Secret ကို logging မလုပ်ပါနဲ့
Log line ထဲက API key, password, ဒါမှမဟုတ် auth token အပြည့်ဟာ ဒီ log ကို ဖတ်နိုင်တဲ့ ခဏတွင်း leak တစ်ခု ဖြစ်ပါတယ် — log တွေကို database ထက် ပိုအလွယ်တကူ ဖတ်ကြပါတယ်။
အတူတူ စမ်းရေးကြည့်မယ်
function createLogEntry({ level, requestId, message, fields = {} }) {
const SECRET_KEYS = ["password", "apikey", "api_key", "token", "secret"];
const safeFields = {};
for (const [key, value] of Object.entries(fields)) {
safeFields[key] = SECRET_KEYS.includes(key.toLowerCase())
? "[REDACTED]"
: value;
}
return JSON.stringify({
level,
requestId,
message,
fields: safeFields,
timestamp: "2026-09-04T00:00:00.000Z",
});
}
console.log(createLogEntry({
level: "info",
requestId: "req-1",
message: "user login succeeded",
fields: { userId: "u-42", apiKey: "sk_live_abc123" },
}));
console.log(createLogEntry({
level: "error",
requestId: "req-2",
message: "payment failed",
fields: { orderId: "o-99", password: "hunter2" },
}));{"level":"info","requestId":"req-1","message":"user login succeeded","fields":{"userId":"u-42","apiKey":"[REDACTED]"},"timestamp":"2026-09-04T00:00:00.000Z"}
{"level":"error","requestId":"req-2","message":"payment failed","fields":{"orderId":"o-99","password":"[REDACTED]"},"timestamp":"2026-09-04T00:00:00.000Z"}
(output က locale နှစ်ခုစလုံးအတွက် တူညီပါတယ်)၅ မိနစ် စမ်းကြည့်
SECRET_KEYS ထဲ 'creditCardNumber' နဲ့ 'ssn' ကို ထပ်ထည့်ပါ၊ ပြီးရင် orderId လို ပုံမှန် field နဲ့အတူ ဒီနှစ်ခုပါတဲ့ entry တစ်ခု log လုပ်ပါ။ Sensitive field နှစ်ခုစလုံး redact ဖြစ်ပြီး orderId ကတော့ မဖြစ်ဘူးဆိုတာ သေချာစစ်ပါ။
သတိလေးတစ်ချက်
Request ဒါမှမဟုတ် user object တစ်ခုလုံးကို filter မလုပ်ဘဲ log လုပ်ခြင်း — password ဒါမှမဟုတ် token field တစ်ခု အထဲမှာ ပါလာတာ မသိဘဲ ပါသွားတာ။
Error tracking နဲ့ uptime monitoring ကို တစ်ခုတည်း ထင်ခြင်း — uptime check ကောင်းနေပေမယ့် application error တွေ spike တက်နေတာ ဖုံးကွယ်နေနိုင်ပါတယ်။
MDN — HTTP response status codes (health check status) — Cloud & Deployment