Metrics Graphana logo

Metrics Graphana

OrganizationPopular
slopus
metrics-graphana

Query and manage Grafana dashboards and Prometheus metrics for Happy infrastructure. Covers grafanactl CLI usage, direct Prometheus queries through Grafana proxy, and dashboard-as-code workflows. Use when user asks about metrics, dashboards, monitoring, Grafana, Prometheus, or wants to add/modify panels.

Overview

Publisherslopus
Repositoryhappy
Skill namemetrics-graphana
Stars
24.1K
Forks
2.1K
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by slopus on GitHub. Read the source before you install it.

Installation

Install the Metrics Graphana AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/slopus/happy/tree/main/.agents/skills/metrics-graphana
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/slopus/happy.git /tmp/happy
mkdir -p .claude/skills
cp -r /tmp/happy/.agents/skills/metrics-graphana .claude/skills/metrics-graphana
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Metrics Graphana in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Metrics Graphana on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Metrics Graphana is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Metrics & Grafana

You are the observability operator for the Happy infrastructure. You can query live Prometheus metrics, manage Grafana dashboards as code, and investigate production behavior.

Environment Variables

Credentials are stored in the repo root .env file (gitignored). Load them before running commands:

GRAFANA_URL=...
GRAFANA_USER=...
GRAFANA_PASSWORD=...
GRAFANA_PROMETHEUS_UID=...

To load in shell:

bash
set -a; source .env; set +a

All commands below use $GRAFANA_URL, $GRAFANA_USER, $GRAFANA_PASSWORD, and $GRAFANA_PROMETHEUS_UID from the environment.


Prerequisites

Install grafanactl

bash
go install github.com/grafana/grafanactl/cmd/grafanactl@latest

Ensure $HOME/go/bin is on your PATH.

Configure grafanactl

bash
# Load env vars first
set -a; source .env; set +a

# Create a context for the Happy Grafana instance
grafanactl config set contexts.happy.grafana.server "$GRAFANA_URL"
grafanactl config set contexts.happy.grafana.user "$GRAFANA_USER"
grafanactl config set contexts.happy.grafana.password "$GRAFANA_PASSWORD"
grafanactl config set contexts.happy.grafana.org-id 1

# Switch to the context
grafanactl config use-context happy

# Verify
grafanactl config check

Config file lives at ~/Library/Application Support/grafanactl/config.yaml (macOS) or ~/.config/grafanactl/config.yaml (Linux).


grafanactl CLI Reference

List resources

bash
grafanactl resources list                    # List all resource types
grafanactl resources get dashboards          # List all dashboards
grafanactl resources get folders             # List all folders

Pull dashboards (export to disk)

bash
grafanactl resources pull dashboards -p ./resources -o json
grafanactl resources pull dashboards/DASHBOARD_ID -p ./resources -o json

Push dashboards (deploy from disk)

bash
# Push all dashboards from ./resources
grafanactl resources push dashboards -p ./resources

# Push a specific dashboard
grafanactl resources push dashboards/DASHBOARD_ID -p ./resources

# IMPORTANT: Use --omit-manager-fields to keep dashboards editable from the Grafana UI
grafanactl resources push dashboards -p ./resources --omit-manager-fields

# Dry run (no changes)
grafanactl resources push dashboards -p ./resources --dry-run

Workflow: Edit a dashboard

bash
# 1. Pull current state
mkdir -p /tmp/grafana-work
grafanactl resources pull dashboards -p /tmp/grafana-work -o json

# 2. Edit the JSON files (add panels, modify queries, etc.)

# 3. Push back — always use --omit-manager-fields to avoid locking the UI
grafanactl resources push dashboards -p /tmp/grafana-work --omit-manager-fields

Warning: Pushing without --omit-manager-fields marks the dashboard as "provisioned" and locks it from UI edits. Always include this flag unless you explicitly want CLI-only management.


Querying Prometheus Directly

You can query Prometheus through Grafana's datasource proxy API. This is useful for live investigation without touching the Grafana UI.

Instant query (current value)

bash
curl -s -u "$GRAFANA_USER:$GRAFANA_PASSWORD" \
  --data-urlencode 'query=YOUR_PROMQL_HERE' \
  "$GRAFANA_URL/api/datasources/proxy/uid/$GRAFANA_PROMETHEUS_UID/api/v1/query" \
  | python3 -m json.tool

Range query (time series)

bash
curl -s -u "$GRAFANA_USER:$GRAFANA_PASSWORD" \
  --data-urlencode 'query=YOUR_PROMQL_HERE' \
  --data-urlencode 'start=UNIX_TIMESTAMP' \
  --data-urlencode 'end=UNIX_TIMESTAMP' \
  --data-urlencode 'step=60' \
  "$GRAFANA_URL/api/datasources/proxy/uid/$GRAFANA_PROMETHEUS_UID/api/v1/query_range" \
  | python3 -m json.tool

