Skip to content
Merged
36 changes: 36 additions & 0 deletions .chloggen/sqlserverreceiver-access-methods-and-buffer-pool.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. receiver/filelog)
component: receiver/sqlserver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Add access methods and buffer pool metrics

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [49182]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext: |
Adds the following metrics, all disabled by default:
Comment thread
akshays-19 marked this conversation as resolved.
- `sqlserver.access.scan.rate`
- `sqlserver.extent.operation.rate`
- `sqlserver.ghost_record.skipped.rate`
- `sqlserver.page.allocation.rate`
- `sqlserver.page.compression.rate`
- `sqlserver.page.read_ahead.rate`
- `sqlserver.scan_point.revalidation.rate`
- `sqlserver.worktable.cache.hit_ratio`

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [user]
104 changes: 104 additions & 0 deletions receiver/sqlserverreceiver/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,22 @@ metrics:
enabled: true
```

### sqlserver.access.scan.rate

Rate of access method scans.

This metric is only available when the receiver is configured to directly connect to SQL Server.

| Unit | Metric Type | Value Type | Stability |
| ---- | ----------- | ---------- | --------- |
| {scan}/s | Gauge | Double | Development |

#### Attributes

| Name | Description | Values | Requirement Level | Semantic Convention |
| ---- | ----------- | ------ | ----------------- | ------------------- |
| sqlserver.access.scan.type | The type of access method scan being performed. | Str: ``free_space``, ``probe``, ``range`` | Required | - |

### sqlserver.attention.rate

Number of SQL attentions (client cancellation interrupts) received per second.
Expand Down Expand Up @@ -371,6 +387,32 @@ Total number of deadlocks.
| ---- | ----------- | ---------- | --------- |
| “{deadlocks}/s” | Gauge | Double | Development |

### sqlserver.extent.operation.rate

Rate of extent operations.

This metric is only available when the receiver is configured to directly connect to SQL Server.

| Unit | Metric Type | Value Type | Stability |
| ---- | ----------- | ---------- | --------- |
| {extent}/s | Gauge | Double | Development |

#### Attributes

| Name | Description | Values | Requirement Level | Semantic Convention |
| ---- | ----------- | ------ | ----------------- | ------------------- |
| sqlserver.extent.operation.type | The type of extent allocation operation. | Str: ``allocated``, ``deallocated`` | Required | - |

### sqlserver.ghost_record.skipped.rate

Rate of ghosted records skipped during scans.

This metric is only available when the receiver is configured to directly connect to SQL Server.

| Unit | Metric Type | Value Type | Stability |
| ---- | ----------- | ---------- | --------- |
| {record}/s | Gauge | Double | Development |

### sqlserver.index.search.rate

Total number of index searches.
Expand Down Expand Up @@ -550,6 +592,22 @@ This metric is only available when the receiver is configured to directly connec
| wait.category | Category of the reason for a wait. | Any Str | Recommended | - |
| 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 | - |

### sqlserver.page.allocation.rate

Rate of page allocation operations.

This metric is only available when the receiver is configured to directly connect to SQL Server.

| Unit | Metric Type | Value Type | Stability |
| ---- | ----------- | ---------- | --------- |
| {page}/s | Gauge | Double | Development |

#### Attributes

| Name | Description | Values | Requirement Level | Semantic Convention |
| ---- | ----------- | ------ | ----------------- | ------------------- |
| sqlserver.page.allocation.type | The type of page allocation operation. | Str: ``allocated``, ``deallocated``, ``mixed`` | Required | - |

### sqlserver.page.buffer_cache.free_list.stalls.rate

Number of free list stalls.
Expand All @@ -558,6 +616,22 @@ Number of free list stalls.
| ---- | ----------- | ---------- | --------- |
| “{stalls}/s” | Gauge | Int | Development |

### sqlserver.page.compression.rate

Rate of page compression operations.

This metric is only available when the receiver is configured to directly connect to SQL Server.

| Unit | Metric Type | Value Type | Stability |
| ---- | ----------- | ---------- | --------- |
| {page}/s | Gauge | Double | Development |

#### Attributes

| Name | Description | Values | Requirement Level | Semantic Convention |
| ---- | ----------- | ------ | ----------------- | ------------------- |
| sqlserver.page.compression.type | The type of page compression operation. | Str: ``attempted``, ``succeeded`` | Required | - |

### sqlserver.page.lookup.rate

Total number of page lookups.
Expand All @@ -566,6 +640,16 @@ Total number of page lookups.
| ---- | ----------- | ---------- | --------- |
| “{lookups}/s” | Gauge | Double | Development |

### sqlserver.page.read_ahead.rate

Rate of pages read from disk by the read-ahead manager.

This metric is only available when the receiver is configured to directly connect to SQL Server.

| Unit | Metric Type | Value Type | Stability |
| ---- | ----------- | ---------- | --------- |
| {page}/s | Gauge | Double | Development |

### sqlserver.parameterization.rate

Rate of auto-parameterization activity, broken down by result.
Expand Down Expand Up @@ -662,6 +746,16 @@ This metric is only available when the receiver is configured to directly connec
| ---- | ----------- | ---------- | --------- |
| {writes}/s | Gauge | Double | Development |

### sqlserver.scan_point.revalidation.rate

Rate at which scan points needed to be revalidated.

This metric is only available when the receiver is configured to directly connect to SQL Server.

| Unit | Metric Type | Value Type | Stability |
| ---- | ----------- | ---------- | --------- |
| {revalidate}/s | Gauge | Double | Development |

### sqlserver.table.count

The number of tables.
Expand Down Expand Up @@ -693,6 +787,16 @@ Total number of mirror write transactions.
| ---- | ----------- | ---------- | --------- |
| “{transactions}/s” | Gauge | Double | Development |

### sqlserver.worktable.cache.hit_ratio

Fraction of worktables that did not require initialization because they were retrieved from the worktable cache.

This metric is only available when the receiver is configured to directly connect to SQL Server.

| Unit | Metric Type | Value Type | Stability |
| ---- | ----------- | ---------- | --------- |
| 1 | Gauge | Double | Development |

## Default Events

The following events are emitted by default. Each of them can be disabled by applying the following configuration:
Expand Down
12 changes: 10 additions & 2 deletions receiver/sqlserverreceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,8 @@ func isPerfCounterQueryEnabled(metrics *metadata.MetricsConfig) bool {
return false
}

return metrics.SqlserverBatchRequestRate.Enabled ||
return metrics.SqlserverAccessScanRate.Enabled ||
metrics.SqlserverBatchRequestRate.Enabled ||
metrics.SqlserverBatchSQLCompilationRate.Enabled ||
metrics.SqlserverBatchSQLRecompilationRate.Enabled ||
metrics.SqlserverDatabaseBackupOrRestoreRate.Enabled ||
Expand All @@ -268,6 +269,8 @@ func isPerfCounterQueryEnabled(metrics *metadata.MetricsConfig) bool {
metrics.SqlserverDatabaseTempdbSpace.Enabled ||
metrics.SqlserverDatabaseTempdbVersionStoreSize.Enabled ||
metrics.SqlserverDeadlockRate.Enabled ||
metrics.SqlserverExtentOperationRate.Enabled ||
metrics.SqlserverGhostRecordSkippedRate.Enabled ||
metrics.SqlserverIndexSearchRate.Enabled ||
metrics.SqlserverLatchSuperlatchCount.Enabled ||
metrics.SqlserverLatchSuperlatchTransitionRate.Enabled ||
Expand All @@ -284,22 +287,27 @@ func isPerfCounterQueryEnabled(metrics *metadata.MetricsConfig) bool {
metrics.SqlserverMemoryGrantsPendingCount.Enabled ||
metrics.SqlserverMemoryPageCount.Enabled ||
metrics.SqlserverMemoryUsage.Enabled ||
metrics.SqlserverPageAllocationRate.Enabled ||
metrics.SqlserverPageBufferCacheFreeListStallsRate.Enabled ||
metrics.SqlserverPageBufferCacheHitRatio.Enabled ||
metrics.SqlserverPageCompressionRate.Enabled ||
metrics.SqlserverPageLookupRate.Enabled ||
metrics.SqlserverPageReadAheadRate.Enabled ||
metrics.SqlserverProcessesBlocked.Enabled ||
metrics.SqlserverReplicaDataRate.Enabled ||
metrics.SqlserverResourcePoolDiskThrottledReadRate.Enabled ||
metrics.SqlserverResourcePoolDiskOperations.Enabled ||
metrics.SqlserverResourcePoolDiskThrottledWriteRate.Enabled ||
metrics.SqlserverScanPointRevalidationRate.Enabled ||
metrics.SqlserverAttentionRate.Enabled ||
metrics.SqlserverParameterizationRate.Enabled ||
metrics.SqlserverPlanExecutionRate.Enabled ||
metrics.SqlserverRecompilationRatio.Enabled ||
metrics.SqlserverTableCount.Enabled ||
metrics.SqlserverTransactionDelay.Enabled ||
metrics.SqlserverTransactionMirrorWriteRate.Enabled ||
metrics.SqlserverUserConnectionCount.Enabled
metrics.SqlserverUserConnectionCount.Enabled ||
metrics.SqlserverWorktableCacheHitRatio.Enabled
}

func isWaitStatsQueryEnabled(metrics *metadata.MetricsConfig) bool {
Expand Down
2 changes: 1 addition & 1 deletion receiver/sqlserverreceiver/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ func TestSetupQueries(t *testing.T) {

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