From groq-pack
Set up observability for Groq integrations: latency histograms, token throughput, rate limit gauges, cost tracking, and Prometheus alerts.
How this skill is triggered — by the user, by Claude, or both
Slash command
/groq-pack:groq-observabilityThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Monitor Groq LPU inference for latency, token throughput, rate limit utilization, and cost. Groq's defining advantage is speed (280-560 tok/s), so latency degradation is the highest-priority signal. The API returns rich timing metadata (`queue_time`, `prompt_time`, `completion_time`) and rate limit headers on every response.
Monitor Groq LPU inference for latency, token throughput, rate limit utilization, and cost. Groq's defining advantage is speed (280-560 tok/s), so latency degradation is the highest-priority signal. The API returns rich timing metadata (queue_time, prompt_time, completion_time) and rate limit headers on every response.
GROQ_API_KEY environment variable — the groq-sdk client reads it automatically (new Groq()).groq-sdk and prom-client installed (npm install groq-sdk prom-client).| Metric | Type | Source | Why |
|---|---|---|---|
| TTFT (time to first token) | Histogram | Client-side timing | Groq's main value prop |
| Tokens/second | Gauge | usage.completion_time | Throughput degradation |
| Total latency | Histogram | Client-side timing | End-to-end performance |
| Rate limit remaining | Gauge | x-ratelimit-remaining-* headers | Prevent 429s |
| Token usage | Counter | usage.total_tokens | Cost attribution |
| Error rate by code | Counter | Error handler | Availability |
| Estimated cost | Counter | Tokens * model price | Budget tracking |
Apply these six steps in order. Steps 1-2 are the core instrumentation loop — wrap the client, then feed a Prometheus instrument set from each call. Steps 3-6 add rate-limit tracking, alerting, structured logs, and dashboards on top. The lean client skeleton is below; the full code for every step lives in references/implementation.md.
groq.chat.completions.create so latency, tokens, queue time, and estimated cost are captured on the same path as the request (trackedCompletion).emitMetrics.x-ratelimit-remaining-* off every response into a gauge so you alert before a 429, not after.import Groq from "groq-sdk";
const groq = new Groq(); // reads GROQ_API_KEY
async function trackedCompletion(model: string, messages: any[]) {
const start = performance.now();
const result = await groq.chat.completions.create({ model, messages });
const latencyMs = performance.now() - start;
const usage = result.usage!;
const metrics = {
model,
latencyMs: Math.round(latencyMs),
tokensPerSec: Math.round(usage.completion_tokens / ((usage as any).completion_time || latencyMs / 1000)),
totalTokens: usage.total_tokens,
};
emitMetrics(metrics); // -> Prometheus (Step 2)
return { result, metrics };
}
See references/implementation.md for the complete
GroqMetrics shape, pricing table, Prometheus instruments, rate-limit tracking,
alert rules, structured logging, and dashboard panel list.
Applying the workflow produces:
trackedCompletion wrapper that returns { result, metrics }, where metrics is a GroqMetrics object (latency, TTFT, tokens/sec, token counts, queue time, estimated cost).groq_latency_ms (histogram), groq_tokens_total / groq_cost_usd / groq_errors_total (counters), and groq_tokens_per_second / groq_ratelimit_remaining (gauges).GroqLatencyHigh, GroqRateLimitCritical, GroqThroughputDrop, GroqErrorRateHigh, GroqCostSpike).Instrument a single completion and emit a structured log line:
const { result, metrics } = await trackedCompletion(
"llama-3.3-70b-versatile",
[{ role: "user", content: "Summarize this incident report in two sentences." }]
);
logGroqRequest(metrics, result.id);
// metrics.tokensPerSec -> 310, metrics.estimatedCostUsd -> 0.000404
For a 429-guard using rate-limit headers and a dashboard health-reading table, see references/examples.md.
| Issue | Cause | Solution |
|---|---|---|
| 429 with high retry-after | RPM or TPM exhausted | Implement request queuing |
| Latency spike > 2s | Model overloaded or large prompt | Reduce prompt size or switch to lighter model |
| 503 Service Unavailable | Groq capacity issue | Enable fallback to alternative provider |
| Tokens/sec drop | Streaming disabled or large prompts | Enable streaming for better perceived performance |
groq-incident-runbook skill.npx claudepluginhub jeremylongshore/claude-code-plugins-plus-skills --plugin groq-packHandles Groq rate limits with exponential backoff, request queuing, and header parsing. Triggered by phrases like 'groq rate limit' or 'groq 429'.
Sets up Mistral AI observability with instrumented client wrapper, Prometheus metrics, Grafana dashboard panels, and alerting rules. Use for monitoring Mistral API usage, latency, token consumption, error rates, and costs.
Instruments Claude API calls with Python structured logging and Prometheus metrics to track latency, cost, errors, token usage, and rate limits.