Skip to main content
You run the same online store in staging and production, and you want the same checkout dashboard in both. Building it twice by hand means picking the same metrics, tags, and settings twice, and keeping both in sync later. With the appsignal-cli dashboards commands, you describe each chart once in a JSON file and add it to any app with one command. The dashboards commands list, create, and update an app’s dashboards, and show, add, and update the charts on them. This page walks you through building a Checkout health dashboard with two charts, then lists every setting a chart takes.

Why manage dashboards from the terminal

  • Build the same dashboard in every app. Point the same commands and chart files at another app or environment with --app and --environment.
  • Keep chart definitions next to your code. Each chart is a small JSON file, so you can store it in your repository and review changes to it like any other change.
  • Let scripts and agents do the work. With --output json, every command returns machine-readable output, including the IDs you need for the next command.
The CLI doesn’t delete dashboards or charts, duplicate charts, or export and import dashboards. Do those in AppSignal: see use dashboards and charts. To build a dashboard in AppSignal instead, see create a dashboard. Each command targets one application, by name and environment (--app "MyApp" --environment production) or by ID (--app-id <APP_ID>, the long hexadecimal app ID from appsignal-cli apps list). The --environment flag is only needed when several apps share a name. Each command uses your default organization unless you pass --org. See Apps and organizations for how apps are identified.

List dashboards

Shell
The list includes each dashboard’s ID, which you need to update one.

Show a dashboard

To see a dashboard’s details and its charts, pass the dashboard’s --id:
Shell
The output lists each chart with its ID, type, and settings. You need a chart’s ID to update it. With --output json, the charts are in dashboard.visuals, each with its id, its type in __typename, and its settings. add-visual and update-visual return the same shape.

Create a dashboard

A new dashboard needs a title and a description:
Shell
The command prints the new dashboard’s ID. Pass it as --dashboard-id when you add a chart. To group the dashboard in the sidebar, separate the group name and the dashboard name with a slash (/) in --title, such as Shop/Checkout health.

Update a dashboard

Pass the dashboard’s --id (from dashboards list) along with the new title:
Shell
--title is required even when you only change the description.

Add a chart

You describe a chart in a JSON file, then add it with add-visual. Say you run an online store. Your Checkout health dashboard should answer two questions: is checkout slow, and is it failing? To see how slow checkout is for your slowest customers, chart its 95th percentile response time over time. That’s a timeseries chart. Save it as checkout-speed.json:
checkout-speed.json
Then add it to the dashboard:
Shell
To see how often checkout fails, add a Big Number tile with the total errors in the selected time range. That’s a number chart, which takes a single metric. The metric name and tags can’t contain a wildcard (*), because the chart shows a single series. Save it as checkout-errors.json:
checkout-errors.json
Shell
Replace CheckoutsController#create with the action that handles checkout in your app. If your app hasn’t been moved to trace metrics yet, use transaction_duration instead of trace_duration. Every new chart needs a nonempty title and description. To read the JSON from standard input instead of a file, pass --file -. Open the dashboard in AppSignal to see both charts. One shows the checkout response time over the selected time range. The other shows the number of checkout errors in that range.
A dashboard with two charts over the last hour. The Checkout response time line graph, described as how long checkout takes for the slowest 5% of customers, moves between 0 ms and about 3 seconds. Below it, the Checkout errors number chart, described as errors raised during checkout in the selected time range, shows 56 with the text Total value in recent 1 hour.

The two charts added with add-visual, on a dashboard created with the CLI.

The CLI doesn’t retry a failed chart creation. If add-visual fails with a network error, check the dashboard with dashboards show before you retry. That way, you don’t add the chart twice.

Update a chart

To change a chart, pass only the settings you want to change. Everything else stays as it is. For example, to show the checkout response time as an area chart, get the chart’s ID from dashboards show and run:
Shell
update-visual takes the same app flags as add-visual, plus: A few settings need more care:
  • Lists and objects are replaced whole. To also chart the payment step, pass metrics with both the checkout metric and the new one. To move a chart, pass all four layout values.
  • To clear a setting, set it to null. This works for description, formatInput, layout, lineLabel, minYAxis, and a number chart’s metric. format can’t be cleared, so set it to another format instead.
  • To remove all of a timeseries chart’s metrics, pass "metrics": [].
  • Changing format away from size also clears formatInput.
A chart keeps its type, so you can’t turn a timeseries chart into a number chart. An update with no settings is rejected.

Chart settings

Chart JSON uses camelCase keys and holds settings only. The dashboard ID, chart ID, and chart type go in the command flags. Unknown keys, invalid values, and settings for the other chart type return an error. These settings take a fixed set of values:

Next steps

You can now build a dashboard and its charts from the terminal and repeat it in any app. A dashboard visualizes your metrics. To get alerted when one crosses a threshold, set up anomaly detection triggers.