Skip to content

New sql server queries (Azure) - refactoring and formatting#8186

Merged
ssoroka merged 26 commits intoinfluxdata:masterfrom
Trovalo:SqlServer_Azure_queries_formatting
Oct 7, 2020
Merged

New sql server queries (Azure) - refactoring and formatting#8186
ssoroka merged 26 commits intoinfluxdata:masterfrom
Trovalo:SqlServer_Azure_queries_formatting

Conversation

@Trovalo
Copy link
Copy Markdown
Contributor

@Trovalo Trovalo commented Sep 28, 2020

Required for all PRs:

  • Signed CLA.
  • Associated README.md updated.
  • Has appropriate unit tests.

I've done some formatting also for the Azure queries part.
There are no breaking changes, but a pair of edits to align some queries with the on-prem ones.

  • sqlAzureMIRequests --> added [session_db_name]
  • sqlAzureMIRequests and sqlAzureDBRequests --> added COLASCE for [open_transaction]

Some testing, especially for the Managed instance section is needed (I have an Azure SQL DB but no Managed Instance)
@denzilribeiro

@reimda
Copy link
Copy Markdown
Contributor

reimda commented Sep 28, 2020

It would be better to put formatting style and behavior changes in separate PRs. The code behavior changes are important for a reviewer to check but putting them in with formatting/style changes make reviewing like finding a needle in a haystack.

@denzilribeiro Can you review this?

@Trovalo
Copy link
Copy Markdown
Contributor Author

Trovalo commented Sep 28, 2020

It would be better to put formatting style and behavior changes in separate PRs. The code behavior changes are important for a reviewer to check but putting them in with formatting/style changes make reviewing like finding a needle in a haystack.

@denzilribeiro Can you review this?

I'm aware of that, but those are just small things that got lost in the big PR of splitting the different sections of the plugin.
For actual structural changes I'll make different PRs

Copy link
Copy Markdown
Contributor

@denzilribeiro denzilribeiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made 2 comments that are accross the board
a. Do we need deadlock priority? These are DMVs not updatable really
b. Error message change to include DB_Name as well as just a logical server on Azure DB in connection string won't help identify what connection string is in the wrong section

Ex:
DECLARE @errorMessage AS nvarchar(500) = 'Telegraf - Connection string Server:"'+ @@ServerName + ',Database:' + DB_NAME() +'" is not an Azure Managed Instance. Check the database_type parameter in the telegraf configuration.';

ORDER BY
end_time DESC
const sqlAzureDBResourceStats string = `
SET DEADLOCK_PRIORITY -10;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the nead for Deadlock_priority - given DMVs they are memory locations not updatable. I had removed many of them :)... do you see any explicit need for them?

Copy link
Copy Markdown
Contributor Author

@Trovalo Trovalo Sep 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my bad, I placed it everywhere when I added the check on the engine edition (I mad the code block once and then pasted/replaced it everywhere)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a look at this, DEADLOCK_PRIORITY was present in 11 queries out of 17 for the Azure part and in 9 out of 9 for the on-prem.
I'll remove it in case queries use only dmv

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed some DEADLOCK_PRIORITY (where only dmv were referenced), it is now used only in DatabaseIO and PerfCounters queries (both azure DB and MI)

Copy link
Copy Markdown
Contributor

@denzilribeiro denzilribeiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@Trovalo
Copy link
Copy Markdown
Contributor Author

Trovalo commented Oct 7, 2020

@ssoroka can you merge this?

@ssoroka ssoroka merged commit d840448 into influxdata:master Oct 7, 2020
@Trovalo Trovalo deleted the SqlServer_Azure_queries_formatting branch October 8, 2020 08:52
arstercz pushed a commit to arstercz/telegraf that referenced this pull request Mar 5, 2023
…ta#8186)

* sqlAzureDBResourceStats - formatting & engine check
* sqlAzureDBResourceGovernance - formatting & engine check
* sqlAzureDBWaitStats - formatting and engine check
* sqlAzureDBDatabaseIO - formatting and engine check
* sqlAzureDBProperties - formatting and engine check
* sqlAzureDBProperties - fix [engine_edition]
* sqlAzureDBOsWaitStats - formatting and engine check
* sqlAzureDBOsWaitStats - fix DBMIRROR_QUEUE string
* sqlAzureDBMemoryClerks  - formatting and engine check
* sqlAzureDBRequests - formatting and engine check
* sqlAzureDBSchedulers - moved near other queries
* sqlAzureMIRequests - added [session_db_name]
* sqlAzureDBPerformanceCounters - formatting and engine check
* sqlAzureMIProperties - formatting and engine check
* sqlAzureMIResourceStats - formatting and engine check
* sqlAzureMIResourceGovernance - formatting and engine check
* sqlAzureMIDatabaseIO - formatting and engine check
* sqlAzureMIMemoryClerks - formatting and engine check
* sqlAzureMIOsWaitStats - formatting and engine check
* sqlAzureDBPerformanceCounters - fix check edition
* sqlAzureMIPerformanceCounters - formatting and engine check
* sqlAzureMIRequests - formatting and engine check
* sqlAzureMISchedulers - engine check
* Changed error msg to include DB_NAME
* removed DEADLOCK_PRIORITY from most queries
* sqlAzureDBSchedulers - added engineedition check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants