Skip to content

Commit

Permalink
Change some sqlserver receiver metric types from double to int. (#9691)
Browse files Browse the repository at this point in the history
Change the following metrics from double type to int:
sqlserver.transaction_log.usage
sqlserver.transaction_log.shrink.count
sqlserver.transaction_log.growth.count
sqlserver.page.life_expectancy
sqlserver.user.connection.count
  • Loading branch information
StefanKurek authored May 3, 2022
1 parent 7aea72b commit 4ee1594
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 30 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
- `azuremonitorexporter`: Fix log exporter bug related to incorrectly mapping SpanId (#9579)
- `mysqlreceiver`: Fix attribute values mismatch with its definition (#9688)
- `opencensusreceiver`: Do not report fatal error if err is server closed (#9559).
- `sqlserverreceiver`: Fix the receiver to have integer types on metrics where applicable (#9601)

## v0.50.0

Expand Down
10 changes: 5 additions & 5 deletions receiver/sqlserverreceiver/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ These are the metrics available for this scraper.
| **sqlserver.page.buffer_cache.hit_ratio** | Pages found in the buffer pool without having to read from disk. | % | Gauge(Double) | <ul> </ul> |
| **sqlserver.page.checkpoint.flush.rate** | Number of pages flushed by operations requiring dirty pages to be flushed. | {pages}/s | Gauge(Double) | <ul> </ul> |
| **sqlserver.page.lazy_write.rate** | Number of lazy writes moving dirty pages to disk. | {writes}/s | Gauge(Double) | <ul> </ul> |
| **sqlserver.page.life_expectancy** | Time a page will stay in the buffer pool. | s | Gauge(Double) | <ul> </ul> |
| **sqlserver.page.life_expectancy** | Time a page will stay in the buffer pool. | s | Gauge(Int) | <ul> </ul> |
| **sqlserver.page.operation.rate** | Number of physical database page operations issued. | {operations}/s | Gauge(Double) | <ul> <li>page.operations</li> </ul> |
| **sqlserver.page.split.rate** | Number of pages split as a result of overflowing index pages. | {pages}/s | Gauge(Double) | <ul> </ul> |
| **sqlserver.transaction.rate** | Number of transactions started for the database (not including XTP-only transactions). | {transactions}/s | Gauge(Double) | <ul> </ul> |
| **sqlserver.transaction.write.rate** | Number of transactions that wrote to the database and committed. | {transactions}/s | Gauge(Double) | <ul> </ul> |
| **sqlserver.transaction_log.flush.data.rate** | Total number of log bytes flushed. | By/s | Gauge(Double) | <ul> </ul> |
| **sqlserver.transaction_log.flush.rate** | Number of log flushes. | {flushes}/s | Gauge(Double) | <ul> </ul> |
| **sqlserver.transaction_log.flush.wait.rate** | Number of commits waiting for a transaction log flush. | {commits}/s | Gauge(Double) | <ul> </ul> |
| **sqlserver.transaction_log.growth.count** | Total number of transaction log expansions for a database. | {growths} | Sum(Double) | <ul> </ul> |
| **sqlserver.transaction_log.shrink.count** | Total number of transaction log shrinks for a database. | {shrinks} | Sum(Double) | <ul> </ul> |
| **sqlserver.transaction_log.usage** | Percent of transaction log space used. | % | Gauge(Double) | <ul> </ul> |
| **sqlserver.user.connection.count** | Number of users connected to the SQL Server. | {connections} | Gauge(Double) | <ul> </ul> |
| **sqlserver.transaction_log.growth.count** | Total number of transaction log expansions for a database. | {growths} | Sum(Int) | <ul> </ul> |
| **sqlserver.transaction_log.shrink.count** | Total number of transaction log shrinks for a database. | {shrinks} | Sum(Int) | <ul> </ul> |
| **sqlserver.transaction_log.usage** | Percent of transaction log space used. | % | Gauge(Int) | <ul> </ul> |
| **sqlserver.user.connection.count** | Number of users connected to the SQL Server. | {connections} | Gauge(Int) | <ul> </ul> |

**Highlighted metrics** are emitted by default. Other metrics are optional and not emitted by default.
Any metric can be enabled or disabled with the following scraper configuration:
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
func (mb *MetricsBuilder) RecordAnyDataPoint(ts pcommon.Timestamp, val float64, name string, attributes map[string]string) {
switch name {
case "sqlserver.user.connection.count":
mb.RecordSqlserverUserConnectionCountDataPoint(ts, val)
mb.RecordSqlserverUserConnectionCountDataPoint(ts, int64(val))
case "sqlserver.batch.request.rate":
mb.RecordSqlserverBatchRequestRateDataPoint(ts, val)
case "sqlserver.batch.sql_compilation.rate":
Expand All @@ -39,7 +39,7 @@ func (mb *MetricsBuilder) RecordAnyDataPoint(ts pcommon.Timestamp, val float64,
case "sqlserver.page.lazy_write.rate":
mb.RecordSqlserverPageLazyWriteRateDataPoint(ts, val)
case "sqlserver.page.life_expectancy":
mb.RecordSqlserverPageLifeExpectancyDataPoint(ts, val)
mb.RecordSqlserverPageLifeExpectancyDataPoint(ts, int64(val))
case "sqlserver.page.operation.rate":
mb.RecordSqlserverPageOperationRateDataPoint(ts, val, attributes["type"])
case "sqlserver.page.split.rate":
Expand All @@ -51,11 +51,11 @@ func (mb *MetricsBuilder) RecordAnyDataPoint(ts pcommon.Timestamp, val float64,
case "sqlserver.transaction_log.flush.wait.rate":
mb.RecordSqlserverTransactionLogFlushWaitRateDataPoint(ts, val)
case "sqlserver.transaction_log.growth.count":
mb.RecordSqlserverTransactionLogGrowthCountDataPoint(ts, val)
mb.RecordSqlserverTransactionLogGrowthCountDataPoint(ts, int64(val))
case "sqlserver.transaction_log.shrink.count":
mb.RecordSqlserverTransactionLogShrinkCountDataPoint(ts, val)
mb.RecordSqlserverTransactionLogShrinkCountDataPoint(ts, int64(val))
case "sqlserver.transaction_log.usage":
mb.RecordSqlserverTransactionLogUsageDataPoint(ts, val)
mb.RecordSqlserverTransactionLogUsageDataPoint(ts, int64(val))
case "sqlserver.transaction.rate":
mb.RecordSqlserverTransactionRateDataPoint(ts, val)
case "sqlserver.transaction.write.rate":
Expand Down
10 changes: 5 additions & 5 deletions receiver/sqlserverreceiver/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ metrics:
description: Number of users connected to the SQL Server.
unit: "{connections}"
gauge:
value_type: double
value_type: int
sqlserver.lock.wait_time.avg:
enabled: true
description: Average wait time for all lock requests that had to wait.
Expand Down Expand Up @@ -59,7 +59,7 @@ metrics:
description: Time a page will stay in the buffer pool.
unit: s
gauge:
value_type: double
value_type: int
sqlserver.page.split.rate:
enabled: true
description: Number of pages split as a result of overflowing index pages.
Expand Down Expand Up @@ -92,21 +92,21 @@ metrics:
sum:
monotonic: true
aggregation: cumulative
value_type: double
value_type: int
sqlserver.transaction_log.shrink.count:
enabled: true
description: Total number of transaction log shrinks for a database.
unit: "{shrinks}"
sum:
monotonic: true
aggregation: cumulative
value_type: double
value_type: int
sqlserver.transaction_log.usage:
enabled: true
description: Percent of transaction log space used.
unit: "%"
gauge:
value_type: double
value_type: int
sqlserver.transaction_log.flush.wait.rate:
enabled: true
description: Number of commits waiting for a transaction log flush.
Expand Down

0 comments on commit 4ee1594

Please sign in to comment.