Skip to content
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

Adding/fixing support for Azure SQL Database (singleton database) #6111

Merged
merged 8 commits into from
Jul 12, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fmt changes
  • Loading branch information
Ubuntu committed Jul 11, 2019
commit 9a02c818bae56549be901197819442e5821140ae
8 changes: 3 additions & 5 deletions plugins/inputs/sqlserver/sqlserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func initQueries(s *SQLServer) {
// If this is an AzureDB instance, grab some extra metrics
if s.AzureDB {
queries["AzureDBResourceStats"] = Query{Script: sqlAzureDBResourceStats, ResultByRow: false}
queries["AzureDBResourceGovernance"] = Query{Script: sqlAzureDBResourceGovernance, ResultByRow: false}
queries["AzureDBResourceGovernance"] = Query{Script: sqlAzureDBResourceGovernance, ResultByRow: false}
}

// Decide if we want to run version 1 or version 2 queries
Expand All @@ -103,7 +103,7 @@ func initQueries(s *SQLServer) {
queries["ServerProperties"] = Query{Script: sqlServerPropertiesV2, ResultByRow: false}
queries["MemoryClerk"] = Query{Script: sqlMemoryClerkV2, ResultByRow: false}
queries["Schedulers"] = Query{Script: sqlServerSchedulersV2, ResultByRow: false}
} else{
} else {
queries["PerformanceCounters"] = Query{Script: sqlPerformanceCounters, ResultByRow: true}
queries["WaitStatsCategorized"] = Query{Script: sqlWaitStatsCategorized, ResultByRow: false}
queries["CPUHistory"] = Query{Script: sqlCPUHistory, ResultByRow: false}
Expand Down Expand Up @@ -493,7 +493,6 @@ SELECT 'sqlserver_schedulers' AS [measurement],
from sys.dm_os_schedulers
`


const sqlPerformanceCountersV2 string = `SET DEADLOCK_PRIORITY -10;
DECLARE @PCounters TABLE
(
Expand Down Expand Up @@ -1297,7 +1296,7 @@ BEGIN
END`

//Only executed if AzureDB Flag is set
const sqlAzureDBResourceGovernance string = `
const sqlAzureDBResourceGovernance string = `
IF SERVERPROPERTY('EngineEdition') = 5 -- Is this Azure SQL DB?
SELECT
'dm_user_db_resource_governance' AS [measurement],
Expand Down Expand Up @@ -1360,7 +1359,6 @@ ELSE
END;
`


// Queries V1
const sqlPerformanceMetrics string = `SET DEADLOCK_PRIORITY -10;
SET NOCOUNT ON;
Expand Down