-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sql server - ring buffer cpu v2 #7359
Sql server - ring buffer cpu v2 #7359
Conversation
@denzilribeiro I would like to hear your opinion about it, especially for making it compatible with Azure SQL DB and Managed Instance. (I have a SQL DB, but not a Managed Instance). |
I would not use this for the cloud - there are better mechanisms. Even for VM's the better approach is to collect OS level metrics right? For managed instance need to add sys.resource_stats, for SQL DB sys.dm_db_resource_stats is already being collected. I need to spend some time to make couple changes in this area add this as well. |
I know that getting the data directly from the VM OS is probably the best option, but if you are monitoring a remote instance of SQL Server, it is not possible to use the windows plugin to gather data. In this kind of scenario, the ring buffer data are a good alternative. Also I'm not sure about what the windows plugin can get "out of the box", can it get Cpu data at process level? (I will check it myself) |
Note you can also get CPU from perfmon ( workload group counters have CPU) but won't get instance level CPU from there. At some point have to make sure we are not spawning too many connections for collection :) the balance. |
I already get the "CPU %" from the perfcounters measurement (in Resource Pool and Workload Groups), but sadly the Resource governor is available only in Enterprise and developer edition. Therefore, as of now, if you have a Standard or Express edition of SQL Server you can't get Cpu data using the SQL server plugin alone. I also thought about adding this as a row in the perfcounters measurement, something like Counter = "CPU %", Instance = "_Total". But I didn't like that since it is not an actual perfcounter. |
In general, I think that the SQL Server plugin alone should allow you to fully monitor your SQL Server instances, in this specific case the CPU. That said, I agree with you about keeping the plugin as light as possible. i.e. if the 'Cpu' query is used on Azure SQL DB or Managed instance we can execute
This might be a somehow breaking change, but it will ensure that people keep their config clean. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have the IF loop simplified? Don't have to cast here as evaluation loop only within SQL.
IF SERVERPROPERTY('EngineEdition') IN (5,8)
...
else
...
Agree on having only targeted queries for the platform in question.When I find time will find a way to actually segregate sections, had a discussion with Daniel as well.. will write up a note before I do that. Effectively can have 3 sections in conf one for each platform ( SQL Server, Azure SQL DB, Azure SQL Managed instance) and a bit different flag rather than just AzureDB = true or false... Will work on that hopefully soon. |
There is no problem in simplifying the loop by removing the variable declaration, cast and assignment. It will work as long as the comparison is "IN" or "=", but it won't if we use ">" or "<" (in this case no problem). I did that to match and somehow standardize some changes I have in another open PR about compatibility up to SQL Server 2008 SP4, in which I used the variables to avoid repeating the SERVERPROPERTY(...) and CAST(...) combo. About the segregation of the different platforms, I will also think about some nice ways to achieve it and then share it with you. |
I've updated the readme, now everything should be ok. @denzilribeiro can you check? |
Hi @denzilribeiro, any update on this? |
Required for all PRs:
Closes #7269
This PR adds a new measurement called "sqlserver_cpu" with the following structure:
It reads the CPU data from the ring buffer, therefore it allows to get CPU data from any version of SQL Server (including express and standard).
In the source, the data are updated once every minute.
As of now, it works only on the On-prem version of SQL Server (from SQL 2008 to 2019) but I'm looking to make it work also on Azure SQL DB and managed Instance. (maybe using sys.dm_db_resource_stats or sys.server_resource_stats)