Terminal
Terminal/Skill
Creates, reads and edits Statsig dashboards and their widgets through the Console API, with bundled scripts.
By Statsig
Works with
npx skills add statsig-io/agent-skills --skill statsig-dashboardBuild valid dashboard API requests for the console v1 dashboards API and execute them with the bundled scripts.
Read references/dashboard-api.md for the exact field-level schema, supported values, and ready-to-edit examples.
The command examples below assume you are running from this skill directory.
export STATSIG_CONSOLE_API_KEY="..."python3 scripts/create_dashboard.py \
--body-file /tmp/dashboard.json
scripts/create_dashboard.py: create a new dashboard with POST /console/v1/dashboardsscripts/read_dashboard.py: fetch a dashboard and print a create-compatible shape by default using GET /console/v1/dashboards/{id}scripts/add_dashboard_widgets.py: append widgets with POST /console/v1/dashboards/{id}/widgetsscripts/replace_dashboard_widgets.py: replace all widgets with PUT /console/v1/dashboards/{id}/widgetscreate_dashboard.pyread_dashboard.pyadd_dashboard_widgets.pyreplace_dashboard_widgets.pynamedescriptiondefaultswidgetsheadertexttimeserieswidth and heighttimeseries, enforce the query contract exactly:
source or sourcestype: "event" for each sourceaggregation!statsig_value rather than valueWhen a widget needs to scope to a Statsig service, prefer filtering on:
{
"property": {
"key": "custom.service",
"column": "user_object"
},
"operator": "EQ",
"values": ["service-name"]
}
Do not default to bare service when building dashboard widgets. In Statsig event payloads this is commonly nested under user_object.custom, so custom.service is the safer default.
When a widget targets a metric that may come from OTEL, sample the metric first and inspect company_metadata.__metric_type.
__metric_type is present, treat the metric as OTEL-backed and prefer the matching OTEL aggregation family instead of the plain aggregation.__metric_type is absent on a representative sample, treat it as a non-OTEL metric and use the normal aggregation types.Preferred mapping:
__metric_type = "gauge": use OTEL_GAUGE__AVG, OTEL_GAUGE__MAX, OTEL_GAUGE__MIN, or OTEL_GAUGE__SUM__metric_type = "counter": use OTEL_COUNTER__SUM, OTEL_COUNTER__AVG, OTEL_COUNTER__MIN, or OTEL_COUNTER__MAX__metric_type = "histogram": use the OTEL histogram aggregations documented in references/dashboard-api.mdKeep the aggregation intent the same when converting:
OTEL_GAUGE__AVG instead of AVGOTEL_GAUGE__MAX instead of MAXrow or column. The API currently supports widget sizing via width and height, not explicit placement.id in the create request body.GET /console/v1/dashboards/{id}, reuse that create-compatible shape but remove id.Minimal dashboard:
cat > /tmp/dashboard.json <<'JSON'
{
"name": "Checkout Overview"
}
JSON
python3 scripts/create_dashboard.py \
--body-file /tmp/dashboard.json
Read an existing dashboard into a reusable create payload:
python3 scripts/read_dashboard.py \
--dashboard-id dash_123
Append widgets to an existing dashboard:
python3 scripts/add_dashboard_widgets.py \
--dashboard-id dash_123 \
--body-file /tmp/add-widgets.json
Replace all widgets on an existing dashboard:
python3 scripts/replace_dashboard_widgets.py \
--dashboard-id dash_123 \
--body-file /tmp/replace-widgets.json
STATSIG_CONSOLE_API_KEY from the environment.STATSIG_API_VERSION to 20240601.--api-version or set STATSIG_API_VERSION to override that default.https://api.statsig.com/console/v1/dashboards.statsig-api-key header.statsig-api-version header.create_dashboard.py, add_dashboard_widgets.py, and replace_dashboard_widgets.py accept:
--body-file--bodyread_dashboard.py, add_dashboard_widgets.py, and replace_dashboard_widgets.py require --dashboard-id.--dry-run.--raw.read_dashboard.py prints the raw GET response only when --raw is set. Otherwise it unwraps data and removes id.