Linear Observability
Contents
Overview
Comprehensive monitoring, logging, and alerting for Linear integrations using Prometheus metrics, structured logging, and health checks.
Prerequisites
- Linear integration deployed
- Metrics infrastructure (Prometheus, Datadog, etc.)
- Logging infrastructure (ELK, CloudWatch, etc.)
- Alerting system configured
Instructions
Step 1: Define Key Metrics
| Metric |
Type |
Purpose |
linear_api_requests_total |
Counter |
Track request volume by operation/status |
linear_api_request_duration_seconds |
Histogram |
Measure API latency |
linear_rate_limit_remaining |
Gauge |
Monitor rate limit headroom |
linear_webhooks_received_total |
Counter |
Track webhook volume |
linear_cache_hits_total |
Counter |
Measure cache effectiveness |
Step 2: Instrument the Client
Wrap the Linear SDK's fetch layer to capture metrics on every API call including operation name, duration, status, and rate limit headers.
Step 3: Add Structured Logging
Use pino/winston with JSON output, component tags, and correlation IDs for API calls, webhooks, and errors.
Step 4: Create Health Check Endpoint
Verify API connectivity, cache status, and rate limit headroom. Return healthy, degraded, or unhealthy status.
Step 5: Configure Alerting Rules
- High error rate (>5% over 5 min)
- Rate limit low (<100 remaining)
- Slow responses (p95 > 2s)
- Webhook processing errors
Step 6: Build Grafana Dashboard
Panels for request rate, latency p95, rate limit remaining, and webhook distribution.
See detailed implementation for full Prometheus metrics, instrumented client, logger, health check, alert rules, and Grafana dashboard JSON.
Output
- Prometheus metrics collecting on all Linear API calls
- Structured JSON logging for API calls and webhooks
- Health check endpoint returning system status
- Alerting rules for error rate, rate limits, and latency
Error Handling
| Error |
Cause |
Solution |
| Metrics not collecting |
Missing instrumentation |
Wrap client with instrumented fetch |
| Alerts not firing |
Wrong threshold |
Adjust alert thresholds to match traffic |
| Missing labels |
Logger misconfigured |
Check logger base config and child loggers |
Examples
Quick Health Check
set -euo pipefail
curl http://localhost:3000/health/linear | jq # 3000: 3 seconds in ms
# { "status": "healthy", "checks": { "linear_api": { "status": "healthy", "latency_ms": 150 } } }
Resources
Next Steps
Create incident runbooks with linear-incident-runbook.
1---2name: linear-observability3description: |4 Implement monitoring, logging, and alerting for Linear integrations.5 Use when setting up metrics collection, creating dashboards,6 or configuring alerts for Linear API usage.7 Trigger with phrases like "linear monitoring", "linear observability",8 "linear metrics", "linear logging", "monitor linear integration".9allowed-tools: Read, Write, Edit, Grep10version: 1.0.011license: MIT12author: Jeremy Longshore <jeremy@intentsolutions.io>13compatible-with: claude-code, codex, openclaw14metadata:15 source: https://skillmd.com/skills/micsapp/linear-observability16---1718# Linear Observability1920## Contents21- [Overview](#overview)22- [Prerequisites](#prerequisites)23- [Instructions](#instructions)24- [Output](#output)25- [Error Handling](#error-handling)26- [Examples](#examples)27- [Resources](#resources)2829## Overview30Comprehensive monitoring, logging, and alerting for Linear integrations using Prometheus metrics, structured logging, and health checks.3132## Prerequisites33- Linear integration deployed34- Metrics infrastructure (Prometheus, Datadog, etc.)35- Logging infrastructure (ELK, CloudWatch, etc.)36- Alerting system configured3738## Instructions3940### Step 1: Define Key Metrics41| Metric | Type | Purpose |42|--------|------|---------|43| `linear_api_requests_total` | Counter | Track request volume by operation/status |44| `linear_api_request_duration_seconds` | Histogram | Measure API latency |45| `linear_rate_limit_remaining` | Gauge | Monitor rate limit headroom |46| `linear_webhooks_received_total` | Counter | Track webhook volume |47| `linear_cache_hits_total` | Counter | Measure cache effectiveness |4849### Step 2: Instrument the Client50Wrap the Linear SDK's fetch layer to capture metrics on every API call including operation name, duration, status, and rate limit headers.5152### Step 3: Add Structured Logging53Use pino/winston with JSON output, component tags, and correlation IDs for API calls, webhooks, and errors.5455### Step 4: Create Health Check Endpoint56Verify API connectivity, cache status, and rate limit headroom. Return `healthy`, `degraded`, or `unhealthy` status.5758### Step 5: Configure Alerting Rules59- High error rate (>5% over 5 min)60- Rate limit low (<100 remaining)61- Slow responses (p95 > 2s)62- Webhook processing errors6364### Step 6: Build Grafana Dashboard65Panels for request rate, latency p95, rate limit remaining, and webhook distribution.6667See [detailed implementation](${CLAUDE_SKILL_DIR}/references/implementation.md) for full Prometheus metrics, instrumented client, logger, health check, alert rules, and Grafana dashboard JSON.6869## Output70- Prometheus metrics collecting on all Linear API calls71- Structured JSON logging for API calls and webhooks72- Health check endpoint returning system status73- Alerting rules for error rate, rate limits, and latency7475## Error Handling76| Error | Cause | Solution |77|-------|-------|----------|78| Metrics not collecting | Missing instrumentation | Wrap client with instrumented fetch |79| Alerts not firing | Wrong threshold | Adjust alert thresholds to match traffic |80| Missing labels | Logger misconfigured | Check logger base config and child loggers |8182## Examples8384### Quick Health Check85```bash86set -euo pipefail87curl http://localhost:3000/health/linear | jq # 3000: 3 seconds in ms88# { "status": "healthy", "checks": { "linear_api": { "status": "healthy", "latency_ms": 150 } } }89```9091## Resources92- [Prometheus Client Library](https://github.com/siimon/prom-client)93- [Grafana Dashboards](https://grafana.com/docs/grafana/latest/dashboards/)94- [Pino Logger](https://getpino.io/)9596## Next Steps97Create incident runbooks with `linear-incident-runbook`.