Agent Skillsgrafana/skills › testing

testing

GitHub

提供Grafana Cloud测试能力,涵盖合成监控、k6分布式负载测试及Faro前端可观测性。支持多区域探针探测、发布门禁负载测试、TLS证书监控及前端性能指标追踪,用于保障API/网站可用性与前端用户体验。

skills/grafana-cloud/testing/SKILL.md grafana/skills

Trigger Scenarios

检查网站或API在多个区域的可用性 基于负载测试结果进行发布门禁 监控TLS证书过期时间 为React/Vue应用集成前端监控SDK 追踪Core Web Vitals等性能指标 将前端错误与后端链路追踪关联

Install

npx skills add grafana/skills --skill testing -g -y
More Options

Non-standard path

npx skills add https://github.com/grafana/skills/tree/main/skills/grafana-cloud/testing -g -y

Use without installing

npx skills use grafana/skills@testing

指定 Agent (Claude Code)

npx skills add grafana/skills --skill testing -a claude-code -g -y

安装 repo 全部 skill

npx skills add grafana/skills --all -g -y

预览 repo 内 skill

npx skills add grafana/skills --list

SKILL.md

Frontmatter
{
    "name": "testing",
    "license": "Apache-2.0",
    "description": "Probe, load-test, and instrument frontends from Grafana Cloud. Covers Synthetic Monitoring (HTTP \/ DNS \/ TCP \/ Ping \/ Traceroute \/ Multihttp \/ k6-browser scripted checks from 20+ global probes, alert on `probe_success` + TLS-cert expiry), Grafana Cloud k6 (distributed load tests across AWS load-zones, scenarios, `http_req_duration` thresholds, CI integration via `grafana\/k6-action`), and Frontend Observability with Faro Web SDK (RUM, Core Web Vitals, custom events, `pushError`, distributed-trace correlation). Use when checking website \/ API uptime from multiple regions, gating a release on a load test, watching for TLS-cert renewal, instrumenting a React\/Vue app, tracking Core Web Vitals, or correlating frontend errors to backend traces — even when the user says \"is my login flow up?\", \"monitor my API\", \"ping our endpoint every minute\", \"release-gate load test\", \"browser performance monitoring\", \"session replay\", or \"RUM\" without naming Synthetic Monitoring \/ k6 \/ Faro."
}

Grafana Cloud Testing

Docs: https://grafana.com/docs/grafana-cloud/testing/

Three pillars: external probing (Synthetic Monitoring), load testing (k6 Cloud), real-user monitoring (Faro).

Prerequisites

  • Grafana Cloud stack
  • Synthetic Monitoring: SM access token (sm:write)
  • k6 Cloud: a Grafana Cloud k6 token + projectID
  • Faro: a Faro app + write-token from Frontend Observability → Apps

Common Workflows

1. Create + verify a Synthetic HTTP check

# 1. Create the check (full payload in references/synthetic.md)
curl -X POST https://synthetic-monitoring-api.grafana.net/sm/checks \
  -H "Authorization: Bearer <sm-token>" -H "Content-Type: application/json" \
  -d '{"job":"website","target":"https://example.com","frequency":60000,"timeout":15000,
       "enabled":true,"probes":[1,5,10],
       "settings":{"http":{"method":"GET","validStatusCodes":[200]}}}'

# 2. List checks — confirm it exists and is enabled
curl -s https://synthetic-monitoring-api.grafana.net/sm/checks \
  -H "Authorization: Bearer <sm-token>" | jq '.[] | select(.job=="website")'

# 3. Verify probe_success arrived (wait ~60s for the first run)
#    In Grafana Explore on the synthetic metrics datasource:
#      probe_success{job="website"}
#    Expect 1 from each probe in `probes:[1,5,10]`.
#
# Rollback: DELETE /sm/checks/<id> or set `"enabled": false`.

See references/synthetic.md for all check types, PromQL queries, and alert rules.

2. Run a k6 cloud load test

# 1. Authenticate once
k6 cloud login --token <grafana-cloud-k6-token>

# 2. Validate the script locally first (smoke run, no cloud cost)
k6 run --vus 1 --duration 30s script.js

# 3. Launch in cloud
k6 cloud script.js
# → URL of the run; thresholds (p95<500ms, error<1%) decide pass/fail.

# 4. Verify in CI — exit code 0 = thresholds passed, 99 = threshold failed.
echo $?

Full script + scenarios + CI YAML: references/k6-and-faro.md.

3. Instrument a frontend with Faro

