Skip to content

Commit 292ef4f

Browse files
akshays-19akhileshsingh85
authored andcommitted
[receiver/sqlserver] Add access methods and buffer pool metrics (open-telemetry#49185)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description Adds 7 new opt-in metrics to the sqlserverreceiver covering Access Methods and Buffer Pool Extensions. These consolidate 14 separate performance counters into attribute-based OTLP metrics, following the receiver's existing consolidation pattern (e.g., sqlserver.page.operation with an attribute). All new metrics reuse the existing sys.dm_os_performance_counters query path — no new DMVs required. <!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes open-telemetry#49182 <!--Describe what testing was performed and which tests were added.--> #### Testing - Unit tests for all 7 new metrics - Integration tests against SQL Server instance - metadata.yaml updated with metric definitions - Documentation updated <!--Describe the documentation added.--> #### Documentation <!--Authorship attestation. See AGENTS.md for details. AI agents must not check this box on behalf of the user; the human author must check it themselves before the PR is ready for review.--> #### Authorship - [x] I, a human, wrote this pull request description myself. <!--Please delete paragraphs that you did not use before submitting.--> --------- Signed-off-by: akshasri <akshaysrivastava@splunk.com>
1 parent 7f3b964 commit 292ef4f

18 files changed

Lines changed: 2598 additions & 4 deletions
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: enhancement
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. receiver/filelog)
7+
component: receiver/sqlserver
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Add access methods and buffer pool metrics
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [49182]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext: |
19+
Adds the following metrics, all disabled by default:
20+
- `sqlserver.access.scan.rate`
21+
- `sqlserver.extent.operation.rate`
22+
- `sqlserver.ghost_record.skipped.rate`
23+
- `sqlserver.page.allocation.rate`
24+
- `sqlserver.page.compression.rate`
25+
- `sqlserver.page.read_ahead.rate`
26+
- `sqlserver.scan_point.revalidation.rate`
27+
- `sqlserver.worktable.cache.hit_ratio`
28+
29+
# If your change doesn't affect end users or the exported elements of any package,
30+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
31+
# Optional: The change log or logs in which this entry should be included.
32+
# e.g. '[user]' or '[user, api]'
33+
# Include 'user' if the change is relevant to end users.
34+
# Include 'api' if there is a change to a library API.
35+
# Default: '[user]'
36+
change_logs: [user]

