# Telemetry Dotnet

> Thiết lập Jarvis.OpenTelemetry cho ASP.NET Core — trace/metric/log OTLP, enrich middleware, instrumentation plug-in. Dùng khi tích hợp telemetry .NET, section OTEL, hoặc thêm Redis/EF/enricher.

- **Type:** Skill
- **Install:** `agentstack add skill-hoangnh2412-ai-skills-telemetry-dotnet`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [hoangnh2412](https://agentstack.voostack.com/s/hoangnh2412)
- **Installs:** 0
- **Category:** [Databases](https://agentstack.voostack.com/c/databases)
- **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/telemetry-dotnet

## Install

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

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

## About

# Jarvis.OpenTelemetry — Orchestrator

Skill điều phối gắn `Jarvis.OpenTelemetry` vào ASP.NET Core minimal hosting.

Kiến trúc & hướng dẫn: [README.md](README.md).

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

| Tình huống | Workflow |
|---|---|
| Project chưa có Jarvis OTEL | [workflows/init.md](workflows/init.md) |
| Đã có core, cần thêm instrumentation/enricher | [workflows/add.md](workflows/add.md) |

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

- `AddJarvisOpenTelemetry(configuration, configureServices)` → `.ConfigureResource()` → `.ConfigureLogging()` / `.ConfigureTrace()` / `.ConfigureMetric()`.
- Plug-in (`ITraceInstrumentation`, enricher, …) đăng ký **trong** callback `configureServices` (trước `Build()`).
- `app.UseJarvisOpenTelemetry()` khi cần tag trace / log scope từ `IEnrich*`.
- Config theo signal: `OTEL:Tracing`, `OTEL:Metric`, `OTEL:Logging`.
- `HttpTraceEnrichment`: allowlist header — không capture toàn bộ header.
- Không hard-code OTLP secrets; dùng env / secret store.
- Jarvis logging **không** `ClearProviders` — Serilog/NLog thêm riêng.
- Options snapshot lúc startup — đổi config runtime cần restart.

## Templates

- [templates/program-setup.cs](templates/program-setup.cs) — `Program.cs` tối thiểu
- [templates/enrich-service.cs](templates/enrich-service.cs) — `IEnrichTraceService` / `IEnrichLogService`
- [templates/otel-appsettings.json](templates/otel-appsettings.json) — mẫu section `OTEL`

## Providers (atomic)

Chỉ đọc provider cần dùng:

| Provider | Path |
|---|---|
| Enrich trace/log | [providers/enrich/SKILL.md](providers/enrich/SKILL.md) |
| Redis trace | [providers/redis/SKILL.md](providers/redis/SKILL.md) |
| EF Core trace | [providers/entityframework/SKILL.md](providers/entityframework/SKILL.md) |
| Custom trace plug-in | [providers/trace-plugin/SKILL.md](providers/trace-plugin/SKILL.md) |
| Custom metric plug-in | [providers/metric-plugin/SKILL.md](providers/metric-plugin/SKILL.md) |
| Custom log exporter | [providers/logging-plugin/SKILL.md](providers/logging-plugin/SKILL.md) |

## Biến môi trường OTLP (tham chiếu)

| Mục đích | Ví dụ |
|---|---|
| OTLP chung | `OTEL_EXPORTER_OTLP_ENDPOINT`, `OTEL_EXPORTER_OTLP_HEADERS` |
| Trace | `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` |
| Metrics | `OTEL_EXPORTER_OTLP_METRICS_ENDPOINT` |
| Logs | `OTEL_EXPORTER_OTLP_LOGS_ENDPOINT` |
| Resource | `OTEL_RESOURCE_ATTRIBUTES`, `OTEL_SERVICE_NAME` |

## Output bắt buộc

- Thay đổi `Program.cs`
- `appsettings.json` section `OTEL` (khi đổi config)
- Checklist: OTLP endpoint/env, sampling, allowlist header, plug-in singleton

## Background worker

Kế thừa `Jarvis.OpenTelemetry.HostedServices.BaseWorker` — cron + trace/log scope mỗi tick. Chi tiết: [README.md](README.md#background-worker-cron).

## Checklist production

- Sampling: `Tracing:Sampler` + `TraceIdRatio` hợp lý
- PII: allowlist header chặt
- Cardinality: tag ổn định
- Noise: `ExcludedPathPrefixes` cho `/health`, `/swagger`
- Secrets: OTLP headers qua env, không commit

## 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-telemetry-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%.
