PAU OJ Online Judge
ProblemsLearnStudy plansContestsSubmissionsRank

Updates

Announcements and upcoming contests

Loading announcements…
Sign in for personal alertsBrowse contests
Log inSign up

PAU OJ

PrimeAsia University Online Judge

A real online judge for programming practice, university contests and coding assessments. Write code in your browser, get sandboxed verdicts, and track your progress.

Platform

  • Problems
  • Contests
  • Submissions
  • Ranking
  • Reviewers

Resources

  • User guide
  • Changelog
  • How judging works
  • System health
  • Create an account

© 2026 PrimeAsia University Online Judge. All rights reserved.

v0.9.0

  1. All tracks
  2. Master class
  3. Observability

Observability

অবজারভেবিলিটি

Topic 28 of 41Story · visual · design practice

In this lesson

  • Story & concept
    • কেন দরকার
    • মূল ধারণা
    • কোডে দেখি
    • ধাপে ধাপে
    • সাধারণ ভুল
      • ল্যাব: বাজেট গোনো
      • চিট শিট
      • প্রোডাকশন নোট
  • Visual story
  • Design practice
  • Checkpoint
  • Discussion
Back to track

0/0 solved

metrics, logs, traces, SLO/error budget আর symptom-based alert।

In this lesson

  • Story & concept
  • Visual story
  • Design practice
  • Checkpoint
  • Discussion
01

Step 1: Story & concept

Start with the production incident, then the design decision that fixes it.

কেন দরকার

বৃহস্পতিবার রাতে ইউজাররা "ride book হচ্ছে না" বলছে, কিন্তু ড্যাশবোর্ডে CPU ৩৫%, memory ৪০%, সব সবুজ। নুসরাত ৪০ মিনিট ধরে log grep করছে; শেষে দেখা গেল payment service-এর p99 ৮ সেকেন্ড, কিন্তু কোনো alert ছিল না—শুধু CPU alert ছিল। মাহিন বলল, "আমরা সিস্টেমের স্বাস্থ্য দেখছি, ইউজারের ব্যথা দেখছি না।"

Observability মানে বাইরে থেকে ভিতরের অবস্থা বোঝার ক্ষমতা—শুধু "সার্ভার বেঁচে আছে" নয়, "কোন request কেন ধীর, কোথায় আটকেছে, কতজনের ক্ষতি হচ্ছে"। তিনটা স্তম্ভ: metrics (সংখ্যা), logs (ঘটনা), traces (এক request-এর path)। alert ইউজারের SLO-তে বসাও, CPU-তে নয়।

মূল ধারণা

Metrics। Counter (request total), gauge (queue depth), histogram (latency distribution)। p50/p95/p99 percentile histogram থেকে; average নয়। Cardinality বিপদ—user_id দিয়ে label করলে metric explode করবে; bounded label (route, status, region) রাখো।

Logs। Structured JSON, request_id/trace_id সহ; error log-এ stack, input, user impact। Log volume বাজেট রাখো; debug log production-এ নয়।

Traces। Distributed tracing এক request-এর service-to-service span দেখায়; কোন hop ৮ সেকেন্ড নিল তৎক্ষণাৎ বোঝা যায়। Sampling (১–১০%) খরচ কমায়, কিন্তু ১০০% error trace রাখো।

RED/USE। Service-এর জন্য RED: Rate, Errors, Duration। Resource-এর জন্য USE: Utilization, Saturation, Errors। প্রতি service-এ RED, প্রতি host/DB-তে USE।

SLO/error budget। SLO ৯৯.৯% মানে মাসে ~৪৩ মিনিট। Error budget শেষ হলে feature freeze; alert burn-rate-এ (১ ঘণ্টায় ১৪.৪x burn) দাও, শুধু "p95 > ৫০০ms একবার" নয়।

Alerting। Symptom-based: 5xx rate, p99 latency, queue oldest age, payment failure। Cause-based (CPU high) শুধু capacity planning-এ। প্রতিটা alert-এ runbook/link থাকুক, নইলে on-call অন্ধ।

সংকেতপ্রশ্নের উত্তরউদাহরণ
Metricকতটা/কত দ্রুত?RPS, p99, error %
Logকী ঘটল?timeout, stack, input
Traceকোথায় সময় গেল?DB span ৪.২s
SLOইউজার খুশি?৯৯.৯% success
Alertকে এখনই কাজ করবে?burn-rate ১৪x

কোডে দেখি

Prometheus-ধাঁচের SLO query আর error-budget হিসাব:

# success ratio over 30 days
sum(rate(http_requests_total{status!~"5.."}[30d]))
/
sum(rate(http_requests_total[30d]))

# p99 latency
histogram_quantile(0.99,
  sum by (le, route) (rate(http_request_duration_seconds_bucket[5m]))
)
SLO = 0.999
window_seconds = 30 * 24 * 3600
allowed_bad = window_seconds * (1 - SLO)
observed_bad = 1200  # 5xx + timeouts in the window
print("budget_seconds", allowed_bad, "bad_seconds", observed_bad)
print("burn_rate", observed_bad / allowed_bad)

Burn rate ১-এর নিচে থাকলে SLO ঠিক; ১৪.৪x এক ঘণ্টায় মানে বাজেট শেষ হবে ~২ দিনে। Alert burn-rate-এ, শুধু raw 5xx count-এ নয়।

