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
[receiver/sqlserver] Add more metrics #32932
[receiver/sqlserver] Add more metrics #32932
Conversation
AND pc1.[counter_name] LIKE '%base' | ||
WHERE | ||
pc.[counter_name] NOT LIKE '% base' | ||
{filter_instance_name} |
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.
This allows us to filter based on instance name, replacing the {filter_instance_name}
. I would have liked to have this indented with the above statement, but this breaks tests directly comparing the contents of two queries when loading the expected query from a file. The file would need to have a blank line with a tab, which my editor automatically deletes, and would look bad on GitHub.
@@ -0,0 +1,165 @@ | |||
|
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.
Empty newline is due to formatting of query in go.
scrapers := setupSQLServerScrapers(receivertest.NewNopCreateSettings(), cfg) | ||
assert.NotNil(t, scrapers) | ||
|
||
for _, scraper := range scrapers { | ||
err := scraper.Start(context.Background(), componenttest.NewNopHost()) | ||
assert.NoError(t, err) | ||
defer func() { assert.NoError(t, scraper.Shutdown(context.Background())) }() |
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.
The anonymous func()
has to be removed here, as with it, scraper.Shutdown
is called twice on the second of two scrapers, and not called on the first scraper. (This is how defer works with anonymous funcs by definition, we just need to use them properly for the updated use case.)
Failing test is frequency of #32715, I've added a reference there. |
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.
lgtm
**Description:** This change adds a query, scraper, and some more metrics for data from the performance counter SQL server table. The query itself is mostly taken from Telegraf's SQL server plugin. This also reuses the existing metric `sqlserver.lock.wait.rate`, so now it will be available both from Windows performance counters, as well as other OSs when directly connecting to the SQL server instance. **Naming and format feedback on new metrics would be greatly appreciated.** **Link to tracking Issue:** open-telemetry#29865 **Testing:** Added tests for the query itself, as well as the new scraper. Co-authored-by: Daniel Jaglowski <jaglows3@gmail.com>
…etric (#33023) **Description:** <Describe what has changed.> <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> As a result of #32932 the metric `sqlserver.lock.wait.rate` is now available on Windows, or when directly connecting to a SQL server instance. Since this metric is always available, it no longer needs extended documentation about availability.
Description:
This change adds a query, scraper, and some more metrics for data from the performance counter SQL server table. The query itself is mostly taken from Telegraf's SQL server plugin. This also reuses the existing metric
sqlserver.lock.wait.rate
, so now it will be available both from Windows performance counters, as well as other OSs when directly connecting to the SQL server instance.Naming and format feedback on new metrics would be greatly appreciated.
Link to tracking Issue:
#29865
Testing:
Added tests for the query itself, as well as the new scraper.