# مانیتورینگ در DevOps چیست؟ فرق Monitoring و Observability به زبان ساده

> Observability یعنی فهمیدن داخل سیستم از روی دیتایی که بیرون می‌دهد و مانیتورینگ یکی از کارهایی است که روی این دیتا انجام می‌شود. با یک مثال ساده از فروشگاه اینترنتی می‌بینیم Metrics و Traces و Logs چه می‌گویند و چرخه Telemetry، Monitoring، Alerting، Investigation و Action چطور کار می‌کند.

- Canonical: https://linuxacademy.ir/blog/monitoring-vs-observability
- Published: 2026-11-30 | Updated: 2026-11-30
- Language: فارسی (English version below)

**پاسخ کوتاه:** Observability یعنی بتوانی از روی دیتایی که سیستم بیرون می‌دهد بفهمی داخلش چه خبر است. مانیتورینگ یکی از کارهایی است که روی این دیتا انجام می‌دهی. یک تیم معمولاً این‌طور کار می‌کند: اول دیتا جمع می‌کنی (Telemetry)، بعد آن را زیر نظر می‌گیری (Monitoring)، هشدار می‌گیری (Alerting)، علت را پیدا می‌کنی (Investigation) و در آخر مشکل را رفع می‌کنی (Action).

## چرا سیستم پایدار به Observability نیاز دارد؟

چارچوب AWS Well-Architected شش ستون برای طراحی سیستم معرفی می‌کند؛ از جمله امنیت (Security)، بهینه‌سازی هزینه‌ها (Cost Optimization) و کارایی (Performance Efficiency). این ستون‌ها کمک می‌کنند سیستمی پایدار و کارآمد بسازی. ولی وقتی سیستم در حال کار است، باید ببینی داخلش چه می‌گذرد تا مشکل را زود بفهمی. به این توانایی «دیدن» می‌گوییم Observability.

## یک تیم چطور با Observability مشکل را پیدا و رفع می‌کند؟

این چرخه نشان می‌دهد یک تیم چطور از Observability استفاده می‌کند تا مشکل را ببیند، علتش را پیدا کند و رفعش کند:

![چرخه Observability: Telemetry، Monitoring، Alerting، Investigation، Action](/images/blog/observability-cycle-fa.svg)

| مرحله | چه کار می‌کنی؟ | مثال |
| --- | --- | --- |
| ۱. Telemetry | دیتا جمع می‌کنی | Metrics، Traces و Logs |
| ۲. Monitoring | دیتا را زیر نظر می‌گیری | داشبورد Grafana |
| ۳. Alerting | قانون هشدار می‌گذاری | «اگر بیش از ۵٪ تلاش‌های پرداخت ناموفق شد، SMS بده» |
| ۴. Investigation | علت را پیدا می‌کنی | Metrics و Traces و Logs را کنار هم می‌خوانی |
| ۵. Action | اقدام می‌کنی | رفع باگ، ری‌استارت، افزایش منابع |

## Telemetry چیست و چه نوع دیتایی دارد؟

Telemetry دیتایی است که سیستم درباره رفتار خودش بیرون می‌دهد؛ اولین قدم، جمع‌آوری همین دیتاست. سه نوع رایج آن در استاندارد OpenTelemetry این‌هاست:

- **Metrics:** عددهایی در طول زمان؛ معمولاً اولین نشانه که **چی** خراب شده.
- **Traces:** مسیر یک درخواست از سرویسی به سرویس دیگر؛ کمک می‌کند ببینی **کجا** خراب شده.
- **Logs:** ثبت رویدادها، از جمله خطاها؛ سرنخ می‌دهد که **چرا** خراب شده.

این «چی، کجا، چرا» یک قاعده ساده برای شروع است، نه قانون؛ گاهی خود متریک علت را نشان می‌دهد و گاهی لاگ فقط می‌گوید درخواست شکست خورده.

## یک مثال ساده: پرداخت آنلاین که کار نمی‌کند

![Metrics، Traces و Logs روی مثال پرداخت آنلاین](/images/blog/telemetry-metrics-traces-logs-fa.svg)

فرض کن فروشگاه اینترنتی داری و کاربرها باید پرداخت آنلاین انجام بدهند.

