GR

groq-observability

Set up monitoring for Groq API calls using Prometheus metrics and latency tracking.

Install

mkdir -p .claude/skills/groq-observability && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/8060" && unzip -o skill.zip -d .claude/skills/groq-observability && rm skill.zip

Installs to .claude/skills/groq-observability

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Set up observability for Groq integrations: latency histograms, token
69 charsno explicit “when” trigger
Advanced

Key capabilities

  • Instrument Groq API calls to capture latency, tokens, queue time, and estimated cost
  • Register Prometheus metrics for latency, tokens, cost, errors, throughput, and rate limits
  • Parse rate limit headers from Groq responses into a gauge
  • Configure Prometheus alert rules for latency, rate limits, throughput, error rate, and cost
  • Emit structured JSON log lines per request for log aggregation

How it works

The skill instruments Groq API calls to capture performance metrics. It then feeds these metrics to Prometheus, tracks rate limits, and sets up alerts and structured logging.

Inputs & outputs

You give it
Groq API calls with model and messages
You get back
A `trackedCompletion` wrapper returning `{ result, metrics }`, Prometheus metric set, five alert rules, structured JSON log line, and a 7-panel dashboard spec

When to use groq-observability

  • Track Groq inference latency histograms
  • Monitor token throughput and rate limit gauges
  • Configure Prometheus alerts for latency degradation
  • Build Grafana dashboards for Groq health

About this skill

Groq Observability

Overview

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.

Prerequisites

  • A Groq account with an API key exported as the GROQ_API_KEY environment variable — the groq-sdk client reads it automatically (new Groq()).
  • Node.js with groq-sdk and prom-client installed (npm install groq-sdk prom-client).
  • A Prometheus scrape target and (optionally) Grafana for the dashboard panels.

Key Metrics to Track

MetricTypeSourceWhy
TTFT (time to first token)HistogramClient-side timingGroq's main value prop
Tokens/secondGaugeusage.completion_timeThroughput degradation
Total latencyHistogramClient-side timingEnd-to-end performance
Rate limit remainingGaugex-ratelimit-remaining-* headersPrevent 429s
Token usageCounterusage.total_tokensCost attribution
Error rate by codeCounterError handlerAvailability
Estimated costCounterTokens * model priceBudget tracking

Instructions

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.

  1. Instrumented client — wrap groq.chat.completions.create so latency, tokens, queue time, and estimated cost are captured on the same path as the request (trackedCompletion).
  2. Prometheus metrics — register a histogram (latency), counters (tokens, cost, errors), and gauges (throughput, rate-limit remaining), then feed them from emitMetrics.
  3. Rate limit header tracking — parse x-ratelimit-remaining-* off every response into a gauge so you alert before a 429, not after.
  4. Prometheus alert rules — ship latency/rate-limit/throughput/error/cost alerts tuned to Groq's sub-200ms, 280+ tok/s baseline.
  5. Structured request logging — emit one JSON line per request for log aggregation, preserving per-request detail metrics roll up.
  6. Dashboard panels — TTFT distribution, tokens/sec, rate-limit utilization, request volume, error rate, cost, and queue time.
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.

Output

Applying the workflow produces:

  • A trackedCompletion wrapper that returns { result, metrics }, where metrics is a GroqMetrics object (latency, TTFT, tokens/sec, token counts, queue time, estimated cost).
  • A Prometheus metric setgroq_latency_ms (histogram), groq_tokens_total / groq_cost_usd / groq_errors_total (counters), and groq_tokens_per_second / groq_ratelimit_remaining (gauges).
  • Five alert rules (GroqLatencyHigh, GroqRateLimitCritical, GroqThroughputDrop, GroqErrorRateHigh, GroqCostSpike).
  • A structured JSON log line per request and a 7-panel dashboard spec.

Examples

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.

Error Handling

IssueCauseSolution
429 with high retry-afterRPM or TPM exhaustedImplement request queuing
Latency spike > 2sModel overloaded or large promptReduce prompt size or switch to lighter model
503 Service UnavailableGroq capacity issueEnable fallback to alternative provider
Tokens/sec dropStreaming disabled or large promptsEnable streaming for better perceived performance

Resources

Prerequisites

A Groq account with an API key exported as the `GROQ_API_KEY` environment variableNode.js with `groq-sdk` and `prom-client` installedA Prometheus scrape target and (optionally) Grafana for the dashboard panels