List all metric names

bash
curl -s -u "$GRAFANA_USER:$GRAFANA_PASSWORD" \
  "$GRAFANA_URL/api/datasources/proxy/uid/$GRAFANA_PROMETHEUS_UID/api/v1/label/__name__/values" \
  | python3 -c "import json,sys; [print(n) for n in json.load(sys.stdin)['data']]"

Filter metric names

bash
# Find all RPC-related metrics
curl -s -u "$GRAFANA_USER:$GRAFANA_PASSWORD" \
  "$GRAFANA_URL/api/datasources/proxy/uid/$GRAFANA_PROMETHEUS_UID/api/v1/label/__name__/values" \
  | python3 -c "import json,sys; [print(n) for n in json.load(sys.stdin)['data'] if 'rpc' in n.lower()]"

Key Metrics

Application metrics (handy-server)

MetricTypeDescription
rpc_calls_totalcounterRPC calls by method and result (success, not_available, target_disconnected, timeout)
rpc_call_duration_seconds_buckethistogramRPC call duration by method
rpc_lookup_retries_buckethistogramNumber of retries per socket lookup by method
rpc_fetchsockets_timeouts_totalcounterfetchSockets timeout count by context (lookup, presence)
websocket_connections_totalgaugeActive WebSocket connections by type
websocket_events_totalcounterWebSocket events by type
http_requests_totalcounterHTTP requests by method, route, status
http_request_duration_seconds_buckethistogramHTTP request duration by route
session_cache_operations_totalcounterSession cache hits/misses by operation
session_alive_events_totalcounterSession keepalive events
machine_alive_events_totalcounterMachine keepalive events
database_records_totalgaugeRecord counts by table
database_updates_skipped_totalcounterSkipped DB updates by type

Useful PromQL queries

promql
# RPC success rate by method
sum by(method) (rate(rpc_calls_total{result="success"}[5m]))
/ (sum by(method) (rate(rpc_calls_total[5m])))

# RPC failures by method and reason
sum by (method, result) (rate(rpc_calls_total{result!="success"}[5m]))

# RPC failures by type only
sum by (result) (rate(rpc_calls_total{result!="success"}[5m]))

# RPC P95 latency by method
histogram_quantile(0.95, sum by (method, le) (rate(rpc_call_duration_seconds_bucket[5m])))

# Socket lookup retry distribution (P95)
histogram_quantile(0.95, sum by (method, le) (rate(rpc_lookup_retries_bucket[5m])))

# fetchSockets timeout rate by context
sum by (context) (rate(rpc_fetchsockets_timeouts_total[5m]))

# HTTP error rate
sum(rate(http_requests_total{status=~"5.."}[5m])) / sum(rate(http_requests_total[5m]))

# Top routes by request rate
topk(10, sum by(method, route) (rate(http_requests_total[5m])))

Dashboards

Happy Server Application Metrics

  • ID: 470da978-91f7-4721-be2c-cc451bf074a2
  • Tags: happy-server, application, websocket, http, database
  • Panels: WebSocket connections, session cache, alive events, HTTP metrics, database stats, RPC metrics

Adding a panel

When adding panels to a dashboard JSON, follow this pattern:

  1. Use the Prometheus datasource: {"type": "prometheus", "uid": "$GRAFANA_PROMETHEUS_UID"}
  2. Pick the next available id (check existing panels for max id)
  3. Position with gridPos: h = height (8 standard), w = width (12 half, 24 full), x = column (0 or 12), y = row
  4. Common panel types: stat, timeseries, piechart, bargauge, table
  5. Set appropriate unit: percentunit, ops, s, short, reqps

Tips

  • Always pull before editing to get the latest state
  • Use --dry-run on push to preview changes
  • The --omit-manager-fields flag is essential for hybrid CLI+UI workflows
  • Range queries need Unix timestamps — use date +%s to get current time
  • When investigating metrics, start with instant queries for current state, then use range queries for trends

Frequently asked questions

What does the Metrics Graphana AI skill do?

Query and manage Grafana dashboards and Prometheus metrics for Happy infrastructure. Covers grafanactl CLI usage, direct Prometheus queries through Grafana proxy, and dashboard-as-code workflows. Use when user asks about metrics, dashboards, monitoring, Grafana, Prometheus, or wants to add/modify panels.

Why use Metrics Graphana on TypingMind?

Because you install it once and use it with any model. Metrics Graphana is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Metrics Graphana in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/slopus/happy/tree/main/.agents/skills/metrics-graphana. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Metrics Graphana?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Metrics Graphana?

As many as you like. As long as a model supports skills, you can use Metrics Graphana with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Metrics Graphana AI skill free?

Yes. It is published on GitHub by slopus under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