# 1. Install
npm install @grafana/faro-web-sdk @grafana/faro-web-tracing
// 2. initializeFaro({ url, apiKey, app, instrumentations }) — see references/k6-and-faro.md
// 3. Push a test event so we have something to look for:
faro.api.pushEvent('faro_smoketest', { ts: Date.now().toString() });
# 4. Verify the collector accepted it (browser DevTools → Network)
#    POST to /collect should return 202. If 401 — apiKey mismatch.

# 5. Verify in Grafana
#    - Frontend Observability → your app → Sessions: should show your session
#    - Explore on Loki: `{kind="event"} |= "faro_smoketest"`
#    - For traces: filter by `service.name="my-frontend"` in Tempo

Troubleshooting

  • Synthetic check stuck at probe_success=0 → check probe_*_duration_seconds for the failing stage; the probe-region label tells you which prober errored
  • k6 cloud run "ABORTED_THRESHOLD" → a threshold tripped; inspect the run page to see which one
  • Faro events not landing → check the browser network call to /collect returns 202; common cause is wrong apiKey or url (must match the FE Observability app)

References

Resources

Version History

  • 80bb293 Current 2026-08-01 21:38
  • b583762 2026-07-06 00:35

Same Skill Collection

skills/grafana-app-sdk/admission-control/SKILL.md
skills/grafana-cloud/loki-label-analyzer/SKILL.md
skills/grafana-cloud/send-data/SKILL.md
skills/grafana-datasources/datasources-provisioning/SKILL.md
skills/grafana-lgtm/loki/SKILL.md
skills/grafana-lgtm/prometheus/SKILL.md
skills/grafana-plugins/audit-and-reduce-dependencies/SKILL.md
skills/grafana-plugins/check-npm/SKILL.md
template/SKILL.md
skills/grafana-app-sdk/app-sdk-concepts/SKILL.md
skills/grafana-app-sdk/cue-kind-definition/SKILL.md
skills/grafana-app-sdk/reconciler-logic/SKILL.md
skills/grafana-cloud/adaptive-metrics/SKILL.md
skills/grafana-cloud/admin/SKILL.md
skills/grafana-cloud/app-observability/SKILL.md
skills/grafana-cloud/assistant-mcp/SKILL.md
skills/grafana-cloud/cloud-integrations/SKILL.md
skills/grafana-cloud/cost-management/SKILL.md
skills/grafana-cloud/database-observability/SKILL.md
skills/grafana-cloud/dpm-finder/SKILL.md
skills/grafana-cloud/fleet-management/SKILL.md
skills/grafana-cloud/infrastructure/SKILL.md
skills/grafana-cloud/ml-ai/SKILL.md
skills/grafana-cloud/oncall-irm/SKILL.md
skills/grafana-cloud/private-connectivity/SKILL.md
skills/grafana-cloud/prometheus-cardinality-troubleshooter/SKILL.md
skills/grafana-cloud/prometheus-label-strategy/SKILL.md
skills/grafana-cloud/synthetic-monitoring-checks/SKILL.md
skills/grafana-core/alerting-irm/SKILL.md
skills/grafana-core/alloy/SKILL.md
skills/grafana-core/beyla/SKILL.md
skills/grafana-core/dashboarding/SKILL.md
skills/grafana-core/grafana-oss/SKILL.md
skills/grafana-core/opentelemetry/SKILL.md
skills/grafana-core/promql/SKILL.md
skills/grafana-core/skill-authoring/SKILL.md
skills/grafana-k6/k6-cloud-investigate-test/SKILL.md
skills/grafana-k6/k6-docs/SKILL.md
skills/grafana-k6/k6-manage/SKILL.md
skills/grafana-k6/k6-perf-test-website/SKILL.md
skills/grafana-k6/k6-test-maintenance/SKILL.md
skills/grafana-k6/k6-trend-analysis/SKILL.md
skills/grafana-k6/k6/SKILL.md
skills/grafana-lgtm/mimir/SKILL.md
skills/grafana-lgtm/pyroscope/SKILL.md
skills/grafana-lgtm/tempo/SKILL.md
skills/grafana-plugins/grafana-scenes/SKILL.md
skills/grafana-plugins/plugin-bundle-size/SKILL.md
skills/grafana-plugins/react-19-plugin-migration/SKILL.md

Metadata

Files
0
Version
80bb293
Hash
15e326bc
Indexed
2026-07-06 00:35

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-04 10:33
浙ICP备14020137号-1 $Гость$