1. **Metrics:** نمودار نشان می‌دهد از صبح هیچ پرداختی موفق نبوده.
2. **Traces:** می‌بینی درخواست از سایت راه می‌افتد ولی در اتصال به درگاه پرداخت قطع می‌شود.
3. **Logs:** در لاگ همان سرویس پیدا می‌کنی: `ERROR connection timeout`.

حالا می‌دانی چی شده، کجا شده و علت مستقیمش چیست. قدم بعد این است که بفهمی چرا اتصال به درگاه تایم‌اوت می‌شود (مثلاً درگاه قطع است یا شبکه مشکل دارد) و اقدام کنی.

## یک قانون هشدار ساده چه شکلی است؟

نمونه یک فایل قانون (rule file) در Prometheus:

```yaml
groups:
  - name: payments
    rules:
      - alert: PaymentFailuresHigh
        expr: |
          sum(rate(payments_total{status="failed"}[5m]))
            / sum(rate(payments_total[5m])) > 0.05
        for: 5m
        labels:
          severity: critical
        annotations:
          summary: "بیش از ۵٪ تلاش‌های پرداخت ناموفق است"
```

عبارت `expr` با `rate(...[5m])` نرخ تلاش‌های ناموفق و کل تلاش‌ها را در ۵ دقیقه گذشته حساب می‌کند و از تقسیمشان سهم ناموفق‌ها به دست می‌آید. `for: 5m` یعنی این سهم باید ۵ دقیقه بالای ۵٪ بماند تا هشدار فعال (firing) شود؛ ارسال آن کار Alertmanager است. (فرض: متریک `payments_total` با هر تلاش پرداخت یکی زیاد می‌شود.)

این هشدار از طریق Alertmanager می‌تواند به ایمیل، تلگرام یا SMS (مثلاً با Amazon SNS) برسد. کتاب SRE گوگل هم پیشنهاد می‌کند هشدارها روی چهار سیگنال طلایی باشد: Latency، Traffic، Errors و Saturation.

## فرق Monitoring و Observability چیست؟

- **Monitoring** یعنی زیر نظر گرفتن سیستم با سؤال‌هایی که از قبل تعریف کرده‌ای (داشبورد و هشدار).
- **Observability** توانایی سیستم است که بتوانی سؤال‌های تازه بپرسی و جواب بگیری، حتی برای مشکلی که قبلاً ندیده بودی.

پس مانیتورینگ یکی از کارهایی است که روی Observability بنا می‌شود و یک مرحله از این چرخه است.

