# Observability Dotnet

> Thiết lập observability metric cho service .NET — OTEL instrumentation, Prometheus scrape, Grafana dashboard, Prometheus/Alertmanager rules và vận hành. Dùng khi onboard metric mới, tạo dashboard, gắn alert, hoặc chuẩn hóa pipeline OTEL → Prometheus → Grafana.

- **Type:** Skill
- **Install:** `agentstack add skill-hoangnh2412-ai-skills-observability-dotnet`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [hoangnh2412](https://agentstack.voostack.com/s/hoangnh2412)
- **Installs:** 0
- **Category:** [Web & Browser](https://agentstack.voostack.com/c/web-and-browser)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [hoangnh2412](https://github.com/hoangnh2412)
- **Source:** https://github.com/hoangnh2412/ai-skills/tree/main/jarvis/skills/observability-dotnet

## Install

```sh
agentstack add skill-hoangnh2412-ai-skills-observability-dotnet
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Observability .NET — Orchestrator

Skill hướng dẫn **thiết lập end-to-end** pipeline metric cho ASP.NET Core: app export OTEL → collector/backend → Prometheus → Grafana → alert → vận hành.

Hướng dẫn người dùng: [README.md](README.md).

## Pipeline chuẩn

```text
ASP.NET Core (OTEL SDK)
    → OTLP exporter
        → OpenTelemetry Collector (hoặc backend tương đương)
            → Prometheus (scrape / remote write)
                → Grafana (visualize)
                → Prometheus rules → Alertmanager (notify)
```

Chi tiết kiến trúc: [reference/pipeline.md](reference/pipeline.md).

## Khi nào dùng workflow nào

| Tình huống | Workflow |
|---|---|
| Onboard metric từ đầu (full stack) | [workflows/setup.md](workflows/setup.md) |
| Chỉ app — bật OTEL metric | [workflows/otel-app.md](workflows/otel-app.md) |
| Prometheus scrape / rule files | [workflows/prometheus.md](workflows/prometheus.md) |
| Dashboard Grafana + biến templating | [workflows/grafana.md](workflows/grafana.md) |
| Alert + Alertmanager routing | [workflows/alerts.md](workflows/alerts.md) |
| Baseline, verify, runbook khi firing | [workflows/operate.md](workflows/operate.md) |

## Quy tắc cốt lõi

- **App metric:** ưu tiên instrumentation OTEL chuẩn (ASP.NET Core, HttpClient, Process, Runtime) trước custom metric.
- **Label ổn định:** `service.name` / `service_name`, `job`, `instance` — thống nhất giữa app, scrape config và dashboard.
- **Không hard-code** tên service, IP, ngưỡng alert — lấy từ `{service_name}`, baseline thực tế, limit pod/container.
- **Cardinality:** tránh tag high-cardinality (user id, request id) trên metric.
- **Dashboard trước alert:** có panel + baseline 7 ngày rồi mới gắn rule `> N× baseline`.
- **Jarvis app:** cài OTEL trong code → dùng thêm [telemetry-dotnet](../telemetry-dotnet/SKILL.md); skill này bao **hạ tầng** scrape/visualize/alert.
- **Troubleshoot sự cố:** sau khi pipeline sẵn sàng → [troubleshooting-dotnet](../troubleshooting-dotnet/SKILL.md) để lấy số liệu thực.

## Họ metric khuyến nghị (.NET web API)

| Nhóm | Instrumentation OTEL | Ví dụ metric Prometheus | Mục đích |
|---|---|---|---|
| HTTP inbound | ASP.NET Core | `http_server_request_duration_seconds_*` | RPS, latency, P99 |
| HTTP outbound | HttpClient | `http_client_request_duration_seconds_*` | Dependency load |
| Process | Process | `process_memory_usage_bytes` | RAM process |
| CLR runtime | Runtime | `process_runtime_dotnet_gc_*`, `process_runtime_dotnet_thread_pool_*` | GC, thread pool |

Chi tiết: [reference/metric-families.md](reference/metric-families.md).

## Templates

| File | Dùng khi |
|---|---|
| [templates/prometheus-scrape.yaml](templates/prometheus-scrape.yaml) | Thêm job scrape collector/app |
| [templates/prometheus-rules.yaml](templates/prometheus-rules.yaml) | Rule file mẫu (RAM, GC, latency, thread pool) |
| [templates/alertmanager-route.yaml](templates/alertmanager-route.yaml) | Route theo `service` / `team` |
| [templates/grafana-variables.md](templates/grafana-variables.md) | Biến dashboard + nhóm panel |

## Output bắt buộc (khi user yêu cầu thiết lập)

1. Checklist từng tầng: app OTEL → scrape OK → dashboard → rule → notify test
2. Danh sách metric + PromQL panel chính (placeholder `{service_name}`)
3. Ngưỡng alert **đề xuất** kèm ghi chú “thay bằng baseline thực”
4. Runbook ngắn: alert firing → kiểm tra gì → hành động tiếp

## Liên quan

| Skill | Khi nào |
|---|---|
| [telemetry-dotnet](../telemetry-dotnet/SKILL.md) | Gắn Jarvis.OpenTelemetry vào Host |
| [troubleshooting-dotnet](../troubleshooting-dotnet/SKILL.md) | Đọc metrics từ dashboard khi sự cố |
| [healthcheck-dotnet](../healthcheck-dotnet/README.md) | Health probe — tách khỏi metric business |

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [hoangnh2412](https://github.com/hoangnh2412)
- **Source:** [hoangnh2412/ai-skills](https://github.com/hoangnh2412/ai-skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-hoangnh2412-ai-skills-observability-dotnet
- Seller: https://agentstack.voostack.com/s/hoangnh2412
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
