未加星标

Creating Wait stats widget on Azure Data Studio for macOS

字体大小 | |
[系统(windows) 所属分类 系统(windows) | 发布者 店小二03 | 时间 2018 | 作者 红领巾 ] 0人收藏点击收藏

A couple of weeks ago, Microsoft released a new multi-platform tool called Azure Data Studio, this tool is the final version of SQL Operations Studio. If you are familiar to SQLOps, you probably recall that this tool 100% open source, and because of that you can customize the JSON code to do certain things the way it works best for you.

In my personal opinion, this is of the best features of Azure Data Studio are widgets. It gives the option to DBA’s or Database developers to create their own custom widgets to access SQL Server data using simple charts. I personally don’t like the very buggy reports from SSMS which take time to load and are not fully customizable … they are like a black box to me.

I decided to give it a try and create a custom widget of wait stats, because I use them everyday and alsois one of the most common troubleshooting methodologies across SQL Server data professionals. If you are not familiar with wait stats, you should … it provides diagnostic information that can help to determine the root cause or symptom of a potential bottleneck in multiple areas like:

Locking \ blocking issues CPU pressure Memory pressure Disk IO problems

In this post, I will walk you through the creation of a custom widget to display the top 5 wait stats from your system but firstyou must have Azure Data Studio installed on your computer already. So in case you don’t please make yourself a favor and download the macOS version on this link .

From now on, I will assume you have Azure Data Studio installed also a working connection to a SQL Server instance. All the Azure Data Studio widgets uses a query file as a source, in this case I created a short version of world-famous Paul Randal’s ( b | t ) script to determine the wait stats for a SQL Server instance, you can download the modified script here from my GitHub repository .

This short version will show only the top five wait types from your system, I also I removed the links from Paul’s version where he explains each ignored wait type just to make the code easier to read but I strongly recommend you to check Paul Randal’s blog post to learn more about.

Download the script and move it to a known location rather than your Downloads folder, this will make things easier while creating the widget. A folder location like /Users/MyUser/Documents/wait_stats.sql would work.

Open the script with Azure Data Studio and execute it, then go to the results window look at the top right corner of this section and click on the Chart icon:


Creating Wait stats widget on Azure Data Studio for macOS

Once the chart is displayed in the screen, look for the chart options from the right panel and make the following changes:

Chart Type = horizontalBar Data Direction = Vertical Legend Position = none X Axis Label = PERCENTAGE Y Axis Label = WAIT TYPE

As you may noticed at this point, a nice horizontal bar type char is displayed on your screen, but this is just halfway now let’s move ahead and get the widget created.Click on the Create Insight button at the top of the RESULTS \ CHART grid to generate the JSON code for this chart.

Azure Data Studio will open a new windows with some JSON code, probably you noticed the way it is showed in the screen is not that readable.Don’t you worry, we can address the format problem just select all the JSON code using the A (Command + A) shortcut then just run the Format document function of Azure Data Studio using the F (Shift + Alt + F) shortcut and voilà the code is now looking perfectly formatted:


Creating Wait stats widget on Azure Data Studio for macOS

Noticed that I have highlighted the name key, because the auto-generated code puts My-Widget as value by default in our case we want to call this widget something like Wait stats , also noticed the queryFile key value it points the location you saved the wait stats script at the beginning of this post.

Finally it’s time to add our custom Wait stats widget to Azure Data Studio, open the Azure Data Studio command palette using the P (Command + Shift + P) and then write Preferences you will see a list of options displayed as a list choose Preferences: Open User Settings from the list.

In the Search Settings text box write dashboard.server.widgets then click on dashboard.server.widgets and select the Edit option:


Creating Wait stats widget on Azure Data Studio for macOS

The left panel will turn yellow in Edit mode, now look for the last bracket from the last widget on the last panel in my case the all-database-size-server-insight . Carefully add a comma symbol after the last bracket,then copy the JSON code from the other window and paste it. It should look something like this:


Creating Wait stats widget on Azure Data Studio for macOS

Then simply save the changes to the user settings using the S (Command + S) shortcut, close all the open windows.Re-connect to one of your SQL Server instances, right click then choose manage it will display the server dashboard now just look for the widget we just created.


Creating Wait stats widget on Azure Data Studio for macOS

I hope you find this tip useful, in case you want to grab a copy of the SQL and JSON file used in this post you can find it here .

Stay tuned for more DBA mastery tips!

DBA Master

I’m very experienced multi platform Database Administrator (Oracle, SQL Server, mysql), working for large scale US based companies and some other companies around the world.

I have multiple Microsoft SQL Server certifications under my belt (MCP, MCTS, MCSA, MCSE), and currently taking the Microsoft Data Science program.

本文系统(windows)相关术语:三级网络技术 计算机三级网络技术 网络技术基础 计算机网络技术

tags: Data,Studio,Azure,stats,SQL,widget
分页:12
转载请注明
本文标题:Creating Wait stats widget on Azure Data Studio for macOS
本站链接:https://www.codesec.net/view/604303.html


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 系统(windows) | 评论(0) | 阅读(13)