قابلية الرصد (Observability)
في هذه الصفحة 8 موضوعات
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
نظرة عامة
الموضوعات
- السجلات (Logs)
- المقاييس (Metrics)
- التتبّعات (Traces)
- معرّفات الارتباط (correlation IDs)
- OpenTelemetry
تعلّم أولًا
3.5 ساعة تدريب (تقدير)
مخرجات التعلم
- Explain the roles of logs, metrics, and traces and the questions each answers.
- Instrument services with OpenTelemetry (auto and manual spans) and propagate context over HTTP and Kafka.
- Correlate logs with traces through trace and span IDs.
- Add business-meaningful custom metrics with Micrometer.
الدروس
المختبر والتمارين
Lab
MID-047-LAB1 · Traceable Shop
Outcomes: 1–4 · Time: ~3.5 h Instrument gateway, services, and Kafka so traces appear in Jaeger or Tempo; add trace ids to logs; add business metrics for orders placed and failed. Acceptance: any order ID can be traced end to end.
Exercises (assessment: diagnose an issue from telemetry alone)
| ID | Outcome | Task |
|---|---|---|
| MID-047-EX01 | 1 | For five questions (error count, request path, exact exception, time per step, slow tail), name the signal that answers it. |
| MID-047-EX02 | 2 | Enable auto-instrumentation for orders and view a trace in Jaeger or Tempo. |
| MID-047-EX03 | 2 | Add a manual span "reserve-stock" with an order.id attribute. |
| MID-047-EX04 | 2 | Propagate trace context through Kafka and show one trace across producer and consumer. |
| MID-047-EX05 | 3 | Add trace_id and span_id to JSON logs; find all logs of one request. |
| MID-047-EX06 | 4 | Add a counter shop.orders tagged result; explain why customerId must not be a tag. |
| MID-047-EX07 | 1–4 | Given screenshots of traces, logs, and metrics from a slow-checkout incident, write a diagnosis with evidence. |
أظهر الحلول
- EX01 Counts: metric; path: trace; exact exception: log; time per step: trace; slow tail: metric histogram or percentile.
- EX02 Run the OTel Java agent or the Micrometer Tracing bridge with an exporter to the collector; verify the supported setup for the Boot version.
- EX03
tracer.spanBuilder(...)withmakeCurrent()andend()infinally, as in the lecture. - EX04 Use the instrumented Kafka client or Spring Kafka observation support so headers carry
traceparent; check the consumer span's trace id equals the producer's. - EX05 Add trace and span ids to the MDC through the tracing bridge and a JSON encoder; search by trace id.
- EX06
Counter.builder("shop.orders").tag("result","failed"); customer id yields unbounded series. - EX07 Pattern: symptom (metric), narrowing (traces), cause (widest span), confirmation (logs); propose one fix.
Outcome 1 is also checked by quiz Q01-Q03.
الاختبار
Outcomes: O1 logs, metrics, traces · O2 OpenTelemetry and propagation · O3 log-trace correlation · O4 custom metrics.
اختبار ذاتي لك: لا توجد درجات، ولا يُحفظ أو يُرسل أي شيء. اختر إجابة ثم تحقق منها، ويمكنك المحاولة مرة أخرى كما تشاء.
الجزء العملي
Seven exercises MID-047-EX01 to EX07 (EX07 is the diagnosis from telemetry alone) plus the Traceable Shop lab. Pass: at least five exercises including EX07, and a lab where any order id can be traced end to end.
أخطاء شائعة
High-cardinality metric labels; traces broken at the message broker; logging instead of metrics for counts.
التقييم
Diagnose an issue from telemetry alone.
الصلة بالمسار الوظيفي
Incident handling (MID-050) and the MID gate.