| title | Tutorial article for Carbon | Microsoft Docs |
|---|---|
| description | This sample describes the article in 115 to 145 characters. Validate using Gauntlet toolbar check icon. Use SEO kind of action verbs here. |
| services | sql-database |
| author | erickang |
| ms.author | erickang |
| manager | craigg |
| ms.reviewer | achatter, alayu, erickang, sanagama, sstein |
| ms.service | data-tools |
| ms.workload | data-tools |
| ms.prod | NEEDED |
| ms.custom | mvc, tutorial |
| ms.topic | article |
| ms.date | 10/01/2017 |
Follow Get Started with Carbon
In this tutorial, you use the Carbon to learn how to:
[!div class="checklist"]
- Bring your own monitoring query as an insight
- Visualize insight query result into a chart
- Pin the chart to a SQL Server and database dashboard
If you don't have an Azure subscription, create a free account before you begin.
Follow Get Started with Carbon
[step overview] In this tutorial, we use Query Store feature ...[give a brief explanation and link to QDS]
-
Enable Query Store on TutorialDB by executing following query.
ALTER DATABASE TutorialDB SET QUERY_STORE=ON
-
Open a new query editor from TutorialDB and copy & paste following script.
WITH SlowestQry AS( SELECT TOP 5 p.query_id, MAX(rs.max_duration ) max_duration FROM sys.query_store_plan AS p JOIN sys.query_store_runtime_stats AS rs ON p.plan_id = rs.plan_id WHERE rs.last_execution_time > DATEADD(week, -1, GETUTCDATE()) GROUP BY p.query_id ORDER BY MAX(rs.max_duration ) DESC) SELECT p.query_id, -- legend format(rs.last_execution_time,'yyyy-MM-dd hh:mm:ss') as [last_execution_time], -- x axis rs.max_duration, -- y axis p.plan_id FROM sys.query_store_plan AS p JOIN sys.query_store_runtime_stats AS rs ON p.plan_id = rs.plan_id JOIN SlowestQry tq ON tq.query_id = p.query_id WHERE rs.last_execution_time > DATEADD(week, -1, GETUTCDATE()) order by format(rs.last_execution_time,'yyyy-MM-dd hh:mm:ss') END
-
Press
F5to execute the query. After Carbon returns the query, clickView as Chartbutton. -
Change the chart type to
TimeSeriesand selecttopforLegend Position. It will render a line chart: -
Save the query in the editor to a *.sql file. For this tutorial, save the script as
qds_insight.sql.
[overview step]
-
Click
Create Insightbutton on Chart Viewer. It opens an insight widget configuration like:{ "name": "My-Widget", "gridItemConfig": { "sizex": 2, "sizey": 1 }, "widget": { "insights-widget": { "type": { "timeSeries": { "dataDirection": "horizontal", "dataType": "point", "legendPosition": "top", "labelFirstColumn": false, "columnsAsLabels": false } }, "queryFile": "/Users/myusername/Projects/database_project/qds_insight.sql" } } } -
Copy the insight configuration json data.
-
Press
F1and typesettingsin the Command Palette to open either User Settings or Workspace Settings. For this tutorial, selectPreferences: Open User Settingsfor this tutorial. For more information about the usage of Workspace settings, see Tips for workspace mode in Carbon -
Type
dashboardinSearch Settings. ClickEditondashboard.database.widgets.To configure an insight widget for SQL Server, click
Editfordashboard.server.widgets -
Paste the insight configuration json into
dashboard.database.widgets{}. Database dashboard will be:Repeat the same steps to add multiple insight widgets.
"dashboard.database.widgets": [ { "name": "My-Widget", "gridItemConfig": { "sizex": 2, "sizey": 1 }, "widget": { "insights-widget": { "type": { "timeSeries": { "dataDirection": "horizontal", "dataType": "point", "legendPosition": "top", "labelFirstColumn": false, "columnsAsLabels": false } }, "queryFile": "/Users/myusername/Projects/database_project/qds_insight.sql" } } }, { "name": "Tasks", "gridItemConfig": { "sizex": 2, "sizey": 1 }, "widget": { "tasks-widget": {} } }, { "gridItemConfig": { "sizex": 2, "sizey": 2 }, "widget": { "explorer-widget": {} } } ]
-
Save the User Settings file and Open Dashboard from TutorialDB.
In this tutorial, you learned how to:
[!div class="checklist"]
- Create something
- Do something
- Do something else
- Finish something
Next, learn how to use X, try this tutorial:
[!div class="nextstepaction"] What article is next in sequence