اگر می‌خواهی برای سیستم خودت Metrics، Traces، Logs و هشدار راه بیندازی، [مشاوره بگیر](/services-consult)، [پیاده‌سازی را به ما بسپار](/services-implement) یا [یک جلسه رزرو کن](/services-consult#book).

## پرسش‌های پرتکرار

### فرق Monitoring و Observability چیست؟

Observability توانایی فهمیدن وضعیت داخل سیستم از روی دیتایی است که بیرون می‌دهد. مانیتورینگ یکی از مراحلی است که از این دیتا استفاده می‌کند: زیر نظر گرفتن سیستم با داشبورد و هشدار.

### Metrics و Traces و Logs هر کدام به چه سؤالی جواب می‌دهند؟

به‌طور ساده: Metrics معمولاً نشان می‌دهد چی خراب شده، Traces کمک می‌کند ببینی کجای مسیر خراب شده و Logs سرنخ می‌دهد که چرا. این یک قاعده ساده برای شروع است، نه قانون.

### برای شروع از چه ابزاری استفاده کنم؟

یک ترکیب رایج و متن‌باز: Prometheus برای Metrics، Grafana برای داشبورد، Loki برای Logs، Tempo یا Jaeger برای Traces و OpenTelemetry برای جمع‌آوری همه.

### Telemetry یعنی چه؟

Telemetry دیتایی است که سیستم درباره رفتار خودش بیرون می‌دهد، مثل Metrics و Traces و Logs. جمع‌آوری آن اولین مرحله این چرخه است.

---

# What Is Monitoring in DevOps? Monitoring vs Observability, Simply Explained

> Observability means understanding a system from the data it emits, and monitoring is one of the things you do with that data. One simple online-shop example shows what metrics, traces and logs tell you, and how the Telemetry, Monitoring, Alerting, Investigation, Action loop works.

**Short answer:** Observability means you can tell what is happening inside a system from the data it puts out. Monitoring is one of the things you do with that data. A team typically works like this: you collect data (telemetry), watch it (monitoring), get notified (alerting), find the cause (investigation) and fix it (action).

## Why does a stable system need observability?

The AWS Well-Architected Framework gives six design pillars, including security, cost optimization and performance efficiency, that help you build stable, efficient systems. Once the system is running, you also need to see what is happening inside it so you catch problems early. That ability to see is observability.

## How does a team use observability to find and fix a problem?

This loop shows how a team uses observability to detect a problem, find its cause and fix it:

![The observability loop: Telemetry, Monitoring, Alerting, Investigation, Action](/images/blog/observability-cycle-en.svg)

| Step | What you do | Example |
| --- | --- | --- |
| 1. Telemetry | Collect data | Metrics, traces and logs |
| 2. Monitoring | Watch the data | A Grafana dashboard |
| 3. Alerting | Set alert rules | "Text me if more than 5% of payment attempts fail" |
| 4. Investigation | Find the cause | Read metrics, traces and logs together |
| 5. Action | Act on it | Fix the bug, restart, add resources |

## What is telemetry, and what kinds of data does it include?

Telemetry is the data a system emits about its own behavior; the first step is collecting it. The OpenTelemetry standard describes three common signals:

- **Metrics:** numbers over time; usually the first sign of **what** broke.
- **Traces:** the path of one request across services; they help you see **where** it broke.
- **Logs:** records of events, including errors; they give clues to **why** it broke.

"What, where, why" is a starting rule of thumb, not a law: sometimes a metric shows the cause, and sometimes a log only says a request failed.

## A simple example: online payments stop working

![Metrics, traces and logs on the online payment example](/images/blog/telemetry-metrics-traces-logs-en.svg)

Say you run an online shop and customers pay online.

1. **Metrics:** the chart shows no payment has succeeded since this morning.
2. **Traces:** requests leave your website but fail on the call to the payment gateway.
3. **Logs:** that service's log says `ERROR connection timeout`.

Now you know what happened, where, and the direct cause. Next, find out why the connection to the gateway times out (is the gateway down, or is it the network?) and act.

## What does a simple alert rule look like?

A Prometheus rule file:

```yaml
groups:
  - name: payments
    rules:
      - alert: PaymentFailuresHigh
        expr: |
          sum(rate(payments_total{status="failed"}[5m]))
            / sum(rate(payments_total[5m])) > 0.05
        for: 5m
        labels:
          severity: critical
        annotations:
          summary: "More than 5% of payment attempts are failing"
```

In `expr`, `rate(...[5m])` estimates the rate of failed attempts and of all attempts over the last five minutes, and dividing them gives the failed share. `for: 5m` means that share must stay above 5% for five minutes before the alert starts firing; Alertmanager then delivers it. (This assumes `payments_total` goes up by one for every payment attempt.)

Alertmanager can then send it by email, Telegram or SMS (for example through Amazon SNS). Google's SRE book suggests alerting on the four golden signals: latency, traffic, errors and saturation.

## What is the difference between monitoring and observability?

- **Monitoring** means watching the system with questions you defined in advance (dashboards and alerts).
- **Observability** is a property of the system: you can ask new questions and get answers, even about a problem you have never seen before.

So monitoring is one of the things built on observability, and one step of this loop.

Want metrics, traces, logs and alerts set up for your own system? [Get a consultation](/services-consult), [have us implement it](/services-implement) or [book a session](/services-consult#book).

## Frequently asked questions

### What is the difference between monitoring and observability?

Observability is the ability to understand what is happening inside a system from the data it emits. Monitoring is one step that uses that data: watching the system with dashboards and alerts.

### Which question do metrics, traces and logs each answer?

As a simple rule of thumb: metrics usually show what broke, traces help you see where along the request path it broke, and logs give clues to why. It is a starting point, not a law.

### Which tools should I start with?

A common open-source stack: Prometheus for metrics, Grafana for dashboards, Loki for logs, Tempo or Jaeger for traces, and OpenTelemetry to collect all of them.

### What does telemetry mean?

Telemetry is the data a system emits about its own behavior, such as metrics, traces and logs. Collecting it is the first step of the loop.