receiver/sqlserverreceiver/documentation.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,22 @@ metrics:
220220
enabled: true
221221
```
222222
223+
### sqlserver.access.scan.rate
224+
225+
Rate of access method scans.
226+
227+
This metric is only available when the receiver is configured to directly connect to SQL Server.
228+
229+
| Unit | Metric Type | Value Type | Stability |
230+
| ---- | ----------- | ---------- | --------- |
231+
| {scan}/s | Gauge | Double | Development |
232+
233+
#### Attributes
234+
235+
| Name | Description | Values | Requirement Level | Semantic Convention |
236+
| ---- | ----------- | ------ | ----------------- | ------------------- |
237+
| sqlserver.access.scan.type | The type of access method scan being performed. | Str: ``free_space``, ``probe``, ``range`` | Required | - |
238+
223239
### sqlserver.attention.rate
224240
225241
Number of SQL attentions (client cancellation interrupts) received per second.
@@ -371,6 +387,32 @@ Total number of deadlocks.
371387
| ---- | ----------- | ---------- | --------- |
372388
| “{deadlocks}/s” | Gauge | Double | Development |
373389
390+
### sqlserver.extent.operation.rate
391+
392+
Rate of extent operations.
393+
394+
This metric is only available when the receiver is configured to directly connect to SQL Server.
395+
396+
| Unit | Metric Type | Value Type | Stability |
397+
| ---- | ----------- | ---------- | --------- |
398+
| {extent}/s | Gauge | Double | Development |
399+
400+
#### Attributes
401+
402+
| Name | Description | Values | Requirement Level | Semantic Convention |
403+
| ---- | ----------- | ------ | ----------------- | ------------------- |
404+
| sqlserver.extent.operation.type | The type of extent allocation operation. | Str: ``allocated``, ``deallocated`` | Required | - |
405+
406+
### sqlserver.ghost_record.skipped.rate
407+
408+
Rate of ghosted records skipped during scans.
409+
410+
This metric is only available when the receiver is configured to directly connect to SQL Server.
411+
412+
| Unit | Metric Type | Value Type | Stability |
413+
| ---- | ----------- | ---------- | --------- |
414+
| {record}/s | Gauge | Double | Development |
415+
374416
### sqlserver.index.search.rate
375417
376418
Total number of index searches.
@@ -550,6 +592,22 @@ This metric is only available when the receiver is configured to directly connec
550592
| wait.category | Category of the reason for a wait. | Any Str | Recommended | - |
551593
| wait.type | Type of the wait, view [WaitTypes documentation](https://learn.microsoft.com/en-us/sql/relational-databases/system-dynamic-management-views/sys-dm-os-wait-stats-transact-sql?view=sql-server-ver16#WaitTypes) for more information. | Any Str | Recommended | - |
552594
595+
### sqlserver.page.allocation.rate
596+
597+
Rate of page allocation operations.
598+
599+
This metric is only available when the receiver is configured to directly connect to SQL Server.
600+
601+
| Unit | Metric Type | Value Type | Stability |
602+
| ---- | ----------- | ---------- | --------- |
603+
| {page}/s | Gauge | Double | Development |
604+
605+
#### Attributes
606+
607+
| Name | Description | Values | Requirement Level | Semantic Convention |
608+
| ---- | ----------- | ------ | ----------------- | ------------------- |
609+
| sqlserver.page.allocation.type | The type of page allocation operation. | Str: ``allocated``, ``deallocated``, ``mixed`` | Required | - |
610+
553611
### sqlserver.page.buffer_cache.free_list.stalls.rate
554612
555613
Number of free list stalls.
@@ -558,6 +616,22 @@ Number of free list stalls.
558616
| ---- | ----------- | ---------- | --------- |
559617
| “{stalls}/s” | Gauge | Int | Development |
560618
619+
### sqlserver.page.compression.rate
620+
621+
Rate of page compression operations.
622+
623+
This metric is only available when the receiver is configured to directly connect to SQL Server.
624+
625+
| Unit | Metric Type | Value Type | Stability |
626+
| ---- | ----------- | ---------- | --------- |
627+
| {page}/s | Gauge | Double | Development |
628+
629+
#### Attributes
630+
631+
| Name | Description | Values | Requirement Level | Semantic Convention |
632+
| ---- | ----------- | ------ | ----------------- | ------------------- |
633+
| sqlserver.page.compression.type | The type of page compression operation. | Str: ``attempted``, ``succeeded`` | Required | - |
634+
561635
### sqlserver.page.lookup.rate
562636
563637
Total number of page lookups.
@@ -566,6 +640,16 @@ Total number of page lookups.
566640
| ---- | ----------- | ---------- | --------- |
567641
| “{lookups}/s” | Gauge | Double | Development |
568642
643+
### sqlserver.page.read_ahead.rate
644+
645+
Rate of pages read from disk by the read-ahead manager.
646+
647+
This metric is only available when the receiver is configured to directly connect to SQL Server.
648+
649+
| Unit | Metric Type | Value Type | Stability |
650+
| ---- | ----------- | ---------- | --------- |
651+
| {page}/s | Gauge | Double | Development |
652+
569653
### sqlserver.parameterization.rate
570654
571655
Rate of auto-parameterization activity, broken down by result.
@@ -662,6 +746,16 @@ This metric is only available when the receiver is configured to directly connec
662746
| ---- | ----------- | ---------- | --------- |
663747
| {writes}/s | Gauge | Double | Development |
664748
749+
### sqlserver.scan_point.revalidation.rate
750+
751+
Rate at which scan points needed to be revalidated.
752+
753+
This metric is only available when the receiver is configured to directly connect to SQL Server.
754+
755+
| Unit | Metric Type | Value Type | Stability |
756+
| ---- | ----------- | ---------- | --------- |
757+
| {revalidate}/s | Gauge | Double | Development |
758+
665759
### sqlserver.table.count
666760
667761
The number of tables.
@@ -693,6 +787,16 @@ Total number of mirror write transactions.
693787
| ---- | ----------- | ---------- | --------- |
694788
| “{transactions}/s” | Gauge | Double | Development |
695789
790+
### sqlserver.worktable.cache.hit_ratio
791+
792+
Fraction of worktables that did not require initialization because they were retrieved from the worktable cache.
793+
794+
This metric is only available when the receiver is configured to directly connect to SQL Server.
795+
796+
| Unit | Metric Type | Value Type | Stability |
797+
| ---- | ----------- | ---------- | --------- |
798+
| 1 | Gauge | Double | Development |
799+
696800
## Default Events
697801
698802
The following events are emitted by default. Each of them can be disabled by applying the following configuration:

receiver/sqlserverreceiver/factory.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,8 @@ func isPerfCounterQueryEnabled(metrics *metadata.MetricsConfig) bool {
259259
return false
260260
}
261261

262-
return metrics.SqlserverBatchRequestRate.Enabled ||
262+
return metrics.SqlserverAccessScanRate.Enabled ||
263+
metrics.SqlserverBatchRequestRate.Enabled ||
263264
metrics.SqlserverBatchSQLCompilationRate.Enabled ||
264265
metrics.SqlserverBatchSQLRecompilationRate.Enabled ||
265266
metrics.SqlserverDatabaseBackupOrRestoreRate.Enabled ||
@@ -268,6 +269,8 @@ func isPerfCounterQueryEnabled(metrics *metadata.MetricsConfig) bool {
268269
metrics.SqlserverDatabaseTempdbSpace.Enabled ||
269270
metrics.SqlserverDatabaseTempdbVersionStoreSize.Enabled ||
270271
metrics.SqlserverDeadlockRate.Enabled ||
272+
metrics.SqlserverExtentOperationRate.Enabled ||
273+
metrics.SqlserverGhostRecordSkippedRate.Enabled ||
271274
metrics.SqlserverIndexSearchRate.Enabled ||
272275
metrics.SqlserverLatchSuperlatchCount.Enabled ||
273276
metrics.SqlserverLatchSuperlatchTransitionRate.Enabled ||
@@ -284,22 +287,27 @@ func isPerfCounterQueryEnabled(metrics *metadata.MetricsConfig) bool {
284287
metrics.SqlserverMemoryGrantsPendingCount.Enabled ||
285288
metrics.SqlserverMemoryPageCount.Enabled ||
286289
metrics.SqlserverMemoryUsage.Enabled ||
290+
metrics.SqlserverPageAllocationRate.Enabled ||
287291
metrics.SqlserverPageBufferCacheFreeListStallsRate.Enabled ||
288292
metrics.SqlserverPageBufferCacheHitRatio.Enabled ||
293+
metrics.SqlserverPageCompressionRate.Enabled ||
289294
metrics.SqlserverPageLookupRate.Enabled ||
295+
metrics.SqlserverPageReadAheadRate.Enabled ||
290296
metrics.SqlserverProcessesBlocked.Enabled ||
291297
metrics.SqlserverReplicaDataRate.Enabled ||
292298
metrics.SqlserverResourcePoolDiskThrottledReadRate.Enabled ||
293299
metrics.SqlserverResourcePoolDiskOperations.Enabled ||
294300
metrics.SqlserverResourcePoolDiskThrottledWriteRate.Enabled ||
301+
metrics.SqlserverScanPointRevalidationRate.Enabled ||
295302
metrics.SqlserverAttentionRate.Enabled ||
296303
metrics.SqlserverParameterizationRate.Enabled ||
297304
metrics.SqlserverPlanExecutionRate.Enabled ||
298305
metrics.SqlserverRecompilationRatio.Enabled ||
299306
metrics.SqlserverTableCount.Enabled ||
300307
metrics.SqlserverTransactionDelay.Enabled ||
301308
metrics.SqlserverTransactionMirrorWriteRate.Enabled ||
302-
metrics.SqlserverUserConnectionCount.Enabled
309+
metrics.SqlserverUserConnectionCount.Enabled ||
310+
metrics.SqlserverWorktableCacheHitRatio.Enabled
303311
}
304312

305313
func isWaitStatsQueryEnabled(metrics *metadata.MetricsConfig) bool {

receiver/sqlserverreceiver/factory_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ func TestSetupQueries(t *testing.T) {
262262

263263
metricsMetadata, ok := metadata["metrics"].(map[string]any)
264264
require.True(t, ok)
265-
require.Len(t, metricsMetadata, 62, "Every time metrics are added or removed, the function `setupQueries` must "+
265+
require.Len(t, metricsMetadata, 70, "Every time metrics are added or removed, the function `setupQueries` must "+
266266
"be modified to properly account for the change. Please update `setupQueries` and then, "+
267267
"and only then, update the expected metric count here.")
268268
}

0 commit comments

Comments
 (0)