grafana/skills

testing

Probe, load-test, and instrument frontends from Grafana Cloud.

소스 보기
원본 Skill 문서

원본 저장소의 제목, 예시, 코드, 표, 링크, 이미지를 유지해 표시합니다.

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

bash
# 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

bash
# 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

bash
# 1. Install
npm install @grafana/faro-web-sdk @grafana/faro-web-tracing
javascript
// 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() });
bash
# 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

같은 저장소의 Skills

더 많은 Skills

모든 Skills
grafana
커뮤니티

alerting-irm

Configure Grafana Alerting, Incident Response Management (IRM), and SLOs end-to-end — provisions Grafana-managed and data-source-managed alert rules, contact points (Slack/PagerDuty/email/webhook), notification policies with hierarchical matchers, silences, mute timings, on-call schedules and escalation chains, incident-management integrations, and SLOs with multi-window burn-rate alerts. Use when configuring alerts, debugging notification routing, setting up on-call rotations, declaring or managing incidents, defining SLOs, provisioning alerting via YAML or API, picking matchers for a notification policy, building a PagerDuty/Slack webhook receiver, or troubleshooting why an alert isn't firing — even when the user says "page me on errors", "alert me when X happens", "route this to the platform team", or "set up an SLO" without naming Alerting or IRM.

설치 수
5
GitHub Stars
246
업데이트
9월 8일
grafana
커뮤니티

alloy

Build a unified telemetry pipeline with Grafana Alloy — one OpenTelemetry-compatible binary that collects metrics, logs, traces, and profiles and ships to Grafana Cloud / Prometheus / Loki / Tempo / Pyroscope. Covers the Alloy config language (blocks, sys.env, component refs), prometheus.scrape → remotewrite, loki.source.file + loki.process → loki.write, otelcol.receiver.otlp → otelcol.exporter.otlp, pyroscope.scrape, K8s / Docker / EC2 discovery, relabeling, modules (import.file/git/http), clustering, Fleet Management remotecfg, the Alloy UI at :12345, and alloy fmt / alloy validate. Use when writing a config.alloy, replacing Grafana Agent / OTel Collector, scraping K8s pods, parsing logs, ingesting OTLP, or debugging "Alloy isn't sending anything" — even when the user says "set up the agent", "write me a scrape config", "drop these logs before sending", or "OTel collector config" without naming Alloy.

설치 수
5
GitHub Stars
246
업데이트
9월 8일
grafana
커뮤니티

beyla

Auto-instrument an application's HTTP / gRPC / DB traffic with Grafana Beyla eBPF — no code changes, no SDK, no restart. Covers requirements (Linux 5.8+ with BTF, CAPSYSADMIN, host PID), language matrix (Go / Java / Python / Ruby / Node / .NET / Rust / C++ / PHP), Docker + Helm + DaemonSet install, port- / process- / Kubernetes-metadata discovery, OTLP traces + Prometheus metrics export, routes decorator (cardinality control), trace sampling, and Grafana Cloud via Alloy. Use when adding observability to a service you can't recompile, instrumenting a closed-source binary, getting RED metrics + spans onto Tempo/Mimir without touching the app, or rolling Beyla as a cluster-wide DaemonSet — even when the user says "zero-code APM", "instrument legacy app", "trace this binary", "eBPF observability", or "no SDK" without naming Beyla.

설치 수
5
GitHub Stars
246
업데이트
9월 8일
grafana
커뮤니티

dashboarding

Build, modify, and ship Grafana dashboards as JSON via the HTTP API — panel types (timeseries / stat / gauge / table / heatmap / logs / traces / node-graph), gridPos 24-column layout, units, thresholds, template + datasource + chained variables, transformations (organize / calculateField / filterByValue), panel + dashboard links with ${field.labels.x} / ${from}, and Loki/Prometheus annotations. Use when scripting dashboard creation, writing the dashboard JSON for a new service, adding a $job dropdown variable, computing an "Error %" column with a transformation, overlaying deploys as annotations, or pushing a dashboard via POST /api/dashboards/db — even when the user says "create a dashboard for this metric", "add a service dropdown", "show errors as percentage", "overlay our deploys", or "export the dashboard JSON" without naming the API or schema. After every API push, verify with the returned version plus a GET on the dashboard UID.

설치 수
5
GitHub Stars
246
업데이트
9월 8일