Limitations

  • 429 errors with high retry-after can occur if RPM or TPM are exhausted
  • Latency spikes > 2s can indicate model overload or large prompts
  • 503 Service Unavailable can occur due to Groq capacity issues

How it compares

This skill provides a dedicated observability framework for Groq, offering detailed performance insights beyond basic API logging.

Compared to similar skills

groq-observability side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
groq-observability (this skill)027dNo flagsAdvanced
langfuse76moNo flagsIntermediate
appinsights-instrumentation67moReviewBeginner
instantly-observability227dCautionIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

More by jeremylongshore

View all by jeremylongshore

analyzing-logs

jeremylongshore

Analyze application logs to detect performance issues, identify error patterns, and improve stability by extracting key insights.

14123

ollama-setup

jeremylongshore

Configure auto-configure Ollama when user needs local LLM deployment, free AI alternatives, or wants to eliminate hosted API costs. Trigger phrases: "install ollama", "local AI", "free LLM", "self-hosted AI", "replace OpenAI", "no API costs". Use when appropriate context detected. Trigger with relevant phrases based on skill purpose.

1167

backtesting-trading-strategies

jeremylongshore

Backtest crypto and traditional trading strategies against historical data. Calculates performance metrics (Sharpe, Sortino, max drawdown), generates equity curves, and optimizes strategy parameters. Use when user wants to test a trading strategy, validate signals, or compare approaches. Trigger with phrases like "backtest strategy", "test trading strategy", "historical performance", "simulate trades", "optimize parameters", or "validate signals".

1071

generating-database-seed-data

jeremylongshore

Process this skill enables AI assistant to generate realistic test data and database seed scripts for development and testing environments. it uses faker libraries to create realistic data, maintains relational integrity, and allows configurable data volumes. u... Use when working with databases or data models. Trigger with phrases like 'database', 'query', or 'schema'.

1033

cursor-codebase-indexing

jeremylongshore

Execute set up and optimize Cursor codebase indexing. Triggers on "cursor index setup", "codebase indexing", "index codebase", "cursor semantic search". Use when working with cursor codebase indexing functionality. Trigger with phrases like "cursor codebase indexing", "cursor indexing", "cursor".

885

testing-mobile-apps

jeremylongshore

Execute mobile app testing on iOS and Android devices/simulators. Use when performing specialized testing. Trigger with phrases like "test mobile app", "run iOS tests", or "validate Android functionality".

810

You might also like

langfuse

davila7

Expert in Langfuse - the open-source LLM observability platform. Covers tracing, prompt management, evaluation, datasets, and integration with LangChain, LlamaIndex, and OpenAI. Essential for debugging, monitoring, and improving LLM applications in production. Use when: langfuse, llm observability, llm tracing, prompt management, llm evaluation.

743

appinsights-instrumentation

github

Instrument a webapp to send useful telemetry data to Azure App Insights

66

instantly-observability

jeremylongshore

Set up comprehensive observability for Instantly integrations with metrics, traces, and alerts. Use when implementing monitoring for Instantly operations, setting up dashboards, or configuring alerting for Instantly integration health. Trigger with phrases like "instantly monitoring", "instantly metrics", "instantly observability", "monitor instantly", "instantly alerts", "instantly tracing".

26

apollo-observability

jeremylongshore

Set up Apollo.io monitoring and observability. Use when implementing logging, metrics, tracing, and alerting for Apollo integrations. Trigger with phrases like "apollo monitoring", "apollo metrics", "apollo observability", "apollo logging", "apollo alerts".

12

fireflies-observability

jeremylongshore

Set up comprehensive observability for Fireflies.ai integrations with metrics, traces, and alerts. Use when implementing monitoring for Fireflies.ai operations, setting up dashboards, or configuring alerting for Fireflies.ai integration health. Trigger with phrases like "fireflies monitoring", "fireflies metrics", "fireflies observability", "monitor fireflies", "fireflies alerts", "fireflies tracing".

02

evernote-observability

jeremylongshore

Implement observability for Evernote integrations. Use when setting up monitoring, logging, tracing, or alerting for Evernote applications. Trigger with phrases like "evernote monitoring", "evernote logging", "evernote metrics", "evernote observability".

10

Search skills

Search the agent skills registry