-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[receiver/sqlserver] Add new metric: lock wait count #39930
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
base: main
Are you sure you want to change the base?
[receiver/sqlserver] Add new metric: lock wait count #39930
Conversation
sqlserver.lock.wait.count: | ||
enabled: false | ||
description: Cumulative count of lock waits that occurred. | ||
unit: "{waits}" |
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.
I'd appreciate feedback on what the unit should be here, if anyone has any thoughts.
( | ||
SELECT | ||
rgwg.name AS instance | ||
,rgwg.total_request_count AS [Request Count] |
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.
Including extra selects here in case we want to add these metrics in the future.
@@ -352,6 +353,14 @@ func (s *sqlServerScraperHelper) recordDatabasePerfCounterMetrics(ctx context.Co | |||
} else { | |||
s.mb.RecordSqlserverLockTimeoutRateDataPoint(now, val) | |||
} | |||
case lockWaitCount: | |||
val, err := retrieveInt(row, valueKey) |
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.
retrieveInt
is called here instead of strconv.ParseInt
to conform to new functionality introduced in #39905 (which hasn't been merged yet).
@@ -32,45 +32,49 @@ func configureAllScraperMetrics(cfg *Config, enabled bool) { | |||
cfg.Metrics.SqlserverBatchRequestRate.Enabled = enabled | |||
cfg.Metrics.SqlserverBatchSQLCompilationRate.Enabled = enabled | |||
cfg.Metrics.SqlserverBatchSQLRecompilationRate.Enabled = enabled | |||
|
|||
cfg.Metrics.SqlserverDatabaseBackupOrRestoreRate.Enabled = enabled |
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 changes to this method aren't entirely relevant to this PR, my apologies. I noticed not all metrics were being included in this method so I used it as an opportunity to add all metrics to this list and alphabetize them.
To validate this is the full list, refer to the generated list of metrics.
1d5b494
to
86b9866
Compare
Description
Adds a new metric
sqlserver.lock.wait.count
to represent the total number of lock waits. This required adding a new metric tometadata.yaml
, updating the existing SQL Server perf counter query, and updating tests.Link to tracking issue
Fixes #39892
Testing
Updated tests for new metric, all are passing.
Also, tested to ensure the
instance_name
configuration option still works (only metrics for the specified instance name are returned.) I tested with it set to the right value and unset, returning the same results (only one instance in my test environment,) and then also tested with the wrong value and saw no metrics were returned. This has to be done manually at this point as we don't have integration tests with a real SQL Server instance. The existing tests rely on saved query data, and aren't required to be updated with changes to the receiver.Documentation
Added note in
metadata.yaml
describing new metric.