ধাপে ধাপে

১. SLO লিখো। কোন user journey, কত % success, p95 কত ms, ৩০ দিনে। "দ্রুত" নয়, সংখ্যা।

২. RED metric বসাও। প্রতি route-এ rate/errors/duration histogram; bounded labels; trace_id log-এ।

৩. Trace sampling। ১–১০% normal, ১০০% error/slow; tail-based sampling হলে ভালো।

৪. Dashboard সাজাও। প্রথম row: SLO burn, p99, 5xx, queue oldest; নিচে resource USE। এক পাতায় ৫০ গ্রাফ নয়।

৫. Alert + runbook। Burn-rate, queue age, payment failure; প্রতিটায় owner, link, first action। Alert fatigue এড়াতে cause-based alert কমাও।

সাধারণ ভুল

  • শুধু CPU/memory alert। Resource সবুজ থাকলেও DB/slow dependency-তে outage হয়; SLO symptom alert দরকার।
  • Average latency দেখা। p99 লুকিয়ে রাখে ধীর ইউজার; percentile histogram ব্যবহার করো।
  • সব log debug level-এ রাখা। Volume আর খরচ explode; structured, sampled log রাখো।
  • user_id/high-cardinality metric label। Prometheus memory ফুরাবে; bounded label ব্যবহার করো।
  • Alert-এ runbook না থাকা। On-call জানে না কী করবে; alert নিজেই action link দিক।
  • SLO ছাড়া "সব ঠিক" ভাবা। সংখ্যা ছাড়া reliability budget বোঝা যায় না।

ল্যাব: বাজেট গোনো

৯৯.৯% SLO, ৩০ দিনে allowed bad = ২,৫৯২ সেকেন্ড। চলো-তে observed bad ১,২০০ সেকেন্ড। burn rate কত? ১ ঘণ্টায় ৫,০০০ bad request এলে বাজেট কত দ্রুত শেষ হবে? কাগজে হিসাব করো, তারপর ঠিক করো alert কোন threshold-এ বসবে।

চিট শিট

প্রোডাকশন নোট

Log-এ PII/secret লিখো না; trace_id দিয়ে correlate করো। Metric cardinality প্রতি user_id-তে বাড়ালে Prometheus মরে যাবে—bounded label রাখো। Alert-এর সংখ্যা কমাও, কিন্তু queue oldest age আর payment failure কখনো বাদ দিও না; এগুলোই আসল ইউজার-ব্যথা।

02

Step 2: Visual story

See the mental model first — the animation and the steps below it say the same thing.

Concept visual

মেট্রিক, লগ, ট্রেস

লেবেলের কার্ডিনালিটি বাড়লে খরচ O(n²)-এ বাড়ে, তাই SLO-তে alert আর লেবেল ছোট রাখো।

সময়ইনপুট n →
  • metrics O(1)
  • logs O(n)
  • traces O(n log n)
  • labels O(n²)

উপরের বাঁক যত খাড়া, ইনপুট বাড়লে সময় তত দ্রুত বাড়ে।

  1. 1RED আর USE মাপোrate, error, duration / utilization
  2. 2trace দিয়ে hop খোঁজোকোন সার্ভিসে ৩২০ms লাগছে
  3. 3log-এ request id রাখোএকই রিকোয়েস্টের সব লাইন জোড়া লাগে
  4. 4লেবেলে user id নয়কার্ডিনালিটি বিস্ফোরণ, bill-ও বাড়ে
  5. 5symptom-এ alert দাওp99 > ৮০০ms, CPU নয়
5টি ধাপে দেখা হচ্ছেগতি কমালে স্থির
03

Step 3: Design practice

Write a short design on paper or in a note, then compare it with the rubric. This is not a judge submission.

Design practice

All green, users angry

20 min

CPU ৩৫%, কিন্তু payment p99 ৮s; কোনো alert নেই।

তোমার কাজ

  1. 1RED/USE metric তালিকা করো।
  2. 2SLO/error budget ও alert threshold লেখো।
  3. 3trace sample/log structure design করো।

ভালো উত্তরে কী থাকবে

  • symptom metric
  • burn-rate
  • trace/log correlation
04

Step 4: Checkpoint

One timed attempt. Solve every problem to earn the module badge.

Final checkpoint

Ready to prove this module?

45 minutes3 problemsScale Architect badge
Go to checkpoint
05

Step 5: Discussion

Ask questions, share an approach or leave a study tip for this lesson.

Was this lesson helpful?

Your reaction helps other learners judge these notes.

Sign in to react

Discussion

0 comments

Sign in to ask a question or share an approach.

Sign in to comment

No comments yet

Be the first to ask a question or leave a study tip.

Topic 28 of 41

PreviousTimeouts & Retriesটাইমআউট ও রিট্রাইTopic 27 of 41
NextMonolith vs Microservicesমনোলিথ বনাম মাইক্রোসার্ভিসTopic 29 of 41
Back to track: System Design MasterclassAll learning tracks
প্রশ্নউত্তর
Latency?p95/p99 histogram
Service health?RED
Resource?USE
Error budget?(1-SLO) × window
Alert?burn-rate + symptom
Trace?sample + 100% errors