Skip to content

Commit 7fcdf3f

Browse files
committed
[receiver/sqlserver] Enable sqlserver.page.life_expectance metric
1 parent a0044fb commit 7fcdf3f

File tree

7 files changed

+321
-236
lines changed

7 files changed

+321
-236
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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. filelogreceiver)
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: Enable `sqlserver.page.life_expectancy` metric for all configurations
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: []
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+
This metric was originally only available when running on Windows, but is
20+
now available for all configuration options, including direct connection.
21+
Since this metric is enabled by default, users who have direct connection
22+
configured will now have this metric emitted by default.
23+
24+
# If your change doesn't affect end users or the exported elements of any package,
25+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
26+
# Optional: The change log or logs in which this entry should be included.
27+
# e.g. '[user]' or '[user, api]'
28+
# Include 'user' if the change is relevant to end users.
29+
# Include 'api' if there is a change to a library API.
30+
# Default: '[user]'
31+
change_logs: []

receiver/sqlserverreceiver/documentation.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ This metric is only available when running on Windows.
8686
8787
Time a page will stay in the buffer pool.
8888
89-
This metric is only available when running on Windows.
90-
9189
| Unit | Metric Type | Value Type |
9290
| ---- | ----------- | ---------- |
9391
| s | Gauge | Int |

receiver/sqlserverreceiver/metadata.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ metrics:
122122
unit: s
123123
gauge:
124124
value_type: int
125-
extended_documentation: This metric is only available when running on Windows.
126125
sqlserver.page.split.rate:
127126
enabled: true
128127
description: Number of pages split as a result of overflowing index pages.

receiver/sqlserverreceiver/scraper.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ func (s *sqlServerScraperHelper) recordDatabasePerfCounterMetrics(ctx context.Co
224224
const numberOfDeadlocksPerSec = "Number of Deadlocks/sec"
225225
const mirrorWritesTransactionPerSec = "Mirrored Write Transactions/sec"
226226
const memoryGrantsPending = "Memory Grants Pending"
227+
const pageLifeExpectancy = "Page life expectancy"
227228
const pageLookupsPerSec = "Page lookups/sec"
228229
const processesBlocked = "Processes blocked"
229230
const sqlCompilationRate = "SQL Compilations/sec"
@@ -400,6 +401,14 @@ func (s *sqlServerScraperHelper) recordDatabasePerfCounterMetrics(ctx context.Co
400401
} else {
401402
s.mb.RecordSqlserverDeadlockRateDataPoint(now, val.(float64))
402403
}
404+
case pageLifeExpectancy:
405+
val, err := retrieveInt(row, valueKey)
406+
if err != nil {
407+
err = fmt.Errorf("failed to parse valueKey for row %d: %w in %s", i, err, pageLifeExpectancy)
408+
errs = append(errs, err)
409+
} else {
410+
s.mb.RecordSqlserverPageLifeExpectancyDataPoint(now, val.(int64))
411+
}
403412
case pageLookupsPerSec:
404413
val, err := retrieveFloat(row, valueKey)
405414
if err != nil {

0 commit comments

Comments
 (0)