sentry-instrumentationlisted
Install: claude install-skill tortastudios/sentry-instrumentation
# Sentry Instrumentation
Two surfaces: **system metrics** (counter / gauge / distribution, duration, failure, resource) and **tracing** (currently the `gen_ai.*` spans for AI agent conversations — see rule 7). Product-analytics events (clicks, funnels, flag exposure) belong in your product-analytics tool — never in Sentry. Python under `examples/python/` is the canonical reference; other languages port the same shapes under idiomatic names.
Do not invoke for product-analytics changes. Stop and use the right tool.
## Decision rules
1. **New metric?** Read `references/signal-model.md` and pick a classmethod constructor (`MetricDef.counter|latency|gauge|resource|failure_counter`). Register in the project's metric registry. **Never** call an emission helper with a raw string or a dynamically-assembled name.
2. **Attributes?** Two kinds, both declared on the `MetricDef` (see `references/tagging-and-cardinality.md`). **Group-by tags** (`tags=`) — what dashboards and alerts group on — are closed sets: enumerate the values or route through a bucket function. **Debug context** (`context=`) — ids like `account_id`, `project_id`, `order_id` used to find who was affected — are declared by key and free-valued; Sentry stores full metric events, so they are queryable. Never put an id in `tags=`. Never put free-form text, exception strings, emails or raw URLs on a metric in either role. Don't add `trace_id` — every metric already carries it.
3. **Inside a loop?** Use `AggregatingCounter`