diff --git a/.chloggen/sqlserver_add_perf_counter_query.yaml b/.chloggen/sqlserver_add_perf_counter_query.yaml new file mode 100644 index 000000000000..103fb1071687 --- /dev/null +++ b/.chloggen/sqlserver_add_perf_counter_query.yaml @@ -0,0 +1,32 @@ +# 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. filelogreceiver) +component: sqlserverreceiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Add more metrics + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [29865] + +# (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: | + Added metrics are: + - sqlserver.resource_pool.disk.throttled.read.rate + - sqlserver.resource_pool.disk.throttled.write.rate + - sqlserver.processes.blocked + These metrics are only available when directly connecting to the SQL server instance + +# 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: [] diff --git a/receiver/sqlserverreceiver/documentation.md b/receiver/sqlserverreceiver/documentation.md index e2ee51fea4d8..20926a67d2cd 100644 --- a/receiver/sqlserverreceiver/documentation.md +++ b/receiver/sqlserverreceiver/documentation.md @@ -206,6 +206,36 @@ This metric is only available when the receiver is configured to directly connec | logical_filename | The logical filename of the file being monitored. | Any Str | | file_type | The type of file being monitored. | Any Str | +### sqlserver.processes.blocked + +The number of processes that are currently blocked + +This metric is only available when the receiver is configured to directly connect to SQL Server. + +| Unit | Metric Type | Value Type | +| ---- | ----------- | ---------- | +| {processes} | Gauge | Int | + +### sqlserver.resource_pool.disk.throttled.read.rate + +The number of read operations that were throttled in the last second + +This metric is only available when the receiver is configured to directly connect to SQL Server. + +| Unit | Metric Type | Value Type | +| ---- | ----------- | ---------- | +| {reads}/s | Gauge | Int | + +### sqlserver.resource_pool.disk.throttled.write.rate + +The number of write operations that were throttled in the last second + +This metric is only available when the receiver is configured to directly connect to SQL Server. + +| Unit | Metric Type | Value Type | +| ---- | ----------- | ---------- | +| {writes}/s | Gauge | Double | + ## Resource Attributes | Name | Description | Values | Enabled | diff --git a/receiver/sqlserverreceiver/factory.go b/receiver/sqlserverreceiver/factory.go index 90e20ead901b..c2eb63752e5f 100644 --- a/receiver/sqlserverreceiver/factory.go +++ b/receiver/sqlserverreceiver/factory.go @@ -43,6 +43,14 @@ func setupQueries(cfg *Config) []string { queries = append(queries, getSQLServerDatabaseIOQuery(cfg.InstanceName)) } + if cfg.MetricsBuilderConfig.Metrics.SqlserverResourcePoolDiskThrottledReadRate.Enabled || + cfg.MetricsBuilderConfig.Metrics.SqlserverResourcePoolDiskThrottledWriteRate.Enabled || + cfg.MetricsBuilderConfig.Metrics.SqlserverLockWaitRate.Enabled || + cfg.MetricsBuilderConfig.Metrics.SqlserverProcessesBlocked.Enabled { + + queries = append(queries, getSQLServerPerformanceCounterQuery(cfg.InstanceName)) + } + return queries } diff --git a/receiver/sqlserverreceiver/internal/metadata/generated_config.go b/receiver/sqlserverreceiver/internal/metadata/generated_config.go index 1b915f45f047..df10d88f214e 100644 --- a/receiver/sqlserverreceiver/internal/metadata/generated_config.go +++ b/receiver/sqlserverreceiver/internal/metadata/generated_config.go @@ -28,27 +28,30 @@ func (ms *MetricConfig) Unmarshal(parser *confmap.Conf) error { // MetricsConfig provides config for sqlserver metrics. type MetricsConfig struct { - SqlserverBatchRequestRate MetricConfig `mapstructure:"sqlserver.batch.request.rate"` - SqlserverBatchSQLCompilationRate MetricConfig `mapstructure:"sqlserver.batch.sql_compilation.rate"` - SqlserverBatchSQLRecompilationRate MetricConfig `mapstructure:"sqlserver.batch.sql_recompilation.rate"` - SqlserverDatabaseIoReadLatency MetricConfig `mapstructure:"sqlserver.database.io.read_latency"` - SqlserverLockWaitRate MetricConfig `mapstructure:"sqlserver.lock.wait.rate"` - SqlserverLockWaitTimeAvg MetricConfig `mapstructure:"sqlserver.lock.wait_time.avg"` - SqlserverPageBufferCacheHitRatio MetricConfig `mapstructure:"sqlserver.page.buffer_cache.hit_ratio"` - SqlserverPageCheckpointFlushRate MetricConfig `mapstructure:"sqlserver.page.checkpoint.flush.rate"` - SqlserverPageLazyWriteRate MetricConfig `mapstructure:"sqlserver.page.lazy_write.rate"` - SqlserverPageLifeExpectancy MetricConfig `mapstructure:"sqlserver.page.life_expectancy"` - SqlserverPageOperationRate MetricConfig `mapstructure:"sqlserver.page.operation.rate"` - SqlserverPageSplitRate MetricConfig `mapstructure:"sqlserver.page.split.rate"` - SqlserverTransactionRate MetricConfig `mapstructure:"sqlserver.transaction.rate"` - SqlserverTransactionWriteRate MetricConfig `mapstructure:"sqlserver.transaction.write.rate"` - SqlserverTransactionLogFlushDataRate MetricConfig `mapstructure:"sqlserver.transaction_log.flush.data.rate"` - SqlserverTransactionLogFlushRate MetricConfig `mapstructure:"sqlserver.transaction_log.flush.rate"` - SqlserverTransactionLogFlushWaitRate MetricConfig `mapstructure:"sqlserver.transaction_log.flush.wait.rate"` - SqlserverTransactionLogGrowthCount MetricConfig `mapstructure:"sqlserver.transaction_log.growth.count"` - SqlserverTransactionLogShrinkCount MetricConfig `mapstructure:"sqlserver.transaction_log.shrink.count"` - SqlserverTransactionLogUsage MetricConfig `mapstructure:"sqlserver.transaction_log.usage"` - SqlserverUserConnectionCount MetricConfig `mapstructure:"sqlserver.user.connection.count"` + SqlserverBatchRequestRate MetricConfig `mapstructure:"sqlserver.batch.request.rate"` + SqlserverBatchSQLCompilationRate MetricConfig `mapstructure:"sqlserver.batch.sql_compilation.rate"` + SqlserverBatchSQLRecompilationRate MetricConfig `mapstructure:"sqlserver.batch.sql_recompilation.rate"` + SqlserverDatabaseIoReadLatency MetricConfig `mapstructure:"sqlserver.database.io.read_latency"` + SqlserverLockWaitRate MetricConfig `mapstructure:"sqlserver.lock.wait.rate"` + SqlserverLockWaitTimeAvg MetricConfig `mapstructure:"sqlserver.lock.wait_time.avg"` + SqlserverPageBufferCacheHitRatio MetricConfig `mapstructure:"sqlserver.page.buffer_cache.hit_ratio"` + SqlserverPageCheckpointFlushRate MetricConfig `mapstructure:"sqlserver.page.checkpoint.flush.rate"` + SqlserverPageLazyWriteRate MetricConfig `mapstructure:"sqlserver.page.lazy_write.rate"` + SqlserverPageLifeExpectancy MetricConfig `mapstructure:"sqlserver.page.life_expectancy"` + SqlserverPageOperationRate MetricConfig `mapstructure:"sqlserver.page.operation.rate"` + SqlserverPageSplitRate MetricConfig `mapstructure:"sqlserver.page.split.rate"` + SqlserverProcessesBlocked MetricConfig `mapstructure:"sqlserver.processes.blocked"` + SqlserverResourcePoolDiskThrottledReadRate MetricConfig `mapstructure:"sqlserver.resource_pool.disk.throttled.read.rate"` + SqlserverResourcePoolDiskThrottledWriteRate MetricConfig `mapstructure:"sqlserver.resource_pool.disk.throttled.write.rate"` + SqlserverTransactionRate MetricConfig `mapstructure:"sqlserver.transaction.rate"` + SqlserverTransactionWriteRate MetricConfig `mapstructure:"sqlserver.transaction.write.rate"` + SqlserverTransactionLogFlushDataRate MetricConfig `mapstructure:"sqlserver.transaction_log.flush.data.rate"` + SqlserverTransactionLogFlushRate MetricConfig `mapstructure:"sqlserver.transaction_log.flush.rate"` + SqlserverTransactionLogFlushWaitRate MetricConfig `mapstructure:"sqlserver.transaction_log.flush.wait.rate"` + SqlserverTransactionLogGrowthCount MetricConfig `mapstructure:"sqlserver.transaction_log.growth.count"` + SqlserverTransactionLogShrinkCount MetricConfig `mapstructure:"sqlserver.transaction_log.shrink.count"` + SqlserverTransactionLogUsage MetricConfig `mapstructure:"sqlserver.transaction_log.usage"` + SqlserverUserConnectionCount MetricConfig `mapstructure:"sqlserver.user.connection.count"` } func DefaultMetricsConfig() MetricsConfig { @@ -89,6 +92,15 @@ func DefaultMetricsConfig() MetricsConfig { SqlserverPageSplitRate: MetricConfig{ Enabled: true, }, + SqlserverProcessesBlocked: MetricConfig{ + Enabled: false, + }, + SqlserverResourcePoolDiskThrottledReadRate: MetricConfig{ + Enabled: false, + }, + SqlserverResourcePoolDiskThrottledWriteRate: MetricConfig{ + Enabled: false, + }, SqlserverTransactionRate: MetricConfig{ Enabled: true, }, diff --git a/receiver/sqlserverreceiver/internal/metadata/generated_config_test.go b/receiver/sqlserverreceiver/internal/metadata/generated_config_test.go index b1c2ca91094f..b8b02ebd9c5e 100644 --- a/receiver/sqlserverreceiver/internal/metadata/generated_config_test.go +++ b/receiver/sqlserverreceiver/internal/metadata/generated_config_test.go @@ -26,27 +26,30 @@ func TestMetricsBuilderConfig(t *testing.T) { name: "all_set", want: MetricsBuilderConfig{ Metrics: MetricsConfig{ - SqlserverBatchRequestRate: MetricConfig{Enabled: true}, - SqlserverBatchSQLCompilationRate: MetricConfig{Enabled: true}, - SqlserverBatchSQLRecompilationRate: MetricConfig{Enabled: true}, - SqlserverDatabaseIoReadLatency: MetricConfig{Enabled: true}, - SqlserverLockWaitRate: MetricConfig{Enabled: true}, - SqlserverLockWaitTimeAvg: MetricConfig{Enabled: true}, - SqlserverPageBufferCacheHitRatio: MetricConfig{Enabled: true}, - SqlserverPageCheckpointFlushRate: MetricConfig{Enabled: true}, - SqlserverPageLazyWriteRate: MetricConfig{Enabled: true}, - SqlserverPageLifeExpectancy: MetricConfig{Enabled: true}, - SqlserverPageOperationRate: MetricConfig{Enabled: true}, - SqlserverPageSplitRate: MetricConfig{Enabled: true}, - SqlserverTransactionRate: MetricConfig{Enabled: true}, - SqlserverTransactionWriteRate: MetricConfig{Enabled: true}, - SqlserverTransactionLogFlushDataRate: MetricConfig{Enabled: true}, - SqlserverTransactionLogFlushRate: MetricConfig{Enabled: true}, - SqlserverTransactionLogFlushWaitRate: MetricConfig{Enabled: true}, - SqlserverTransactionLogGrowthCount: MetricConfig{Enabled: true}, - SqlserverTransactionLogShrinkCount: MetricConfig{Enabled: true}, - SqlserverTransactionLogUsage: MetricConfig{Enabled: true}, - SqlserverUserConnectionCount: MetricConfig{Enabled: true}, + SqlserverBatchRequestRate: MetricConfig{Enabled: true}, + SqlserverBatchSQLCompilationRate: MetricConfig{Enabled: true}, + SqlserverBatchSQLRecompilationRate: MetricConfig{Enabled: true}, + SqlserverDatabaseIoReadLatency: MetricConfig{Enabled: true}, + SqlserverLockWaitRate: MetricConfig{Enabled: true}, + SqlserverLockWaitTimeAvg: MetricConfig{Enabled: true}, + SqlserverPageBufferCacheHitRatio: MetricConfig{Enabled: true}, + SqlserverPageCheckpointFlushRate: MetricConfig{Enabled: true}, + SqlserverPageLazyWriteRate: MetricConfig{Enabled: true}, + SqlserverPageLifeExpectancy: MetricConfig{Enabled: true}, + SqlserverPageOperationRate: MetricConfig{Enabled: true}, + SqlserverPageSplitRate: MetricConfig{Enabled: true}, + SqlserverProcessesBlocked: MetricConfig{Enabled: true}, + SqlserverResourcePoolDiskThrottledReadRate: MetricConfig{Enabled: true}, + SqlserverResourcePoolDiskThrottledWriteRate: MetricConfig{Enabled: true}, + SqlserverTransactionRate: MetricConfig{Enabled: true}, + SqlserverTransactionWriteRate: MetricConfig{Enabled: true}, + SqlserverTransactionLogFlushDataRate: MetricConfig{Enabled: true}, + SqlserverTransactionLogFlushRate: MetricConfig{Enabled: true}, + SqlserverTransactionLogFlushWaitRate: MetricConfig{Enabled: true}, + SqlserverTransactionLogGrowthCount: MetricConfig{Enabled: true}, + SqlserverTransactionLogShrinkCount: MetricConfig{Enabled: true}, + SqlserverTransactionLogUsage: MetricConfig{Enabled: true}, + SqlserverUserConnectionCount: MetricConfig{Enabled: true}, }, ResourceAttributes: ResourceAttributesConfig{ SqlserverComputerName: ResourceAttributeConfig{Enabled: true}, @@ -59,27 +62,30 @@ func TestMetricsBuilderConfig(t *testing.T) { name: "none_set", want: MetricsBuilderConfig{ Metrics: MetricsConfig{ - SqlserverBatchRequestRate: MetricConfig{Enabled: false}, - SqlserverBatchSQLCompilationRate: MetricConfig{Enabled: false}, - SqlserverBatchSQLRecompilationRate: MetricConfig{Enabled: false}, - SqlserverDatabaseIoReadLatency: MetricConfig{Enabled: false}, - SqlserverLockWaitRate: MetricConfig{Enabled: false}, - SqlserverLockWaitTimeAvg: MetricConfig{Enabled: false}, - SqlserverPageBufferCacheHitRatio: MetricConfig{Enabled: false}, - SqlserverPageCheckpointFlushRate: MetricConfig{Enabled: false}, - SqlserverPageLazyWriteRate: MetricConfig{Enabled: false}, - SqlserverPageLifeExpectancy: MetricConfig{Enabled: false}, - SqlserverPageOperationRate: MetricConfig{Enabled: false}, - SqlserverPageSplitRate: MetricConfig{Enabled: false}, - SqlserverTransactionRate: MetricConfig{Enabled: false}, - SqlserverTransactionWriteRate: MetricConfig{Enabled: false}, - SqlserverTransactionLogFlushDataRate: MetricConfig{Enabled: false}, - SqlserverTransactionLogFlushRate: MetricConfig{Enabled: false}, - SqlserverTransactionLogFlushWaitRate: MetricConfig{Enabled: false}, - SqlserverTransactionLogGrowthCount: MetricConfig{Enabled: false}, - SqlserverTransactionLogShrinkCount: MetricConfig{Enabled: false}, - SqlserverTransactionLogUsage: MetricConfig{Enabled: false}, - SqlserverUserConnectionCount: MetricConfig{Enabled: false}, + SqlserverBatchRequestRate: MetricConfig{Enabled: false}, + SqlserverBatchSQLCompilationRate: MetricConfig{Enabled: false}, + SqlserverBatchSQLRecompilationRate: MetricConfig{Enabled: false}, + SqlserverDatabaseIoReadLatency: MetricConfig{Enabled: false}, + SqlserverLockWaitRate: MetricConfig{Enabled: false}, + SqlserverLockWaitTimeAvg: MetricConfig{Enabled: false}, + SqlserverPageBufferCacheHitRatio: MetricConfig{Enabled: false}, + SqlserverPageCheckpointFlushRate: MetricConfig{Enabled: false}, + SqlserverPageLazyWriteRate: MetricConfig{Enabled: false}, + SqlserverPageLifeExpectancy: MetricConfig{Enabled: false}, + SqlserverPageOperationRate: MetricConfig{Enabled: false}, + SqlserverPageSplitRate: MetricConfig{Enabled: false}, + SqlserverProcessesBlocked: MetricConfig{Enabled: false}, + SqlserverResourcePoolDiskThrottledReadRate: MetricConfig{Enabled: false}, + SqlserverResourcePoolDiskThrottledWriteRate: MetricConfig{Enabled: false}, + SqlserverTransactionRate: MetricConfig{Enabled: false}, + SqlserverTransactionWriteRate: MetricConfig{Enabled: false}, + SqlserverTransactionLogFlushDataRate: MetricConfig{Enabled: false}, + SqlserverTransactionLogFlushRate: MetricConfig{Enabled: false}, + SqlserverTransactionLogFlushWaitRate: MetricConfig{Enabled: false}, + SqlserverTransactionLogGrowthCount: MetricConfig{Enabled: false}, + SqlserverTransactionLogShrinkCount: MetricConfig{Enabled: false}, + SqlserverTransactionLogUsage: MetricConfig{Enabled: false}, + SqlserverUserConnectionCount: MetricConfig{Enabled: false}, }, ResourceAttributes: ResourceAttributesConfig{ SqlserverComputerName: ResourceAttributeConfig{Enabled: false}, diff --git a/receiver/sqlserverreceiver/internal/metadata/generated_metrics.go b/receiver/sqlserverreceiver/internal/metadata/generated_metrics.go index 71475f25e04f..ceb4f1797d8e 100644 --- a/receiver/sqlserverreceiver/internal/metadata/generated_metrics.go +++ b/receiver/sqlserverreceiver/internal/metadata/generated_metrics.go @@ -3,6 +3,8 @@ package metadata import ( + "fmt" + "strconv" "time" "go.opentelemetry.io/collector/component" @@ -634,6 +636,153 @@ func newMetricSqlserverPageSplitRate(cfg MetricConfig) metricSqlserverPageSplitR return m } +type metricSqlserverProcessesBlocked struct { + data pmetric.Metric // data buffer for generated metric. + config MetricConfig // metric config provided by user. + capacity int // max observed number of data points added to the metric. +} + +// init fills sqlserver.processes.blocked metric with initial data. +func (m *metricSqlserverProcessesBlocked) init() { + m.data.SetName("sqlserver.processes.blocked") + m.data.SetDescription("The number of processes that are currently blocked") + m.data.SetUnit("{processes}") + m.data.SetEmptyGauge() +} + +func (m *metricSqlserverProcessesBlocked) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64) { + if !m.config.Enabled { + return + } + dp := m.data.Gauge().DataPoints().AppendEmpty() + dp.SetStartTimestamp(start) + dp.SetTimestamp(ts) + dp.SetIntValue(val) +} + +// updateCapacity saves max length of data point slices that will be used for the slice capacity. +func (m *metricSqlserverProcessesBlocked) updateCapacity() { + if m.data.Gauge().DataPoints().Len() > m.capacity { + m.capacity = m.data.Gauge().DataPoints().Len() + } +} + +// emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points. +func (m *metricSqlserverProcessesBlocked) emit(metrics pmetric.MetricSlice) { + if m.config.Enabled && m.data.Gauge().DataPoints().Len() > 0 { + m.updateCapacity() + m.data.MoveTo(metrics.AppendEmpty()) + m.init() + } +} + +func newMetricSqlserverProcessesBlocked(cfg MetricConfig) metricSqlserverProcessesBlocked { + m := metricSqlserverProcessesBlocked{config: cfg} + if cfg.Enabled { + m.data = pmetric.NewMetric() + m.init() + } + return m +} + +type metricSqlserverResourcePoolDiskThrottledReadRate struct { + data pmetric.Metric // data buffer for generated metric. + config MetricConfig // metric config provided by user. + capacity int // max observed number of data points added to the metric. +} + +// init fills sqlserver.resource_pool.disk.throttled.read.rate metric with initial data. +func (m *metricSqlserverResourcePoolDiskThrottledReadRate) init() { + m.data.SetName("sqlserver.resource_pool.disk.throttled.read.rate") + m.data.SetDescription("The number of read operations that were throttled in the last second") + m.data.SetUnit("{reads}/s") + m.data.SetEmptyGauge() +} + +func (m *metricSqlserverResourcePoolDiskThrottledReadRate) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val int64) { + if !m.config.Enabled { + return + } + dp := m.data.Gauge().DataPoints().AppendEmpty() + dp.SetStartTimestamp(start) + dp.SetTimestamp(ts) + dp.SetIntValue(val) +} + +// updateCapacity saves max length of data point slices that will be used for the slice capacity. +func (m *metricSqlserverResourcePoolDiskThrottledReadRate) updateCapacity() { + if m.data.Gauge().DataPoints().Len() > m.capacity { + m.capacity = m.data.Gauge().DataPoints().Len() + } +} + +// emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points. +func (m *metricSqlserverResourcePoolDiskThrottledReadRate) emit(metrics pmetric.MetricSlice) { + if m.config.Enabled && m.data.Gauge().DataPoints().Len() > 0 { + m.updateCapacity() + m.data.MoveTo(metrics.AppendEmpty()) + m.init() + } +} + +func newMetricSqlserverResourcePoolDiskThrottledReadRate(cfg MetricConfig) metricSqlserverResourcePoolDiskThrottledReadRate { + m := metricSqlserverResourcePoolDiskThrottledReadRate{config: cfg} + if cfg.Enabled { + m.data = pmetric.NewMetric() + m.init() + } + return m +} + +type metricSqlserverResourcePoolDiskThrottledWriteRate struct { + data pmetric.Metric // data buffer for generated metric. + config MetricConfig // metric config provided by user. + capacity int // max observed number of data points added to the metric. +} + +// init fills sqlserver.resource_pool.disk.throttled.write.rate metric with initial data. +func (m *metricSqlserverResourcePoolDiskThrottledWriteRate) init() { + m.data.SetName("sqlserver.resource_pool.disk.throttled.write.rate") + m.data.SetDescription("The number of write operations that were throttled in the last second") + m.data.SetUnit("{writes}/s") + m.data.SetEmptyGauge() +} + +func (m *metricSqlserverResourcePoolDiskThrottledWriteRate) recordDataPoint(start pcommon.Timestamp, ts pcommon.Timestamp, val float64) { + if !m.config.Enabled { + return + } + dp := m.data.Gauge().DataPoints().AppendEmpty() + dp.SetStartTimestamp(start) + dp.SetTimestamp(ts) + dp.SetDoubleValue(val) +} + +// updateCapacity saves max length of data point slices that will be used for the slice capacity. +func (m *metricSqlserverResourcePoolDiskThrottledWriteRate) updateCapacity() { + if m.data.Gauge().DataPoints().Len() > m.capacity { + m.capacity = m.data.Gauge().DataPoints().Len() + } +} + +// emit appends recorded metric data to a metrics slice and prepares it for recording another set of data points. +func (m *metricSqlserverResourcePoolDiskThrottledWriteRate) emit(metrics pmetric.MetricSlice) { + if m.config.Enabled && m.data.Gauge().DataPoints().Len() > 0 { + m.updateCapacity() + m.data.MoveTo(metrics.AppendEmpty()) + m.init() + } +} + +func newMetricSqlserverResourcePoolDiskThrottledWriteRate(cfg MetricConfig) metricSqlserverResourcePoolDiskThrottledWriteRate { + m := metricSqlserverResourcePoolDiskThrottledWriteRate{config: cfg} + if cfg.Enabled { + m.data = pmetric.NewMetric() + m.init() + } + return m +} + type metricSqlserverTransactionRate struct { data pmetric.Metric // data buffer for generated metric. config MetricConfig // metric config provided by user. @@ -1082,34 +1231,37 @@ func newMetricSqlserverUserConnectionCount(cfg MetricConfig) metricSqlserverUser // MetricsBuilder provides an interface for scrapers to report metrics while taking care of all the transformations // required to produce metric representation defined in metadata and user config. type MetricsBuilder struct { - config MetricsBuilderConfig // config of the metrics builder. - startTime pcommon.Timestamp // start time that will be applied to all recorded data points. - metricsCapacity int // maximum observed number of metrics per resource. - metricsBuffer pmetric.Metrics // accumulates metrics data before emitting. - buildInfo component.BuildInfo // contains version information. - resourceAttributeIncludeFilter map[string]filter.Filter - resourceAttributeExcludeFilter map[string]filter.Filter - metricSqlserverBatchRequestRate metricSqlserverBatchRequestRate - metricSqlserverBatchSQLCompilationRate metricSqlserverBatchSQLCompilationRate - metricSqlserverBatchSQLRecompilationRate metricSqlserverBatchSQLRecompilationRate - metricSqlserverDatabaseIoReadLatency metricSqlserverDatabaseIoReadLatency - metricSqlserverLockWaitRate metricSqlserverLockWaitRate - metricSqlserverLockWaitTimeAvg metricSqlserverLockWaitTimeAvg - metricSqlserverPageBufferCacheHitRatio metricSqlserverPageBufferCacheHitRatio - metricSqlserverPageCheckpointFlushRate metricSqlserverPageCheckpointFlushRate - metricSqlserverPageLazyWriteRate metricSqlserverPageLazyWriteRate - metricSqlserverPageLifeExpectancy metricSqlserverPageLifeExpectancy - metricSqlserverPageOperationRate metricSqlserverPageOperationRate - metricSqlserverPageSplitRate metricSqlserverPageSplitRate - metricSqlserverTransactionRate metricSqlserverTransactionRate - metricSqlserverTransactionWriteRate metricSqlserverTransactionWriteRate - metricSqlserverTransactionLogFlushDataRate metricSqlserverTransactionLogFlushDataRate - metricSqlserverTransactionLogFlushRate metricSqlserverTransactionLogFlushRate - metricSqlserverTransactionLogFlushWaitRate metricSqlserverTransactionLogFlushWaitRate - metricSqlserverTransactionLogGrowthCount metricSqlserverTransactionLogGrowthCount - metricSqlserverTransactionLogShrinkCount metricSqlserverTransactionLogShrinkCount - metricSqlserverTransactionLogUsage metricSqlserverTransactionLogUsage - metricSqlserverUserConnectionCount metricSqlserverUserConnectionCount + config MetricsBuilderConfig // config of the metrics builder. + startTime pcommon.Timestamp // start time that will be applied to all recorded data points. + metricsCapacity int // maximum observed number of metrics per resource. + metricsBuffer pmetric.Metrics // accumulates metrics data before emitting. + buildInfo component.BuildInfo // contains version information. + resourceAttributeIncludeFilter map[string]filter.Filter + resourceAttributeExcludeFilter map[string]filter.Filter + metricSqlserverBatchRequestRate metricSqlserverBatchRequestRate + metricSqlserverBatchSQLCompilationRate metricSqlserverBatchSQLCompilationRate + metricSqlserverBatchSQLRecompilationRate metricSqlserverBatchSQLRecompilationRate + metricSqlserverDatabaseIoReadLatency metricSqlserverDatabaseIoReadLatency + metricSqlserverLockWaitRate metricSqlserverLockWaitRate + metricSqlserverLockWaitTimeAvg metricSqlserverLockWaitTimeAvg + metricSqlserverPageBufferCacheHitRatio metricSqlserverPageBufferCacheHitRatio + metricSqlserverPageCheckpointFlushRate metricSqlserverPageCheckpointFlushRate + metricSqlserverPageLazyWriteRate metricSqlserverPageLazyWriteRate + metricSqlserverPageLifeExpectancy metricSqlserverPageLifeExpectancy + metricSqlserverPageOperationRate metricSqlserverPageOperationRate + metricSqlserverPageSplitRate metricSqlserverPageSplitRate + metricSqlserverProcessesBlocked metricSqlserverProcessesBlocked + metricSqlserverResourcePoolDiskThrottledReadRate metricSqlserverResourcePoolDiskThrottledReadRate + metricSqlserverResourcePoolDiskThrottledWriteRate metricSqlserverResourcePoolDiskThrottledWriteRate + metricSqlserverTransactionRate metricSqlserverTransactionRate + metricSqlserverTransactionWriteRate metricSqlserverTransactionWriteRate + metricSqlserverTransactionLogFlushDataRate metricSqlserverTransactionLogFlushDataRate + metricSqlserverTransactionLogFlushRate metricSqlserverTransactionLogFlushRate + metricSqlserverTransactionLogFlushWaitRate metricSqlserverTransactionLogFlushWaitRate + metricSqlserverTransactionLogGrowthCount metricSqlserverTransactionLogGrowthCount + metricSqlserverTransactionLogShrinkCount metricSqlserverTransactionLogShrinkCount + metricSqlserverTransactionLogUsage metricSqlserverTransactionLogUsage + metricSqlserverUserConnectionCount metricSqlserverUserConnectionCount } // metricBuilderOption applies changes to default metrics builder. @@ -1124,33 +1276,36 @@ func WithStartTime(startTime pcommon.Timestamp) metricBuilderOption { func NewMetricsBuilder(mbc MetricsBuilderConfig, settings receiver.CreateSettings, options ...metricBuilderOption) *MetricsBuilder { mb := &MetricsBuilder{ - config: mbc, - startTime: pcommon.NewTimestampFromTime(time.Now()), - metricsBuffer: pmetric.NewMetrics(), - buildInfo: settings.BuildInfo, - metricSqlserverBatchRequestRate: newMetricSqlserverBatchRequestRate(mbc.Metrics.SqlserverBatchRequestRate), - metricSqlserverBatchSQLCompilationRate: newMetricSqlserverBatchSQLCompilationRate(mbc.Metrics.SqlserverBatchSQLCompilationRate), - metricSqlserverBatchSQLRecompilationRate: newMetricSqlserverBatchSQLRecompilationRate(mbc.Metrics.SqlserverBatchSQLRecompilationRate), - metricSqlserverDatabaseIoReadLatency: newMetricSqlserverDatabaseIoReadLatency(mbc.Metrics.SqlserverDatabaseIoReadLatency), - metricSqlserverLockWaitRate: newMetricSqlserverLockWaitRate(mbc.Metrics.SqlserverLockWaitRate), - metricSqlserverLockWaitTimeAvg: newMetricSqlserverLockWaitTimeAvg(mbc.Metrics.SqlserverLockWaitTimeAvg), - metricSqlserverPageBufferCacheHitRatio: newMetricSqlserverPageBufferCacheHitRatio(mbc.Metrics.SqlserverPageBufferCacheHitRatio), - metricSqlserverPageCheckpointFlushRate: newMetricSqlserverPageCheckpointFlushRate(mbc.Metrics.SqlserverPageCheckpointFlushRate), - metricSqlserverPageLazyWriteRate: newMetricSqlserverPageLazyWriteRate(mbc.Metrics.SqlserverPageLazyWriteRate), - metricSqlserverPageLifeExpectancy: newMetricSqlserverPageLifeExpectancy(mbc.Metrics.SqlserverPageLifeExpectancy), - metricSqlserverPageOperationRate: newMetricSqlserverPageOperationRate(mbc.Metrics.SqlserverPageOperationRate), - metricSqlserverPageSplitRate: newMetricSqlserverPageSplitRate(mbc.Metrics.SqlserverPageSplitRate), - metricSqlserverTransactionRate: newMetricSqlserverTransactionRate(mbc.Metrics.SqlserverTransactionRate), - metricSqlserverTransactionWriteRate: newMetricSqlserverTransactionWriteRate(mbc.Metrics.SqlserverTransactionWriteRate), - metricSqlserverTransactionLogFlushDataRate: newMetricSqlserverTransactionLogFlushDataRate(mbc.Metrics.SqlserverTransactionLogFlushDataRate), - metricSqlserverTransactionLogFlushRate: newMetricSqlserverTransactionLogFlushRate(mbc.Metrics.SqlserverTransactionLogFlushRate), - metricSqlserverTransactionLogFlushWaitRate: newMetricSqlserverTransactionLogFlushWaitRate(mbc.Metrics.SqlserverTransactionLogFlushWaitRate), - metricSqlserverTransactionLogGrowthCount: newMetricSqlserverTransactionLogGrowthCount(mbc.Metrics.SqlserverTransactionLogGrowthCount), - metricSqlserverTransactionLogShrinkCount: newMetricSqlserverTransactionLogShrinkCount(mbc.Metrics.SqlserverTransactionLogShrinkCount), - metricSqlserverTransactionLogUsage: newMetricSqlserverTransactionLogUsage(mbc.Metrics.SqlserverTransactionLogUsage), - metricSqlserverUserConnectionCount: newMetricSqlserverUserConnectionCount(mbc.Metrics.SqlserverUserConnectionCount), - resourceAttributeIncludeFilter: make(map[string]filter.Filter), - resourceAttributeExcludeFilter: make(map[string]filter.Filter), + config: mbc, + startTime: pcommon.NewTimestampFromTime(time.Now()), + metricsBuffer: pmetric.NewMetrics(), + buildInfo: settings.BuildInfo, + metricSqlserverBatchRequestRate: newMetricSqlserverBatchRequestRate(mbc.Metrics.SqlserverBatchRequestRate), + metricSqlserverBatchSQLCompilationRate: newMetricSqlserverBatchSQLCompilationRate(mbc.Metrics.SqlserverBatchSQLCompilationRate), + metricSqlserverBatchSQLRecompilationRate: newMetricSqlserverBatchSQLRecompilationRate(mbc.Metrics.SqlserverBatchSQLRecompilationRate), + metricSqlserverDatabaseIoReadLatency: newMetricSqlserverDatabaseIoReadLatency(mbc.Metrics.SqlserverDatabaseIoReadLatency), + metricSqlserverLockWaitRate: newMetricSqlserverLockWaitRate(mbc.Metrics.SqlserverLockWaitRate), + metricSqlserverLockWaitTimeAvg: newMetricSqlserverLockWaitTimeAvg(mbc.Metrics.SqlserverLockWaitTimeAvg), + metricSqlserverPageBufferCacheHitRatio: newMetricSqlserverPageBufferCacheHitRatio(mbc.Metrics.SqlserverPageBufferCacheHitRatio), + metricSqlserverPageCheckpointFlushRate: newMetricSqlserverPageCheckpointFlushRate(mbc.Metrics.SqlserverPageCheckpointFlushRate), + metricSqlserverPageLazyWriteRate: newMetricSqlserverPageLazyWriteRate(mbc.Metrics.SqlserverPageLazyWriteRate), + metricSqlserverPageLifeExpectancy: newMetricSqlserverPageLifeExpectancy(mbc.Metrics.SqlserverPageLifeExpectancy), + metricSqlserverPageOperationRate: newMetricSqlserverPageOperationRate(mbc.Metrics.SqlserverPageOperationRate), + metricSqlserverPageSplitRate: newMetricSqlserverPageSplitRate(mbc.Metrics.SqlserverPageSplitRate), + metricSqlserverProcessesBlocked: newMetricSqlserverProcessesBlocked(mbc.Metrics.SqlserverProcessesBlocked), + metricSqlserverResourcePoolDiskThrottledReadRate: newMetricSqlserverResourcePoolDiskThrottledReadRate(mbc.Metrics.SqlserverResourcePoolDiskThrottledReadRate), + metricSqlserverResourcePoolDiskThrottledWriteRate: newMetricSqlserverResourcePoolDiskThrottledWriteRate(mbc.Metrics.SqlserverResourcePoolDiskThrottledWriteRate), + metricSqlserverTransactionRate: newMetricSqlserverTransactionRate(mbc.Metrics.SqlserverTransactionRate), + metricSqlserverTransactionWriteRate: newMetricSqlserverTransactionWriteRate(mbc.Metrics.SqlserverTransactionWriteRate), + metricSqlserverTransactionLogFlushDataRate: newMetricSqlserverTransactionLogFlushDataRate(mbc.Metrics.SqlserverTransactionLogFlushDataRate), + metricSqlserverTransactionLogFlushRate: newMetricSqlserverTransactionLogFlushRate(mbc.Metrics.SqlserverTransactionLogFlushRate), + metricSqlserverTransactionLogFlushWaitRate: newMetricSqlserverTransactionLogFlushWaitRate(mbc.Metrics.SqlserverTransactionLogFlushWaitRate), + metricSqlserverTransactionLogGrowthCount: newMetricSqlserverTransactionLogGrowthCount(mbc.Metrics.SqlserverTransactionLogGrowthCount), + metricSqlserverTransactionLogShrinkCount: newMetricSqlserverTransactionLogShrinkCount(mbc.Metrics.SqlserverTransactionLogShrinkCount), + metricSqlserverTransactionLogUsage: newMetricSqlserverTransactionLogUsage(mbc.Metrics.SqlserverTransactionLogUsage), + metricSqlserverUserConnectionCount: newMetricSqlserverUserConnectionCount(mbc.Metrics.SqlserverUserConnectionCount), + resourceAttributeIncludeFilter: make(map[string]filter.Filter), + resourceAttributeExcludeFilter: make(map[string]filter.Filter), } if mbc.ResourceAttributes.SqlserverComputerName.MetricsInclude != nil { mb.resourceAttributeIncludeFilter["sqlserver.computer.name"] = filter.CreateFilter(mbc.ResourceAttributes.SqlserverComputerName.MetricsInclude) @@ -1243,6 +1398,9 @@ func (mb *MetricsBuilder) EmitForResource(rmo ...ResourceMetricsOption) { mb.metricSqlserverPageLifeExpectancy.emit(ils.Metrics()) mb.metricSqlserverPageOperationRate.emit(ils.Metrics()) mb.metricSqlserverPageSplitRate.emit(ils.Metrics()) + mb.metricSqlserverProcessesBlocked.emit(ils.Metrics()) + mb.metricSqlserverResourcePoolDiskThrottledReadRate.emit(ils.Metrics()) + mb.metricSqlserverResourcePoolDiskThrottledWriteRate.emit(ils.Metrics()) mb.metricSqlserverTransactionRate.emit(ils.Metrics()) mb.metricSqlserverTransactionWriteRate.emit(ils.Metrics()) mb.metricSqlserverTransactionLogFlushDataRate.emit(ils.Metrics()) @@ -1343,6 +1501,36 @@ func (mb *MetricsBuilder) RecordSqlserverPageSplitRateDataPoint(ts pcommon.Times mb.metricSqlserverPageSplitRate.recordDataPoint(mb.startTime, ts, val) } +// RecordSqlserverProcessesBlockedDataPoint adds a data point to sqlserver.processes.blocked metric. +func (mb *MetricsBuilder) RecordSqlserverProcessesBlockedDataPoint(ts pcommon.Timestamp, inputVal string) error { + val, err := strconv.ParseInt(inputVal, 10, 64) + if err != nil { + return fmt.Errorf("failed to parse int64 for SqlserverProcessesBlocked, value was %s: %w", inputVal, err) + } + mb.metricSqlserverProcessesBlocked.recordDataPoint(mb.startTime, ts, val) + return nil +} + +// RecordSqlserverResourcePoolDiskThrottledReadRateDataPoint adds a data point to sqlserver.resource_pool.disk.throttled.read.rate metric. +func (mb *MetricsBuilder) RecordSqlserverResourcePoolDiskThrottledReadRateDataPoint(ts pcommon.Timestamp, inputVal string) error { + val, err := strconv.ParseInt(inputVal, 10, 64) + if err != nil { + return fmt.Errorf("failed to parse int64 for SqlserverResourcePoolDiskThrottledReadRate, value was %s: %w", inputVal, err) + } + mb.metricSqlserverResourcePoolDiskThrottledReadRate.recordDataPoint(mb.startTime, ts, val) + return nil +} + +// RecordSqlserverResourcePoolDiskThrottledWriteRateDataPoint adds a data point to sqlserver.resource_pool.disk.throttled.write.rate metric. +func (mb *MetricsBuilder) RecordSqlserverResourcePoolDiskThrottledWriteRateDataPoint(ts pcommon.Timestamp, inputVal string) error { + val, err := strconv.ParseFloat(inputVal, 64) + if err != nil { + return fmt.Errorf("failed to parse float64 for SqlserverResourcePoolDiskThrottledWriteRate, value was %s: %w", inputVal, err) + } + mb.metricSqlserverResourcePoolDiskThrottledWriteRate.recordDataPoint(mb.startTime, ts, val) + return nil +} + // RecordSqlserverTransactionRateDataPoint adds a data point to sqlserver.transaction.rate metric. func (mb *MetricsBuilder) RecordSqlserverTransactionRateDataPoint(ts pcommon.Timestamp, val float64) { mb.metricSqlserverTransactionRate.recordDataPoint(mb.startTime, ts, val) diff --git a/receiver/sqlserverreceiver/internal/metadata/generated_metrics_test.go b/receiver/sqlserverreceiver/internal/metadata/generated_metrics_test.go index 11fbcc4b5303..b8778f9b26fd 100644 --- a/receiver/sqlserverreceiver/internal/metadata/generated_metrics_test.go +++ b/receiver/sqlserverreceiver/internal/metadata/generated_metrics_test.go @@ -115,6 +115,15 @@ func TestMetricsBuilder(t *testing.T) { allMetricsCount++ mb.RecordSqlserverPageSplitRateDataPoint(ts, 1) + allMetricsCount++ + mb.RecordSqlserverProcessesBlockedDataPoint(ts, "1") + + allMetricsCount++ + mb.RecordSqlserverResourcePoolDiskThrottledReadRateDataPoint(ts, "1") + + allMetricsCount++ + mb.RecordSqlserverResourcePoolDiskThrottledWriteRateDataPoint(ts, "1") + defaultMetricsCount++ allMetricsCount++ mb.RecordSqlserverTransactionRateDataPoint(ts, 1) @@ -335,6 +344,42 @@ func TestMetricsBuilder(t *testing.T) { assert.Equal(t, ts, dp.Timestamp()) assert.Equal(t, pmetric.NumberDataPointValueTypeDouble, dp.ValueType()) assert.Equal(t, float64(1), dp.DoubleValue()) + case "sqlserver.processes.blocked": + assert.False(t, validatedMetrics["sqlserver.processes.blocked"], "Found a duplicate in the metrics slice: sqlserver.processes.blocked") + validatedMetrics["sqlserver.processes.blocked"] = true + assert.Equal(t, pmetric.MetricTypeGauge, ms.At(i).Type()) + assert.Equal(t, 1, ms.At(i).Gauge().DataPoints().Len()) + assert.Equal(t, "The number of processes that are currently blocked", ms.At(i).Description()) + assert.Equal(t, "{processes}", ms.At(i).Unit()) + dp := ms.At(i).Gauge().DataPoints().At(0) + assert.Equal(t, start, dp.StartTimestamp()) + assert.Equal(t, ts, dp.Timestamp()) + assert.Equal(t, pmetric.NumberDataPointValueTypeInt, dp.ValueType()) + assert.Equal(t, int64(1), dp.IntValue()) + case "sqlserver.resource_pool.disk.throttled.read.rate": + assert.False(t, validatedMetrics["sqlserver.resource_pool.disk.throttled.read.rate"], "Found a duplicate in the metrics slice: sqlserver.resource_pool.disk.throttled.read.rate") + validatedMetrics["sqlserver.resource_pool.disk.throttled.read.rate"] = true + assert.Equal(t, pmetric.MetricTypeGauge, ms.At(i).Type()) + assert.Equal(t, 1, ms.At(i).Gauge().DataPoints().Len()) + assert.Equal(t, "The number of read operations that were throttled in the last second", ms.At(i).Description()) + assert.Equal(t, "{reads}/s", ms.At(i).Unit()) + dp := ms.At(i).Gauge().DataPoints().At(0) + assert.Equal(t, start, dp.StartTimestamp()) + assert.Equal(t, ts, dp.Timestamp()) + assert.Equal(t, pmetric.NumberDataPointValueTypeInt, dp.ValueType()) + assert.Equal(t, int64(1), dp.IntValue()) + case "sqlserver.resource_pool.disk.throttled.write.rate": + assert.False(t, validatedMetrics["sqlserver.resource_pool.disk.throttled.write.rate"], "Found a duplicate in the metrics slice: sqlserver.resource_pool.disk.throttled.write.rate") + validatedMetrics["sqlserver.resource_pool.disk.throttled.write.rate"] = true + assert.Equal(t, pmetric.MetricTypeGauge, ms.At(i).Type()) + assert.Equal(t, 1, ms.At(i).Gauge().DataPoints().Len()) + assert.Equal(t, "The number of write operations that were throttled in the last second", ms.At(i).Description()) + assert.Equal(t, "{writes}/s", ms.At(i).Unit()) + dp := ms.At(i).Gauge().DataPoints().At(0) + assert.Equal(t, start, dp.StartTimestamp()) + assert.Equal(t, ts, dp.Timestamp()) + assert.Equal(t, pmetric.NumberDataPointValueTypeDouble, dp.ValueType()) + assert.Equal(t, float64(1), dp.DoubleValue()) case "sqlserver.transaction.rate": assert.False(t, validatedMetrics["sqlserver.transaction.rate"], "Found a duplicate in the metrics slice: sqlserver.transaction.rate") validatedMetrics["sqlserver.transaction.rate"] = true diff --git a/receiver/sqlserverreceiver/internal/metadata/testdata/config.yaml b/receiver/sqlserverreceiver/internal/metadata/testdata/config.yaml index e7470fd6536f..e12c1eb88bf7 100644 --- a/receiver/sqlserverreceiver/internal/metadata/testdata/config.yaml +++ b/receiver/sqlserverreceiver/internal/metadata/testdata/config.yaml @@ -25,6 +25,12 @@ all_set: enabled: true sqlserver.page.split.rate: enabled: true + sqlserver.processes.blocked: + enabled: true + sqlserver.resource_pool.disk.throttled.read.rate: + enabled: true + sqlserver.resource_pool.disk.throttled.write.rate: + enabled: true sqlserver.transaction.rate: enabled: true sqlserver.transaction.write.rate: @@ -76,6 +82,12 @@ none_set: enabled: false sqlserver.page.split.rate: enabled: false + sqlserver.processes.blocked: + enabled: false + sqlserver.resource_pool.disk.throttled.read.rate: + enabled: false + sqlserver.resource_pool.disk.throttled.write.rate: + enabled: false sqlserver.transaction.rate: enabled: false sqlserver.transaction.write.rate: diff --git a/receiver/sqlserverreceiver/metadata.yaml b/receiver/sqlserverreceiver/metadata.yaml index f83d26f4df35..24de31e2b4b7 100644 --- a/receiver/sqlserverreceiver/metadata.yaml +++ b/receiver/sqlserverreceiver/metadata.yaml @@ -176,6 +176,33 @@ metrics: value_type: double attributes: [physical_filename, logical_filename, file_type] extended_documentation: This metric is only available when the receiver is configured to directly connect to SQL Server. + sqlserver.resource_pool.disk.throttled.read.rate: + enabled: false + description: The number of read operations that were throttled in the last second + unit: "{reads}/s" + gauge: + value_type: int + input_type: string + attributes: [] + extended_documentation: This metric is only available when the receiver is configured to directly connect to SQL Server. + sqlserver.resource_pool.disk.throttled.write.rate: + enabled: false + description: The number of write operations that were throttled in the last second + unit: "{writes}/s" + gauge: + value_type: double + input_type: string + attributes: [] + extended_documentation: This metric is only available when the receiver is configured to directly connect to SQL Server. + sqlserver.processes.blocked: + enabled: false + description: The number of processes that are currently blocked + unit: "{processes}" + gauge: + value_type: int + input_type: string + attributes: [] + extended_documentation: This metric is only available when the receiver is configured to directly connect to SQL Server. tests: config: diff --git a/receiver/sqlserverreceiver/queries.go b/receiver/sqlserverreceiver/queries.go index 1fcb6dce1017..97d277d1a0e6 100644 --- a/receiver/sqlserverreceiver/queries.go +++ b/receiver/sqlserverreceiver/queries.go @@ -5,6 +5,7 @@ package sqlserverreceiver // import "github.com/open-telemetry/opentelemetry-col import ( "fmt" + "strings" ) // Direct access to queries is not recommended: The receiver allows filtering based on @@ -62,3 +63,181 @@ func getSQLServerDatabaseIOQuery(instanceName string) string { return fmt.Sprintf(sqlServerDatabaseIOQuery, "") } + +const sqlServerPerformanceCountersQuery string = ` +SET DEADLOCK_PRIORITY -10; +IF SERVERPROPERTY('EngineEdition') NOT IN (2,3,4) BEGIN /*NOT IN Standard,Enterprise,Express*/ + DECLARE @ErrorMessage AS nvarchar(500) = 'Connection string Server:'+ @@ServerName + ',Database:' + DB_NAME() +' is not a SQL Server Standard, Enterprise or Express. This query is only supported on these editions.'; + RAISERROR (@ErrorMessage,11,1) + RETURN +END + +DECLARE + @SqlStatement AS nvarchar(max) + ,@MajorMinorVersion AS int = CAST(PARSENAME(CAST(SERVERPROPERTY('ProductVersion') AS nvarchar),4) AS int)*100 + CAST(PARSENAME(CAST(SERVERPROPERTY('ProductVersion') AS nvarchar),3) AS int) + +DECLARE @PCounters TABLE +( + [object_name] nvarchar(128) + ,[counter_name] nvarchar(128) + ,[instance_name] nvarchar(128) + ,[cntr_value] bigint + ,[cntr_type] int + PRIMARY KEY([object_name], [counter_name], [instance_name]) +); + +WITH PerfCounters AS ( +SELECT DISTINCT + RTRIM(spi.[object_name]) [object_name] + ,RTRIM(spi.[counter_name]) [counter_name] + ,RTRIM(spi.[instance_name]) AS [instance_name] + ,CAST(spi.[cntr_value] AS bigint) AS [cntr_value] + ,spi.[cntr_type] + FROM sys.dm_os_performance_counters AS spi + WHERE + counter_name IN ( + 'SQL Compilations/sec' + ,'SQL Re-Compilations/sec' + ,'User Connections' + ,'Batch Requests/sec' + ,'Logouts/sec' + ,'Logins/sec' + ,'Processes blocked' + ,'Latch Waits/sec' + ,'Average Latch Wait Time (ms)' + ,'Full Scans/sec' + ,'Index Searches/sec' + ,'Page Splits/sec' + ,'Page lookups/sec' + ,'Page reads/sec' + ,'Page writes/sec' + ,'Readahead pages/sec' + ,'Lazy writes/sec' + ,'Checkpoint pages/sec' + ,'Table Lock Escalations/sec' + ,'Page life expectancy' + ,'Log File(s) Size (KB)' + ,'Log File(s) Used Size (KB)' + ,'Data File(s) Size (KB)' + ,'Transactions/sec' + ,'Write Transactions/sec' + ,'Active Transactions' + ,'Log Growths' + ,'Active Temp Tables' + ,'Logical Connections' + ,'Temp Tables Creation Rate' + ,'Temp Tables For Destruction' + ,'Free Space in tempdb (KB)' + ,'Version Store Size (KB)' + ,'Memory Grants Pending' + ,'Memory Grants Outstanding' + ,'Free list stalls/sec' + ,'Buffer cache hit ratio' + ,'Buffer cache hit ratio base' + ,'Database Pages' + ,'Backup/Restore Throughput/sec' + ,'Total Server Memory (KB)' + ,'Target Server Memory (KB)' + ,'Log Flushes/sec' + ,'Log Flush Wait Time' + ,'Memory broker clerk size' + ,'Log Bytes Flushed/sec' + ,'Bytes Sent to Replica/sec' + ,'Log Send Queue' + ,'Bytes Sent to Transport/sec' + ,'Sends to Replica/sec' + ,'Bytes Sent to Transport/sec' + ,'Sends to Transport/sec' + ,'Bytes Received from Replica/sec' + ,'Receives from Replica/sec' + ,'Flow Control Time (ms/sec)' + ,'Flow Control/sec' + ,'Resent Messages/sec' + ,'Redone Bytes/sec' + ,'XTP Memory Used (KB)' + ,'Transaction Delay' + ,'Log Bytes Received/sec' + ,'Log Apply Pending Queue' + ,'Redone Bytes/sec' + ,'Recovery Queue' + ,'Log Apply Ready Queue' + ,'CPU usage %' + ,'CPU usage % base' + ,'Queued requests' + ,'Requests completed/sec' + ,'Blocked tasks' + ,'Active memory grant amount (KB)' + ,'Disk Read Bytes/sec' + ,'Disk Read IO Throttled/sec' + ,'Disk Read IO/sec' + ,'Disk Write Bytes/sec' + ,'Disk Write IO Throttled/sec' + ,'Disk Write IO/sec' + ,'Used memory (KB)' + ,'Forwarded Records/sec' + ,'Background Writer pages/sec' + ,'Percent Log Used' + ,'Log Send Queue KB' + ,'Redo Queue KB' + ,'Mirrored Write Transactions/sec' + ,'Group Commit Time' + ,'Group Commits/Sec' + ,'Workfiles Created/sec' + ,'Worktables Created/sec' + ,'Distributed Query' + ,'DTC calls' + ,'Query Store CPU usage' + ,'Query Store physical reads' + ,'Query Store logical reads' + ,'Query Store logical writes' + ) OR ( + spi.[object_name] LIKE '%User Settable%' + OR spi.[object_name] LIKE '%SQL Errors%' + OR spi.[object_name] LIKE '%Batch Resp Statistics%' + ) OR ( + spi.[instance_name] IN ('_Total') + AND spi.[counter_name] IN ( + 'Lock Timeouts/sec' + ,'Lock Timeouts (timeout > 0)/sec' + ,'Number of Deadlocks/sec' + ,'Lock Waits/sec' + ,'Latch Waits/sec' + ) + ) +) + +INSERT INTO @PCounters SELECT * FROM PerfCounters; + +SELECT + 'sqlserver_performance' AS [measurement] + ,REPLACE(@@SERVERNAME,'\',':') AS [sql_instance] + ,pc.[object_name] AS [object] + ,pc.[counter_name] AS [counter] + ,CASE pc.[instance_name] WHEN '_Total' THEN 'Total' ELSE ISNULL(pc.[instance_name],'') END AS [instance] + ,CAST(CASE WHEN pc.[cntr_type] = 537003264 AND pc1.[cntr_value] > 0 THEN (pc.[cntr_value] * 1.0) / (pc1.[cntr_value] * 1.0) * 100 ELSE pc.[cntr_value] END AS float(10)) AS [value] + ,CAST(pc.[cntr_type] AS varchar(25)) AS [counter_type] +FROM @PCounters AS pc +LEFT OUTER JOIN @PCounters AS pc1 + ON ( + pc.[counter_name] = REPLACE(pc1.[counter_name],' base','') + OR pc.[counter_name] = REPLACE(pc1.[counter_name],' base',' (ms)') + ) + AND pc.[object_name] = pc1.[object_name] + AND pc.[instance_name] = pc1.[instance_name] + AND pc1.[counter_name] LIKE '%base' +WHERE + pc.[counter_name] NOT LIKE '% base' +{filter_instance_name} +OPTION(RECOMPILE) +` + +func getSQLServerPerformanceCounterQuery(instanceName string) string { + if instanceName != "" { + whereClause := fmt.Sprintf("\tAND @@SERVERNAME = '%s'", instanceName) + r := strings.NewReplacer("{filter_instance_name}", whereClause) + return r.Replace(sqlServerPerformanceCountersQuery) + } + + r := strings.NewReplacer("{filter_instance_name}", "") + return r.Replace(sqlServerPerformanceCountersQuery) +} diff --git a/receiver/sqlserverreceiver/queries_test.go b/receiver/sqlserverreceiver/queries_test.go index 139dc410e039..c23a90f74b40 100644 --- a/receiver/sqlserverreceiver/queries_test.go +++ b/receiver/sqlserverreceiver/queries_test.go @@ -12,24 +12,49 @@ import ( "github.com/stretchr/testify/require" ) -func TestQueryIODBWithoutInstanceName(t *testing.T) { - expectedBytes, err := os.ReadFile(path.Join("./testdata", "databaseIOQueryWithoutInstanceName.txt")) - require.NoError(t, err) - // Replace all will fix newlines when testing on Windows - expected := strings.ReplaceAll(string(expectedBytes), "\r\n", "\n") +func TestQueryContents(t *testing.T) { + queryTests := []struct { + name string + instanceName string + getQuery func(string) string + expectedQueryValFilename string + }{ + { + name: "Test database IO query without instance name", + instanceName: "", + getQuery: getSQLServerDatabaseIOQuery, + expectedQueryValFilename: "databaseIOQueryWithoutInstanceName.txt", + }, + { + name: "Test database IO query with instance name", + instanceName: "instanceName", + getQuery: getSQLServerDatabaseIOQuery, + expectedQueryValFilename: "databaseIOQueryWithInstanceName.txt", + }, + { + name: "Test perf counter query without instance name", + instanceName: "", + getQuery: getSQLServerPerformanceCounterQuery, + expectedQueryValFilename: "perfCounterQueryWithoutInstanceName.txt", + }, + { + name: "Test perf counter query with instance name", + instanceName: "instanceName", + getQuery: getSQLServerPerformanceCounterQuery, + expectedQueryValFilename: "perfCounterQueryWithInstanceName.txt", + }, + } + + for _, tt := range queryTests { + t.Run(tt.name, func(t *testing.T) { + expectedBytes, err := os.ReadFile(path.Join("./testdata", tt.expectedQueryValFilename)) + require.NoError(t, err) + // Replace all will fix newlines when testing on Windows + expected := strings.ReplaceAll(string(expectedBytes), "\r\n", "\n") + + actual := tt.getQuery(tt.instanceName) + require.Equal(t, expected, actual) + }) + } - actual := getSQLServerDatabaseIOQuery("") - - require.Equal(t, expected, actual) -} - -func TestQueryIODBWithInstanceName(t *testing.T) { - expectedBytes, err := os.ReadFile(path.Join("./testdata", "databaseIOQueryWithInstanceName.txt")) - require.NoError(t, err) - // Replace all will fix newlines when testing on Windows - expected := strings.ReplaceAll(string(expectedBytes), "\r\n", "\n") - - actual := getSQLServerDatabaseIOQuery("instanceName") - - require.Equal(t, expected, actual) } diff --git a/receiver/sqlserverreceiver/scraper.go b/receiver/sqlserverreceiver/scraper.go index 16f65d27bad4..1f65384bb8f7 100644 --- a/receiver/sqlserverreceiver/scraper.go +++ b/receiver/sqlserverreceiver/scraper.go @@ -21,6 +21,8 @@ import ( "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/sqlserverreceiver/internal/metadata" ) +const instanceNameKey = "sql_instance" + type sqlServerScraperHelper struct { id component.ID sqlQuery string @@ -82,6 +84,8 @@ func (s *sqlServerScraperHelper) Scrape(ctx context.Context) (pmetric.Metrics, e switch s.sqlQuery { case getSQLServerDatabaseIOQuery(s.instanceName): err = s.recordDatabaseIOMetrics(ctx, rb) + case getSQLServerPerformanceCounterQuery(s.instanceName): + err = s.recordDatabasePerfCounterMetrics(ctx, rb) default: return pmetric.Metrics{}, fmt.Errorf("Attempted to get metrics from unsupported query: %s", s.sqlQuery) } @@ -104,7 +108,6 @@ func (s *sqlServerScraperHelper) recordDatabaseIOMetrics(ctx context.Context, rb // TODO: Move constants out to the package level when other queries are added. const computerNameKey = "computer_name" const databaseNameKey = "database_name" - const instanceNameKey = "sql_instance" const physicalFilenameKey = "physical_filename" const logicalFilenameKey = "logical_filename" const fileTypeKey = "file_type" @@ -144,3 +147,50 @@ func (s *sqlServerScraperHelper) recordDatabaseIOMetrics(ctx context.Context, rb return errors.Join(errs...) } + +func (s *sqlServerScraperHelper) recordDatabasePerfCounterMetrics(ctx context.Context, rb *metadata.ResourceBuilder) error { + const counterKey = "counter" + const valueKey = "value" + // Constants are the columns for metrics from query + const diskReadIOThrottled = "Disk Read IO Throttled/sec" + const diskWriteIOThrottled = "Disk Write IO Throttled/sec" + const lockWaits = "Lock Waits/sec" + const processesBlocked = "Processes blocked" + + rows, err := s.client.QueryRows(ctx) + + if err != nil { + if errors.Is(err, sqlquery.ErrNullValueWarning) { + s.logger.Warn("problems encountered getting metric rows", zap.Error(err)) + } else { + return fmt.Errorf("sqlServerScraperHelper: %w", err) + } + } + + var errs []error + now := pcommon.NewTimestampFromTime(time.Now()) + for i, row := range rows { + if i == 0 { + rb.SetSqlserverInstanceName(row[instanceNameKey]) + } + + switch row[counterKey] { + case diskReadIOThrottled: + errs = append(errs, s.mb.RecordSqlserverResourcePoolDiskThrottledReadRateDataPoint(now, row[valueKey])) + case diskWriteIOThrottled: + errs = append(errs, s.mb.RecordSqlserverResourcePoolDiskThrottledWriteRateDataPoint(now, row[valueKey])) + case lockWaits: + val, err := strconv.ParseFloat(row[valueKey], 64) + if err != nil { + err = fmt.Errorf("row %d: %w", i, err) + errs = append(errs, err) + } else { + s.mb.RecordSqlserverLockWaitRateDataPoint(now, val) + } + case processesBlocked: + errs = append(errs, s.mb.RecordSqlserverProcessesBlockedDataPoint(now, row[valueKey])) + } + } + + return errors.Join(errs...) +} diff --git a/receiver/sqlserverreceiver/scraper_test.go b/receiver/sqlserverreceiver/scraper_test.go index 3538be3d1093..61124e7c9137 100644 --- a/receiver/sqlserverreceiver/scraper_test.go +++ b/receiver/sqlserverreceiver/scraper_test.go @@ -31,7 +31,10 @@ func TestEmptyScrape(t *testing.T) { assert.NoError(t, cfg.Validate()) // Ensure there aren't any scrapers when all metrics are disabled. - cfg.MetricsBuilderConfig.Metrics.SqlserverDatabaseIoReadLatency.Enabled = false + // The locks metric is the only scraper metric enabled by default, as it is reusing + // a performance counter metric, and can be gather either by perf counters, or + // by scraping. + cfg.MetricsBuilderConfig.Metrics.SqlserverLockWaitRate.Enabled = false scrapers := setupSQLServerScrapers(receivertest.NewNopCreateSettings(), cfg) assert.Empty(t, scrapers) } @@ -47,13 +50,17 @@ func TestSuccessfulScrape(t *testing.T) { // Ensure all metrics are received when all are enabled. cfg.MetricsBuilderConfig.Metrics.SqlserverDatabaseIoReadLatency.Enabled = true + cfg.MetricsBuilderConfig.Metrics.SqlserverResourcePoolDiskThrottledReadRate.Enabled = true + cfg.MetricsBuilderConfig.Metrics.SqlserverResourcePoolDiskThrottledWriteRate.Enabled = true + cfg.MetricsBuilderConfig.Metrics.SqlserverProcessesBlocked.Enabled = true + scrapers := setupSQLServerScrapers(receivertest.NewNopCreateSettings(), cfg) assert.NotNil(t, scrapers) for _, scraper := range scrapers { err := scraper.Start(context.Background(), componenttest.NewNopHost()) assert.NoError(t, err) - defer func() { assert.NoError(t, scraper.Shutdown(context.Background())) }() + defer assert.NoError(t, scraper.Shutdown(context.Background())) scraper.client = mockClient{ instanceName: scraper.instanceName, @@ -63,7 +70,14 @@ func TestSuccessfulScrape(t *testing.T) { actualMetrics, err := scraper.Scrape(context.Background()) assert.NoError(t, err) - expectedFile := filepath.Join("testdata", "expected_database_io.yaml") + var expectedFile string + switch scraper.sqlQuery { + case getSQLServerDatabaseIOQuery(scraper.instanceName): + expectedFile = filepath.Join("testdata", "expectedDatabaseIO.yaml") + case getSQLServerPerformanceCounterQuery(scraper.instanceName): + expectedFile = filepath.Join("testdata", "expectedPerfCounters.yaml") + } + // Uncomment line below to re-generate expected metrics. // golden.WriteMetrics(t, expectedFile, actualMetrics) expectedMetrics, err := golden.ReadMetrics(expectedFile) @@ -88,13 +102,16 @@ func TestScrapeInvalidQuery(t *testing.T) { // Ensure all metrics are received when all are enabled. cfg.MetricsBuilderConfig.Metrics.SqlserverDatabaseIoReadLatency.Enabled = true + cfg.MetricsBuilderConfig.Metrics.SqlserverResourcePoolDiskThrottledReadRate.Enabled = true + cfg.MetricsBuilderConfig.Metrics.SqlserverResourcePoolDiskThrottledWriteRate.Enabled = true + cfg.MetricsBuilderConfig.Metrics.SqlserverProcessesBlocked.Enabled = true scrapers := setupSQLServerScrapers(receivertest.NewNopCreateSettings(), cfg) assert.NotNil(t, scrapers) for _, scraper := range scrapers { err := scraper.Start(context.Background(), componenttest.NewNopHost()) assert.NoError(t, err) - defer func() { assert.NoError(t, scraper.Shutdown(context.Background())) }() + defer assert.NoError(t, scraper.Shutdown(context.Background())) scraper.client = mockClient{ instanceName: scraper.instanceName, @@ -131,13 +148,20 @@ func readFile(fname string) ([]sqlquery.StringMap, error) { } func (mc mockClient) QueryRows(context.Context, ...any) ([]sqlquery.StringMap, error) { - if mc.SQL == getSQLServerDatabaseIOQuery(mc.instanceName) { - queryResults, err := readFile("database_io_scraped_data.txt") - if err != nil { - return nil, err - } - return queryResults, nil + var queryResults []sqlquery.StringMap + var err error + + switch mc.SQL { + case getSQLServerDatabaseIOQuery(mc.instanceName): + queryResults, err = readFile("database_io_scraped_data.txt") + case getSQLServerPerformanceCounterQuery(mc.instanceName): + queryResults, err = readFile("perfCounterQueryData.txt") + default: + return nil, fmt.Errorf("No valid query found") } - return nil, fmt.Errorf("No valid query found") + if err != nil { + return nil, err + } + return queryResults, nil } diff --git a/receiver/sqlserverreceiver/testdata/expected_database_io.yaml b/receiver/sqlserverreceiver/testdata/expectedDatabaseIO.yaml similarity index 100% rename from receiver/sqlserverreceiver/testdata/expected_database_io.yaml rename to receiver/sqlserverreceiver/testdata/expectedDatabaseIO.yaml diff --git a/receiver/sqlserverreceiver/testdata/expectedPerfCounters.yaml b/receiver/sqlserverreceiver/testdata/expectedPerfCounters.yaml new file mode 100644 index 000000000000..edb17de9fcfb --- /dev/null +++ b/receiver/sqlserverreceiver/testdata/expectedPerfCounters.yaml @@ -0,0 +1,49 @@ +resourceMetrics: + - resource: + attributes: + - key: sqlserver.instance.name + value: + stringValue: 8cac97ac9b8f + scopeMetrics: + - metrics: + - description: Number of lock requests resulting in a wait. + gauge: + dataPoints: + - asDouble: 17 + startTimeUnixNano: "1000000" + timeUnixNano: "2000000" + name: sqlserver.lock.wait.rate + unit: '{requests}/s' + - description: The number of processes that are currently blocked + gauge: + dataPoints: + - asInt: "0" + startTimeUnixNano: "1000000" + timeUnixNano: "2000000" + name: sqlserver.processes.blocked + unit: '{processes}' + - description: The number of read operations that were throttled in the last second + gauge: + dataPoints: + - asInt: "0" + startTimeUnixNano: "1000000" + timeUnixNano: "2000000" + - asInt: "0" + startTimeUnixNano: "1000000" + timeUnixNano: "2000000" + name: sqlserver.resource_pool.disk.throttled.read.rate + unit: '{reads}/s' + - description: The number of write operations that were throttled in the last second + gauge: + dataPoints: + - asDouble: 0 + startTimeUnixNano: "1000000" + timeUnixNano: "2000000" + - asDouble: 0 + startTimeUnixNano: "1000000" + timeUnixNano: "2000000" + name: sqlserver.resource_pool.disk.throttled.write.rate + unit: '{writes}/s' + scope: + name: otelcol/sqlserverreceiver + version: latest diff --git a/receiver/sqlserverreceiver/testdata/perfCounterQueryData.txt b/receiver/sqlserverreceiver/testdata/perfCounterQueryData.txt new file mode 100644 index 000000000000..4b9ec5411d96 --- /dev/null +++ b/receiver/sqlserverreceiver/testdata/perfCounterQueryData.txt @@ -0,0 +1,2603 @@ +[ + { + "counter":"Forwarded Records/sec", + "counter_type":"272696576", + "instance":"", + "measurement":"sqlserver_performance", + "object":"SQLServer:Access Methods", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Full Scans/sec", + "counter_type":"272696576", + "instance":"", + "measurement":"sqlserver_performance", + "object":"SQLServer:Access Methods", + "sql_instance":"8cac97ac9b8f", + "value":"14458" + }, + { + "counter":"Index Searches/sec", + "counter_type":"272696576", + "instance":"", + "measurement":"sqlserver_performance", + "object":"SQLServer:Access Methods", + "sql_instance":"8cac97ac9b8f", + "value":"1.619118e+06" + }, + { + "counter":"Page Splits/sec", + "counter_type":"272696576", + "instance":"", + "measurement":"sqlserver_performance", + "object":"SQLServer:Access Methods", + "sql_instance":"8cac97ac9b8f", + "value":"871" + }, + { + "counter":"Table Lock Escalations/sec", + "counter_type":"272696576", + "instance":"", + "measurement":"sqlserver_performance", + "object":"SQLServer:Access Methods", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Workfiles Created/sec", + "counter_type":"272696576", + "instance":"", + "measurement":"sqlserver_performance", + "object":"SQLServer:Access Methods", + "sql_instance":"8cac97ac9b8f", + "value":"816" + }, + { + "counter":"Worktables Created/sec", + "counter_type":"272696576", + "instance":"", + "measurement":"sqlserver_performance", + "object":"SQLServer:Access Methods", + "sql_instance":"8cac97ac9b8f", + "value":"895" + }, + { + "counter":"Bytes Received from Replica/sec", + "counter_type":"272696576", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Availability Replica", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Bytes Sent to Replica/sec", + "counter_type":"272696576", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Availability Replica", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Bytes Sent to Transport/sec", + "counter_type":"272696576", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Availability Replica", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Flow Control Time (ms/sec)", + "counter_type":"272696576", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Availability Replica", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Flow Control/sec", + "counter_type":"272696576", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Availability Replica", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Receives from Replica/sec", + "counter_type":"272696576", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Availability Replica", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Resent Messages/sec", + "counter_type":"272696576", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Availability Replica", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Sends to Replica/sec", + "counter_type":"272696576", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Availability Replica", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Sends to Transport/sec", + "counter_type":"272696576", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Availability Replica", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Batches \u003e=000000ms \u0026 \u003c000001ms", + "counter_type":"65792", + "instance":"CPU Time:Requests", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"1952" + }, + { + "counter":"Batches \u003e=000001ms \u0026 \u003c000002ms", + "counter_type":"65792", + "instance":"CPU Time:Requests", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"205" + }, + { + "counter":"Batches \u003e=000002ms \u0026 \u003c000005ms", + "counter_type":"65792", + "instance":"CPU Time:Requests", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"160" + }, + { + "counter":"Batches \u003e=000005ms \u0026 \u003c000010ms", + "counter_type":"65792", + "instance":"CPU Time:Requests", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"93" + }, + { + "counter":"Batches \u003e=000010ms \u0026 \u003c000020ms", + "counter_type":"65792", + "instance":"CPU Time:Requests", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"220" + }, + { + "counter":"Batches \u003e=000020ms \u0026 \u003c000050ms", + "counter_type":"65792", + "instance":"CPU Time:Requests", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"437" + }, + { + "counter":"Batches \u003e=000050ms \u0026 \u003c000100ms", + "counter_type":"65792", + "instance":"CPU Time:Requests", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"158" + }, + { + "counter":"Batches \u003e=000100ms \u0026 \u003c000200ms", + "counter_type":"65792", + "instance":"CPU Time:Requests", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"130" + }, + { + "counter":"Batches \u003e=000200ms \u0026 \u003c000500ms", + "counter_type":"65792", + "instance":"CPU Time:Requests", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"18" + }, + { + "counter":"Batches \u003e=000500ms \u0026 \u003c001000ms", + "counter_type":"65792", + "instance":"CPU Time:Requests", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"1" + }, + { + "counter":"Batches \u003e=001000ms \u0026 \u003c002000ms", + "counter_type":"65792", + "instance":"CPU Time:Requests", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Batches \u003e=002000ms \u0026 \u003c005000ms", + "counter_type":"65792", + "instance":"CPU Time:Requests", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Batches \u003e=005000ms \u0026 \u003c010000ms", + "counter_type":"65792", + "instance":"CPU Time:Requests", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Batches \u003e=100000ms", + "counter_type":"65792", + "instance":"CPU Time:Requests", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Batches \u003e=010000ms \u0026 \u003c020000ms", + "counter_type":"65792", + "instance":"CPU Time:Requests", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Batches \u003e=020000ms \u0026 \u003c050000ms", + "counter_type":"65792", + "instance":"CPU Time:Requests", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Batches \u003e=050000ms \u0026 \u003c100000ms", + "counter_type":"65792", + "instance":"CPU Time:Requests", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Batches \u003e=050000ms \u0026 \u003c100000ms", + "counter_type":"65792", + "instance":"CPU Time:Total(ms)", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Batches \u003e=020000ms \u0026 \u003c050000ms", + "counter_type":"65792", + "instance":"CPU Time:Total(ms)", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Batches \u003e=010000ms \u0026 \u003c020000ms", + "counter_type":"65792", + "instance":"CPU Time:Total(ms)", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Batches \u003e=100000ms", + "counter_type":"65792", + "instance":"CPU Time:Total(ms)", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Batches \u003e=005000ms \u0026 \u003c010000ms", + "counter_type":"65792", + "instance":"CPU Time:Total(ms)", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Batches \u003e=002000ms \u0026 \u003c005000ms", + "counter_type":"65792", + "instance":"CPU Time:Total(ms)", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Batches \u003e=001000ms \u0026 \u003c002000ms", + "counter_type":"65792", + "instance":"CPU Time:Total(ms)", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Batches \u003e=000500ms \u0026 \u003c001000ms", + "counter_type":"65792", + "instance":"CPU Time:Total(ms)", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"531" + }, + { + "counter":"Batches \u003e=000200ms \u0026 \u003c000500ms", + "counter_type":"65792", + "instance":"CPU Time:Total(ms)", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"5576" + }, + { + "counter":"Batches \u003e=000100ms \u0026 \u003c000200ms", + "counter_type":"65792", + "instance":"CPU Time:Total(ms)", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"16932" + }, + { + "counter":"Batches \u003e=000050ms \u0026 \u003c000100ms", + "counter_type":"65792", + "instance":"CPU Time:Total(ms)", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"10879" + }, + { + "counter":"Batches \u003e=000020ms \u0026 \u003c000050ms", + "counter_type":"65792", + "instance":"CPU Time:Total(ms)", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"13253" + }, + { + "counter":"Batches \u003e=000010ms \u0026 \u003c000020ms", + "counter_type":"65792", + "instance":"CPU Time:Total(ms)", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"3032" + }, + { + "counter":"Batches \u003e=000005ms \u0026 \u003c000010ms", + "counter_type":"65792", + "instance":"CPU Time:Total(ms)", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"613" + }, + { + "counter":"Batches \u003e=000002ms \u0026 \u003c000005ms", + "counter_type":"65792", + "instance":"CPU Time:Total(ms)", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"457" + }, + { + "counter":"Batches \u003e=000001ms \u0026 \u003c000002ms", + "counter_type":"65792", + "instance":"CPU Time:Total(ms)", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"205" + }, + { + "counter":"Batches \u003e=000000ms \u0026 \u003c000001ms", + "counter_type":"65792", + "instance":"CPU Time:Total(ms)", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Batches \u003e=000000ms \u0026 \u003c000001ms", + "counter_type":"65792", + "instance":"Elapsed Time:Requests", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"1884" + }, + { + "counter":"Batches \u003e=000001ms \u0026 \u003c000002ms", + "counter_type":"65792", + "instance":"Elapsed Time:Requests", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"197" + }, + { + "counter":"Batches \u003e=000002ms \u0026 \u003c000005ms", + "counter_type":"65792", + "instance":"Elapsed Time:Requests", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"175" + }, + { + "counter":"Batches \u003e=000005ms \u0026 \u003c000010ms", + "counter_type":"65792", + "instance":"Elapsed Time:Requests", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"95" + }, + { + "counter":"Batches \u003e=000010ms \u0026 \u003c000020ms", + "counter_type":"65792", + "instance":"Elapsed Time:Requests", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"204" + }, + { + "counter":"Batches \u003e=000020ms \u0026 \u003c000050ms", + "counter_type":"65792", + "instance":"Elapsed Time:Requests", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"316" + }, + { + "counter":"Batches \u003e=000050ms \u0026 \u003c000100ms", + "counter_type":"65792", + "instance":"Elapsed Time:Requests", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"150" + }, + { + "counter":"Batches \u003e=000100ms \u0026 \u003c000200ms", + "counter_type":"65792", + "instance":"Elapsed Time:Requests", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"135" + }, + { + "counter":"Batches \u003e=000200ms \u0026 \u003c000500ms", + "counter_type":"65792", + "instance":"Elapsed Time:Requests", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"189" + }, + { + "counter":"Batches \u003e=000500ms \u0026 \u003c001000ms", + "counter_type":"65792", + "instance":"Elapsed Time:Requests", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"5" + }, + { + "counter":"Batches \u003e=001000ms \u0026 \u003c002000ms", + "counter_type":"65792", + "instance":"Elapsed Time:Requests", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Batches \u003e=002000ms \u0026 \u003c005000ms", + "counter_type":"65792", + "instance":"Elapsed Time:Requests", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Batches \u003e=005000ms \u0026 \u003c010000ms", + "counter_type":"65792", + "instance":"Elapsed Time:Requests", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Batches \u003e=100000ms", + "counter_type":"65792", + "instance":"Elapsed Time:Requests", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Batches \u003e=010000ms \u0026 \u003c020000ms", + "counter_type":"65792", + "instance":"Elapsed Time:Requests", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Batches \u003e=020000ms \u0026 \u003c050000ms", + "counter_type":"65792", + "instance":"Elapsed Time:Requests", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Batches \u003e=050000ms \u0026 \u003c100000ms", + "counter_type":"65792", + "instance":"Elapsed Time:Requests", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Batches \u003e=050000ms \u0026 \u003c100000ms", + "counter_type":"65792", + "instance":"Elapsed Time:Total(ms)", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Batches \u003e=020000ms \u0026 \u003c050000ms", + "counter_type":"65792", + "instance":"Elapsed Time:Total(ms)", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Batches \u003e=010000ms \u0026 \u003c020000ms", + "counter_type":"65792", + "instance":"Elapsed Time:Total(ms)", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Batches \u003e=100000ms", + "counter_type":"65792", + "instance":"Elapsed Time:Total(ms)", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Batches \u003e=005000ms \u0026 \u003c010000ms", + "counter_type":"65792", + "instance":"Elapsed Time:Total(ms)", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Batches \u003e=002000ms \u0026 \u003c005000ms", + "counter_type":"65792", + "instance":"Elapsed Time:Total(ms)", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Batches \u003e=001000ms \u0026 \u003c002000ms", + "counter_type":"65792", + "instance":"Elapsed Time:Total(ms)", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Batches \u003e=000500ms \u0026 \u003c001000ms", + "counter_type":"65792", + "instance":"Elapsed Time:Total(ms)", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"2777" + }, + { + "counter":"Batches \u003e=000200ms \u0026 \u003c000500ms", + "counter_type":"65792", + "instance":"Elapsed Time:Total(ms)", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"68267" + }, + { + "counter":"Batches \u003e=000100ms \u0026 \u003c000200ms", + "counter_type":"65792", + "instance":"Elapsed Time:Total(ms)", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"19282" + }, + { + "counter":"Batches \u003e=000050ms \u0026 \u003c000100ms", + "counter_type":"65792", + "instance":"Elapsed Time:Total(ms)", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"10344" + }, + { + "counter":"Batches \u003e=000020ms \u0026 \u003c000050ms", + "counter_type":"65792", + "instance":"Elapsed Time:Total(ms)", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"8733" + }, + { + "counter":"Batches \u003e=000010ms \u0026 \u003c000020ms", + "counter_type":"65792", + "instance":"Elapsed Time:Total(ms)", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"2882" + }, + { + "counter":"Batches \u003e=000005ms \u0026 \u003c000010ms", + "counter_type":"65792", + "instance":"Elapsed Time:Total(ms)", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"636" + }, + { + "counter":"Batches \u003e=000002ms \u0026 \u003c000005ms", + "counter_type":"65792", + "instance":"Elapsed Time:Total(ms)", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"501" + }, + { + "counter":"Batches \u003e=000001ms \u0026 \u003c000002ms", + "counter_type":"65792", + "instance":"Elapsed Time:Total(ms)", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"197" + }, + { + "counter":"Batches \u003e=000000ms \u0026 \u003c000001ms", + "counter_type":"65792", + "instance":"Elapsed Time:Total(ms)", + "measurement":"sqlserver_performance", + "object":"SQLServer:Batch Resp Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Background writer pages/sec", + "counter_type":"272696576", + "instance":"", + "measurement":"sqlserver_performance", + "object":"SQLServer:Buffer Manager", + "sql_instance":"8cac97ac9b8f", + "value":"248" + }, + { + "counter":"Buffer cache hit ratio", + "counter_type":"537003264", + "instance":"", + "measurement":"sqlserver_performance", + "object":"SQLServer:Buffer Manager", + "sql_instance":"8cac97ac9b8f", + "value":"100" + }, + { + "counter":"Checkpoint pages/sec", + "counter_type":"272696576", + "instance":"", + "measurement":"sqlserver_performance", + "object":"SQLServer:Buffer Manager", + "sql_instance":"8cac97ac9b8f", + "value":"504" + }, + { + "counter":"Database pages", + "counter_type":"65792", + "instance":"", + "measurement":"sqlserver_performance", + "object":"SQLServer:Buffer Manager", + "sql_instance":"8cac97ac9b8f", + "value":"4844" + }, + { + "counter":"Free list stalls/sec", + "counter_type":"272696576", + "instance":"", + "measurement":"sqlserver_performance", + "object":"SQLServer:Buffer Manager", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Lazy writes/sec", + "counter_type":"272696576", + "instance":"", + "measurement":"sqlserver_performance", + "object":"SQLServer:Buffer Manager", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Page life expectancy", + "counter_type":"65792", + "instance":"", + "measurement":"sqlserver_performance", + "object":"SQLServer:Buffer Manager", + "sql_instance":"8cac97ac9b8f", + "value":"433208" + }, + { + "counter":"Page lookups/sec", + "counter_type":"272696576", + "instance":"", + "measurement":"sqlserver_performance", + "object":"SQLServer:Buffer Manager", + "sql_instance":"8cac97ac9b8f", + "value":"3.294704e+06" + }, + { + "counter":"Page reads/sec", + "counter_type":"272696576", + "instance":"", + "measurement":"sqlserver_performance", + "object":"SQLServer:Buffer Manager", + "sql_instance":"8cac97ac9b8f", + "value":"4410" + }, + { + "counter":"Page writes/sec", + "counter_type":"272696576", + "instance":"", + "measurement":"sqlserver_performance", + "object":"SQLServer:Buffer Manager", + "sql_instance":"8cac97ac9b8f", + "value":"1114" + }, + { + "counter":"Readahead pages/sec", + "counter_type":"272696576", + "instance":"", + "measurement":"sqlserver_performance", + "object":"SQLServer:Buffer Manager", + "sql_instance":"8cac97ac9b8f", + "value":"379" + }, + { + "counter":"Database pages", + "counter_type":"65792", + "instance":"000", + "measurement":"sqlserver_performance", + "object":"SQLServer:Buffer Node", + "sql_instance":"8cac97ac9b8f", + "value":"4844" + }, + { + "counter":"Page life expectancy", + "counter_type":"65792", + "instance":"000", + "measurement":"sqlserver_performance", + "object":"SQLServer:Buffer Node", + "sql_instance":"8cac97ac9b8f", + "value":"433208" + }, + { + "counter":"Group Commit Time", + "counter_type":"272696576", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Database Replica", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Group Commits/Sec", + "counter_type":"272696576", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Database Replica", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Log Apply Pending Queue", + "counter_type":"65792", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Database Replica", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Log Apply Ready Queue", + "counter_type":"65792", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Database Replica", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Log Bytes Received/sec", + "counter_type":"272696576", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Database Replica", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Log Send Queue", + "counter_type":"65792", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Database Replica", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Mirrored Write Transactions/sec", + "counter_type":"272696576", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Database Replica", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Recovery Queue", + "counter_type":"65792", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Database Replica", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Redone Bytes/sec", + "counter_type":"272696576", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Database Replica", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Transaction Delay", + "counter_type":"272696576", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Database Replica", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Active Transactions", + "counter_type":"65792", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Backup/Restore Throughput/sec", + "counter_type":"272696576", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Data File(s) Size (KB)", + "counter_type":"65792", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"155648" + }, + { + "counter":"Log Bytes Flushed/sec", + "counter_type":"272696576", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"1.1055104e+07" + }, + { + "counter":"XTP Memory Used (KB)", + "counter_type":"65792", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Log File(s) Size (KB)", + "counter_type":"65792", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"23752" + }, + { + "counter":"Log File(s) Used Size (KB)", + "counter_type":"65792", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"5476" + }, + { + "counter":"Log Flush Wait Time", + "counter_type":"272696576", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"2736" + }, + { + "counter":"Log Flushes/sec", + "counter_type":"272696576", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"775" + }, + { + "counter":"Log Growths", + "counter_type":"65792", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"16" + }, + { + "counter":"Percent Log Used", + "counter_type":"65792", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"23" + }, + { + "counter":"Transactions/sec", + "counter_type":"272696576", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"16622" + }, + { + "counter":"Write Transactions/sec", + "counter_type":"272696576", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"718" + }, + { + "counter":"Write Transactions/sec", + "counter_type":"272696576", + "instance":"master", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"338" + }, + { + "counter":"Transactions/sec", + "counter_type":"272696576", + "instance":"master", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"2372" + }, + { + "counter":"Percent Log Used", + "counter_type":"65792", + "instance":"master", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"67" + }, + { + "counter":"Log Growths", + "counter_type":"65792", + "instance":"master", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"6" + }, + { + "counter":"Log Flushes/sec", + "counter_type":"272696576", + "instance":"master", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"412" + }, + { + "counter":"Log Flush Wait Time", + "counter_type":"272696576", + "instance":"master", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"2247" + }, + { + "counter":"Log File(s) Used Size (KB)", + "counter_type":"65792", + "instance":"master", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"1378" + }, + { + "counter":"Log File(s) Size (KB)", + "counter_type":"65792", + "instance":"master", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"2040" + }, + { + "counter":"XTP Memory Used (KB)", + "counter_type":"65792", + "instance":"master", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Log Bytes Flushed/sec", + "counter_type":"272696576", + "instance":"master", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"5.873664e+06" + }, + { + "counter":"Data File(s) Size (KB)", + "counter_type":"65792", + "instance":"master", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"4800" + }, + { + "counter":"Backup/Restore Throughput/sec", + "counter_type":"272696576", + "instance":"master", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Active Transactions", + "counter_type":"65792", + "instance":"master", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Active Transactions", + "counter_type":"65792", + "instance":"model", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Backup/Restore Throughput/sec", + "counter_type":"272696576", + "instance":"model", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Data File(s) Size (KB)", + "counter_type":"65792", + "instance":"model", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"8192" + }, + { + "counter":"Log Bytes Flushed/sec", + "counter_type":"272696576", + "instance":"model", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"675840" + }, + { + "counter":"XTP Memory Used (KB)", + "counter_type":"65792", + "instance":"model", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Log File(s) Size (KB)", + "counter_type":"65792", + "instance":"model", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"8184" + }, + { + "counter":"Log File(s) Used Size (KB)", + "counter_type":"65792", + "instance":"model", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"853" + }, + { + "counter":"Log Flush Wait Time", + "counter_type":"272696576", + "instance":"model", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"113" + }, + { + "counter":"Log Flushes/sec", + "counter_type":"272696576", + "instance":"model", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"73" + }, + { + "counter":"Log Growths", + "counter_type":"65792", + "instance":"model", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Percent Log Used", + "counter_type":"65792", + "instance":"model", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"10" + }, + { + "counter":"Transactions/sec", + "counter_type":"272696576", + "instance":"model", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"4395" + }, + { + "counter":"Write Transactions/sec", + "counter_type":"272696576", + "instance":"model", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"33" + }, + { + "counter":"Write Transactions/sec", + "counter_type":"272696576", + "instance":"model_msdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"34" + }, + { + "counter":"Transactions/sec", + "counter_type":"272696576", + "instance":"model_msdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"1449" + }, + { + "counter":"Percent Log Used", + "counter_type":"65792", + "instance":"model_msdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"61" + }, + { + "counter":"Log Growths", + "counter_type":"65792", + "instance":"model_msdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"2" + }, + { + "counter":"Log Flushes/sec", + "counter_type":"272696576", + "instance":"model_msdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"78" + }, + { + "counter":"Log Flush Wait Time", + "counter_type":"272696576", + "instance":"model_msdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"120" + }, + { + "counter":"Log File(s) Used Size (KB)", + "counter_type":"65792", + "instance":"model_msdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"629" + }, + { + "counter":"Log File(s) Size (KB)", + "counter_type":"65792", + "instance":"model_msdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"1016" + }, + { + "counter":"XTP Memory Used (KB)", + "counter_type":"65792", + "instance":"model_msdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Log Bytes Flushed/sec", + "counter_type":"272696576", + "instance":"model_msdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"692224" + }, + { + "counter":"Data File(s) Size (KB)", + "counter_type":"65792", + "instance":"model_msdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"15680" + }, + { + "counter":"Backup/Restore Throughput/sec", + "counter_type":"272696576", + "instance":"model_msdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Active Transactions", + "counter_type":"65792", + "instance":"model_msdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Active Transactions", + "counter_type":"65792", + "instance":"model_replicatedmaster", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Backup/Restore Throughput/sec", + "counter_type":"272696576", + "instance":"model_replicatedmaster", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Data File(s) Size (KB)", + "counter_type":"65792", + "instance":"model_replicatedmaster", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"4800" + }, + { + "counter":"Log Bytes Flushed/sec", + "counter_type":"272696576", + "instance":"model_replicatedmaster", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"970752" + }, + { + "counter":"XTP Memory Used (KB)", + "counter_type":"65792", + "instance":"model_replicatedmaster", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Log File(s) Size (KB)", + "counter_type":"65792", + "instance":"model_replicatedmaster", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"1784" + }, + { + "counter":"Log File(s) Used Size (KB)", + "counter_type":"65792", + "instance":"model_replicatedmaster", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"774" + }, + { + "counter":"Log Flush Wait Time", + "counter_type":"272696576", + "instance":"model_replicatedmaster", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"138" + }, + { + "counter":"Log Flushes/sec", + "counter_type":"272696576", + "instance":"model_replicatedmaster", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"87" + }, + { + "counter":"Log Growths", + "counter_type":"65792", + "instance":"model_replicatedmaster", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"5" + }, + { + "counter":"Percent Log Used", + "counter_type":"65792", + "instance":"model_replicatedmaster", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"43" + }, + { + "counter":"Transactions/sec", + "counter_type":"272696576", + "instance":"model_replicatedmaster", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"1452" + }, + { + "counter":"Write Transactions/sec", + "counter_type":"272696576", + "instance":"model_replicatedmaster", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"36" + }, + { + "counter":"Write Transactions/sec", + "counter_type":"272696576", + "instance":"msdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"33" + }, + { + "counter":"Transactions/sec", + "counter_type":"272696576", + "instance":"msdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"4614" + }, + { + "counter":"Percent Log Used", + "counter_type":"65792", + "instance":"msdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"53" + }, + { + "counter":"Log Growths", + "counter_type":"65792", + "instance":"msdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"3" + }, + { + "counter":"Log Flushes/sec", + "counter_type":"272696576", + "instance":"msdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"76" + }, + { + "counter":"Log Flush Wait Time", + "counter_type":"272696576", + "instance":"msdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"118" + }, + { + "counter":"Log File(s) Used Size (KB)", + "counter_type":"65792", + "instance":"msdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"678" + }, + { + "counter":"Log File(s) Size (KB)", + "counter_type":"65792", + "instance":"msdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"1272" + }, + { + "counter":"XTP Memory Used (KB)", + "counter_type":"65792", + "instance":"msdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Log Bytes Flushed/sec", + "counter_type":"272696576", + "instance":"msdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"708608" + }, + { + "counter":"Data File(s) Size (KB)", + "counter_type":"65792", + "instance":"msdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"15680" + }, + { + "counter":"Backup/Restore Throughput/sec", + "counter_type":"272696576", + "instance":"msdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Active Transactions", + "counter_type":"65792", + "instance":"msdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Active Transactions", + "counter_type":"65792", + "instance":"mssqlsystemresource", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Backup/Restore Throughput/sec", + "counter_type":"272696576", + "instance":"mssqlsystemresource", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Data File(s) Size (KB)", + "counter_type":"65792", + "instance":"mssqlsystemresource", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"40960" + }, + { + "counter":"Log Bytes Flushed/sec", + "counter_type":"272696576", + "instance":"mssqlsystemresource", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"XTP Memory Used (KB)", + "counter_type":"65792", + "instance":"mssqlsystemresource", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Log File(s) Size (KB)", + "counter_type":"65792", + "instance":"mssqlsystemresource", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"1272" + }, + { + "counter":"Log File(s) Used Size (KB)", + "counter_type":"65792", + "instance":"mssqlsystemresource", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"648" + }, + { + "counter":"Log Flush Wait Time", + "counter_type":"272696576", + "instance":"mssqlsystemresource", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Log Flushes/sec", + "counter_type":"272696576", + "instance":"mssqlsystemresource", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Log Growths", + "counter_type":"65792", + "instance":"mssqlsystemresource", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Percent Log Used", + "counter_type":"65792", + "instance":"mssqlsystemresource", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"50" + }, + { + "counter":"Transactions/sec", + "counter_type":"272696576", + "instance":"mssqlsystemresource", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"5" + }, + { + "counter":"Write Transactions/sec", + "counter_type":"272696576", + "instance":"mssqlsystemresource", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Write Transactions/sec", + "counter_type":"272696576", + "instance":"tempdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"244" + }, + { + "counter":"Transactions/sec", + "counter_type":"272696576", + "instance":"tempdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"2335" + }, + { + "counter":"Percent Log Used", + "counter_type":"65792", + "instance":"tempdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"30" + }, + { + "counter":"Log Growths", + "counter_type":"65792", + "instance":"tempdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Log Flushes/sec", + "counter_type":"272696576", + "instance":"tempdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"49" + }, + { + "counter":"Log Flush Wait Time", + "counter_type":"272696576", + "instance":"tempdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Log File(s) Used Size (KB)", + "counter_type":"65792", + "instance":"tempdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"2468" + }, + { + "counter":"Log File(s) Size (KB)", + "counter_type":"65792", + "instance":"tempdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"8184" + }, + { + "counter":"XTP Memory Used (KB)", + "counter_type":"65792", + "instance":"tempdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Log Bytes Flushed/sec", + "counter_type":"272696576", + "instance":"tempdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"2.134016e+06" + }, + { + "counter":"Data File(s) Size (KB)", + "counter_type":"65792", + "instance":"tempdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"65536" + }, + { + "counter":"Backup/Restore Throughput/sec", + "counter_type":"272696576", + "instance":"tempdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Active Transactions", + "counter_type":"65792", + "instance":"tempdb", + "measurement":"sqlserver_performance", + "object":"SQLServer:Databases", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Distributed Query", + "counter_type":"65792", + "instance":"Average execution time (ms)", + "measurement":"sqlserver_performance", + "object":"SQLServer:Exec Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"DTC calls", + "counter_type":"65792", + "instance":"Average execution time (ms)", + "measurement":"sqlserver_performance", + "object":"SQLServer:Exec Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"DTC calls", + "counter_type":"65792", + "instance":"Cumulative execution time (ms) per second", + "measurement":"sqlserver_performance", + "object":"SQLServer:Exec Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Distributed Query", + "counter_type":"65792", + "instance":"Cumulative execution time (ms) per second", + "measurement":"sqlserver_performance", + "object":"SQLServer:Exec Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Distributed Query", + "counter_type":"65792", + "instance":"Execs in progress", + "measurement":"sqlserver_performance", + "object":"SQLServer:Exec Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"DTC calls", + "counter_type":"65792", + "instance":"Execs in progress", + "measurement":"sqlserver_performance", + "object":"SQLServer:Exec Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"DTC calls", + "counter_type":"65792", + "instance":"Execs started per second", + "measurement":"sqlserver_performance", + "object":"SQLServer:Exec Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Distributed Query", + "counter_type":"65792", + "instance":"Execs started per second", + "measurement":"sqlserver_performance", + "object":"SQLServer:Exec Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Active Temp Tables", + "counter_type":"65792", + "instance":"", + "measurement":"sqlserver_performance", + "object":"SQLServer:General Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"1" + }, + { + "counter":"Logical Connections", + "counter_type":"65792", + "instance":"", + "measurement":"sqlserver_performance", + "object":"SQLServer:General Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"3" + }, + { + "counter":"Logins/sec", + "counter_type":"272696576", + "instance":"", + "measurement":"sqlserver_performance", + "object":"SQLServer:General Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"333" + }, + { + "counter":"Logouts/sec", + "counter_type":"272696576", + "instance":"", + "measurement":"sqlserver_performance", + "object":"SQLServer:General Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"330" + }, + { + "counter":"Processes blocked", + "counter_type":"65792", + "instance":"", + "measurement":"sqlserver_performance", + "object":"SQLServer:General Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Temp Tables Creation Rate", + "counter_type":"272696576", + "instance":"", + "measurement":"sqlserver_performance", + "object":"SQLServer:General Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"62" + }, + { + "counter":"Temp Tables For Destruction", + "counter_type":"65792", + "instance":"", + "measurement":"sqlserver_performance", + "object":"SQLServer:General Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"User Connections", + "counter_type":"65792", + "instance":"", + "measurement":"sqlserver_performance", + "object":"SQLServer:General Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"3" + }, + { + "counter":"Average Latch Wait Time (ms)", + "counter_type":"1073874176", + "instance":"", + "measurement":"sqlserver_performance", + "object":"SQLServer:Latches", + "sql_instance":"8cac97ac9b8f", + "value":"423" + }, + { + "counter":"Latch Waits/sec", + "counter_type":"272696576", + "instance":"", + "measurement":"sqlserver_performance", + "object":"SQLServer:Latches", + "sql_instance":"8cac97ac9b8f", + "value":"1036" + }, + { + "counter":"Lock Timeouts (timeout \u003e 0)/sec", + "counter_type":"272696576", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Locks", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Lock Timeouts/sec", + "counter_type":"272696576", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Locks", + "sql_instance":"8cac97ac9b8f", + "value":"1" + }, + { + "counter":"Lock Waits/sec", + "counter_type":"272696576", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Locks", + "sql_instance":"8cac97ac9b8f", + "value":"17" + }, + { + "counter":"Number of Deadlocks/sec", + "counter_type":"272696576", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Locks", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Memory broker clerk size", + "counter_type":"65792", + "instance":"Buffer Pool", + "measurement":"sqlserver_performance", + "object":"SQLServer:Memory Broker Clerks", + "sql_instance":"8cac97ac9b8f", + "value":"4844" + }, + { + "counter":"Memory broker clerk size", + "counter_type":"65792", + "instance":"Column store object pool", + "measurement":"sqlserver_performance", + "object":"SQLServer:Memory Broker Clerks", + "sql_instance":"8cac97ac9b8f", + "value":"16" + }, + { + "counter":"Memory Grants Outstanding", + "counter_type":"65792", + "instance":"", + "measurement":"sqlserver_performance", + "object":"SQLServer:Memory Manager", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Memory Grants Pending", + "counter_type":"65792", + "instance":"", + "measurement":"sqlserver_performance", + "object":"SQLServer:Memory Manager", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Target Server Memory (KB)", + "counter_type":"65792", + "instance":"", + "measurement":"sqlserver_performance", + "object":"SQLServer:Memory Manager", + "sql_instance":"8cac97ac9b8f", + "value":"4.588888e+06" + }, + { + "counter":"Total Server Memory (KB)", + "counter_type":"65792", + "instance":"", + "measurement":"sqlserver_performance", + "object":"SQLServer:Memory Manager", + "sql_instance":"8cac97ac9b8f", + "value":"376968" + }, + { + "counter":"Query Store CPU usage", + "counter_type":"272696576", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Query Store", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Query Store logical reads", + "counter_type":"272696576", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Query Store", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Query Store logical writes", + "counter_type":"272696576", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Query Store", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Query Store physical reads", + "counter_type":"272696576", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:Query Store", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Active memory grant amount (KB)", + "counter_type":"65792", + "instance":"default", + "measurement":"sqlserver_performance", + "object":"SQLServer:Resource Pool Stats", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"CPU usage %", + "counter_type":"537003264", + "instance":"default", + "measurement":"sqlserver_performance", + "object":"SQLServer:Resource Pool Stats", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Disk Read Bytes/sec", + "counter_type":"65792", + "instance":"default", + "measurement":"sqlserver_performance", + "object":"SQLServer:Resource Pool Stats", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Used memory (KB)", + "counter_type":"65792", + "instance":"default", + "measurement":"sqlserver_performance", + "object":"SQLServer:Resource Pool Stats", + "sql_instance":"8cac97ac9b8f", + "value":"30960" + }, + { + "counter":"Disk Read IO Throttled/sec", + "counter_type":"65792", + "instance":"default", + "measurement":"sqlserver_performance", + "object":"SQLServer:Resource Pool Stats", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Disk Read IO/sec", + "counter_type":"65792", + "instance":"default", + "measurement":"sqlserver_performance", + "object":"SQLServer:Resource Pool Stats", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Disk Write Bytes/sec", + "counter_type":"65792", + "instance":"default", + "measurement":"sqlserver_performance", + "object":"SQLServer:Resource Pool Stats", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Disk Write IO Throttled/sec", + "counter_type":"65792", + "instance":"default", + "measurement":"sqlserver_performance", + "object":"SQLServer:Resource Pool Stats", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Disk Write IO/sec", + "counter_type":"65792", + "instance":"default", + "measurement":"sqlserver_performance", + "object":"SQLServer:Resource Pool Stats", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Disk Write IO/sec", + "counter_type":"65792", + "instance":"internal", + "measurement":"sqlserver_performance", + "object":"SQLServer:Resource Pool Stats", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Disk Write IO Throttled/sec", + "counter_type":"65792", + "instance":"internal", + "measurement":"sqlserver_performance", + "object":"SQLServer:Resource Pool Stats", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Disk Write Bytes/sec", + "counter_type":"65792", + "instance":"internal", + "measurement":"sqlserver_performance", + "object":"SQLServer:Resource Pool Stats", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Disk Read IO/sec", + "counter_type":"65792", + "instance":"internal", + "measurement":"sqlserver_performance", + "object":"SQLServer:Resource Pool Stats", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Disk Read IO Throttled/sec", + "counter_type":"65792", + "instance":"internal", + "measurement":"sqlserver_performance", + "object":"SQLServer:Resource Pool Stats", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Used memory (KB)", + "counter_type":"65792", + "instance":"internal", + "measurement":"sqlserver_performance", + "object":"SQLServer:Resource Pool Stats", + "sql_instance":"8cac97ac9b8f", + "value":"277608" + }, + { + "counter":"Disk Read Bytes/sec", + "counter_type":"65792", + "instance":"internal", + "measurement":"sqlserver_performance", + "object":"SQLServer:Resource Pool Stats", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"CPU usage %", + "counter_type":"537003264", + "instance":"internal", + "measurement":"sqlserver_performance", + "object":"SQLServer:Resource Pool Stats", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Active memory grant amount (KB)", + "counter_type":"65792", + "instance":"internal", + "measurement":"sqlserver_performance", + "object":"SQLServer:Resource Pool Stats", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Errors/sec", + "counter_type":"272696576", + "instance":"Total", + "measurement":"sqlserver_performance", + "object":"SQLServer:SQL Errors", + "sql_instance":"8cac97ac9b8f", + "value":"1027" + }, + { + "counter":"Errors/sec", + "counter_type":"272696576", + "instance":"DB Offline Errors", + "measurement":"sqlserver_performance", + "object":"SQLServer:SQL Errors", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Errors/sec", + "counter_type":"272696576", + "instance":"Info Errors", + "measurement":"sqlserver_performance", + "object":"SQLServer:SQL Errors", + "sql_instance":"8cac97ac9b8f", + "value":"825" + }, + { + "counter":"Errors/sec", + "counter_type":"272696576", + "instance":"Kill Connection Errors", + "measurement":"sqlserver_performance", + "object":"SQLServer:SQL Errors", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Errors/sec", + "counter_type":"272696576", + "instance":"User Errors", + "measurement":"sqlserver_performance", + "object":"SQLServer:SQL Errors", + "sql_instance":"8cac97ac9b8f", + "value":"202" + }, + { + "counter":"Batch Requests/sec", + "counter_type":"272696576", + "instance":"", + "measurement":"sqlserver_performance", + "object":"SQLServer:SQL Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"3375" + }, + { + "counter":"SQL Compilations/sec", + "counter_type":"272696576", + "instance":"", + "measurement":"sqlserver_performance", + "object":"SQLServer:SQL Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"413" + }, + { + "counter":"SQL Re-Compilations/sec", + "counter_type":"272696576", + "instance":"", + "measurement":"sqlserver_performance", + "object":"SQLServer:SQL Statistics", + "sql_instance":"8cac97ac9b8f", + "value":"63" + }, + { + "counter":"Free Space in tempdb (KB)", + "counter_type":"65792", + "instance":"", + "measurement":"sqlserver_performance", + "object":"SQLServer:Transactions", + "sql_instance":"8cac97ac9b8f", + "value":"61824" + }, + { + "counter":"Version Store Size (KB)", + "counter_type":"65792", + "instance":"", + "measurement":"sqlserver_performance", + "object":"SQLServer:Transactions", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Query", + "counter_type":"65792", + "instance":"User counter 1", + "measurement":"sqlserver_performance", + "object":"SQLServer:User Settable", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Query", + "counter_type":"65792", + "instance":"User counter 10", + "measurement":"sqlserver_performance", + "object":"SQLServer:User Settable", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Query", + "counter_type":"65792", + "instance":"User counter 2", + "measurement":"sqlserver_performance", + "object":"SQLServer:User Settable", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Query", + "counter_type":"65792", + "instance":"User counter 3", + "measurement":"sqlserver_performance", + "object":"SQLServer:User Settable", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Query", + "counter_type":"65792", + "instance":"User counter 4", + "measurement":"sqlserver_performance", + "object":"SQLServer:User Settable", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Query", + "counter_type":"65792", + "instance":"User counter 5", + "measurement":"sqlserver_performance", + "object":"SQLServer:User Settable", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Query", + "counter_type":"65792", + "instance":"User counter 6", + "measurement":"sqlserver_performance", + "object":"SQLServer:User Settable", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Query", + "counter_type":"65792", + "instance":"User counter 7", + "measurement":"sqlserver_performance", + "object":"SQLServer:User Settable", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Query", + "counter_type":"65792", + "instance":"User counter 8", + "measurement":"sqlserver_performance", + "object":"SQLServer:User Settable", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Query", + "counter_type":"65792", + "instance":"User counter 9", + "measurement":"sqlserver_performance", + "object":"SQLServer:User Settable", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Blocked tasks", + "counter_type":"65792", + "instance":"default", + "measurement":"sqlserver_performance", + "object":"SQLServer:Workload Group Stats", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"CPU usage %", + "counter_type":"537003264", + "instance":"default", + "measurement":"sqlserver_performance", + "object":"SQLServer:Workload Group Stats", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Queued requests", + "counter_type":"65792", + "instance":"default", + "measurement":"sqlserver_performance", + "object":"SQLServer:Workload Group Stats", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Requests completed/sec", + "counter_type":"65792", + "instance":"default", + "measurement":"sqlserver_performance", + "object":"SQLServer:Workload Group Stats", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Requests completed/sec", + "counter_type":"65792", + "instance":"internal", + "measurement":"sqlserver_performance", + "object":"SQLServer:Workload Group Stats", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Queued requests", + "counter_type":"65792", + "instance":"internal", + "measurement":"sqlserver_performance", + "object":"SQLServer:Workload Group Stats", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"CPU usage %", + "counter_type":"537003264", + "instance":"internal", + "measurement":"sqlserver_performance", + "object":"SQLServer:Workload Group Stats", + "sql_instance":"8cac97ac9b8f", + "value":"0" + }, + { + "counter":"Blocked tasks", + "counter_type":"65792", + "instance":"internal", + "measurement":"sqlserver_performance", + "object":"SQLServer:Workload Group Stats", + "sql_instance":"8cac97ac9b8f", + "value":"0" + } +] diff --git a/receiver/sqlserverreceiver/testdata/perfCounterQueryWithInstanceName.txt b/receiver/sqlserverreceiver/testdata/perfCounterQueryWithInstanceName.txt new file mode 100644 index 000000000000..7e03e7319dd8 --- /dev/null +++ b/receiver/sqlserverreceiver/testdata/perfCounterQueryWithInstanceName.txt @@ -0,0 +1,165 @@ + +SET DEADLOCK_PRIORITY -10; +IF SERVERPROPERTY('EngineEdition') NOT IN (2,3,4) BEGIN /*NOT IN Standard,Enterprise,Express*/ + DECLARE @ErrorMessage AS nvarchar(500) = 'Connection string Server:'+ @@ServerName + ',Database:' + DB_NAME() +' is not a SQL Server Standard, Enterprise or Express. This query is only supported on these editions.'; + RAISERROR (@ErrorMessage,11,1) + RETURN +END + +DECLARE + @SqlStatement AS nvarchar(max) + ,@MajorMinorVersion AS int = CAST(PARSENAME(CAST(SERVERPROPERTY('ProductVersion') AS nvarchar),4) AS int)*100 + CAST(PARSENAME(CAST(SERVERPROPERTY('ProductVersion') AS nvarchar),3) AS int) + +DECLARE @PCounters TABLE +( + [object_name] nvarchar(128) + ,[counter_name] nvarchar(128) + ,[instance_name] nvarchar(128) + ,[cntr_value] bigint + ,[cntr_type] int + PRIMARY KEY([object_name], [counter_name], [instance_name]) +); + +WITH PerfCounters AS ( +SELECT DISTINCT + RTRIM(spi.[object_name]) [object_name] + ,RTRIM(spi.[counter_name]) [counter_name] + ,RTRIM(spi.[instance_name]) AS [instance_name] + ,CAST(spi.[cntr_value] AS bigint) AS [cntr_value] + ,spi.[cntr_type] + FROM sys.dm_os_performance_counters AS spi + WHERE + counter_name IN ( + 'SQL Compilations/sec' + ,'SQL Re-Compilations/sec' + ,'User Connections' + ,'Batch Requests/sec' + ,'Logouts/sec' + ,'Logins/sec' + ,'Processes blocked' + ,'Latch Waits/sec' + ,'Average Latch Wait Time (ms)' + ,'Full Scans/sec' + ,'Index Searches/sec' + ,'Page Splits/sec' + ,'Page lookups/sec' + ,'Page reads/sec' + ,'Page writes/sec' + ,'Readahead pages/sec' + ,'Lazy writes/sec' + ,'Checkpoint pages/sec' + ,'Table Lock Escalations/sec' + ,'Page life expectancy' + ,'Log File(s) Size (KB)' + ,'Log File(s) Used Size (KB)' + ,'Data File(s) Size (KB)' + ,'Transactions/sec' + ,'Write Transactions/sec' + ,'Active Transactions' + ,'Log Growths' + ,'Active Temp Tables' + ,'Logical Connections' + ,'Temp Tables Creation Rate' + ,'Temp Tables For Destruction' + ,'Free Space in tempdb (KB)' + ,'Version Store Size (KB)' + ,'Memory Grants Pending' + ,'Memory Grants Outstanding' + ,'Free list stalls/sec' + ,'Buffer cache hit ratio' + ,'Buffer cache hit ratio base' + ,'Database Pages' + ,'Backup/Restore Throughput/sec' + ,'Total Server Memory (KB)' + ,'Target Server Memory (KB)' + ,'Log Flushes/sec' + ,'Log Flush Wait Time' + ,'Memory broker clerk size' + ,'Log Bytes Flushed/sec' + ,'Bytes Sent to Replica/sec' + ,'Log Send Queue' + ,'Bytes Sent to Transport/sec' + ,'Sends to Replica/sec' + ,'Bytes Sent to Transport/sec' + ,'Sends to Transport/sec' + ,'Bytes Received from Replica/sec' + ,'Receives from Replica/sec' + ,'Flow Control Time (ms/sec)' + ,'Flow Control/sec' + ,'Resent Messages/sec' + ,'Redone Bytes/sec' + ,'XTP Memory Used (KB)' + ,'Transaction Delay' + ,'Log Bytes Received/sec' + ,'Log Apply Pending Queue' + ,'Redone Bytes/sec' + ,'Recovery Queue' + ,'Log Apply Ready Queue' + ,'CPU usage %' + ,'CPU usage % base' + ,'Queued requests' + ,'Requests completed/sec' + ,'Blocked tasks' + ,'Active memory grant amount (KB)' + ,'Disk Read Bytes/sec' + ,'Disk Read IO Throttled/sec' + ,'Disk Read IO/sec' + ,'Disk Write Bytes/sec' + ,'Disk Write IO Throttled/sec' + ,'Disk Write IO/sec' + ,'Used memory (KB)' + ,'Forwarded Records/sec' + ,'Background Writer pages/sec' + ,'Percent Log Used' + ,'Log Send Queue KB' + ,'Redo Queue KB' + ,'Mirrored Write Transactions/sec' + ,'Group Commit Time' + ,'Group Commits/Sec' + ,'Workfiles Created/sec' + ,'Worktables Created/sec' + ,'Distributed Query' + ,'DTC calls' + ,'Query Store CPU usage' + ,'Query Store physical reads' + ,'Query Store logical reads' + ,'Query Store logical writes' + ) OR ( + spi.[object_name] LIKE '%User Settable%' + OR spi.[object_name] LIKE '%SQL Errors%' + OR spi.[object_name] LIKE '%Batch Resp Statistics%' + ) OR ( + spi.[instance_name] IN ('_Total') + AND spi.[counter_name] IN ( + 'Lock Timeouts/sec' + ,'Lock Timeouts (timeout > 0)/sec' + ,'Number of Deadlocks/sec' + ,'Lock Waits/sec' + ,'Latch Waits/sec' + ) + ) +) + +INSERT INTO @PCounters SELECT * FROM PerfCounters; + +SELECT + 'sqlserver_performance' AS [measurement] + ,REPLACE(@@SERVERNAME,'\',':') AS [sql_instance] + ,pc.[object_name] AS [object] + ,pc.[counter_name] AS [counter] + ,CASE pc.[instance_name] WHEN '_Total' THEN 'Total' ELSE ISNULL(pc.[instance_name],'') END AS [instance] + ,CAST(CASE WHEN pc.[cntr_type] = 537003264 AND pc1.[cntr_value] > 0 THEN (pc.[cntr_value] * 1.0) / (pc1.[cntr_value] * 1.0) * 100 ELSE pc.[cntr_value] END AS float(10)) AS [value] + ,CAST(pc.[cntr_type] AS varchar(25)) AS [counter_type] +FROM @PCounters AS pc +LEFT OUTER JOIN @PCounters AS pc1 + ON ( + pc.[counter_name] = REPLACE(pc1.[counter_name],' base','') + OR pc.[counter_name] = REPLACE(pc1.[counter_name],' base',' (ms)') + ) + AND pc.[object_name] = pc1.[object_name] + AND pc.[instance_name] = pc1.[instance_name] + AND pc1.[counter_name] LIKE '%base' +WHERE + pc.[counter_name] NOT LIKE '% base' + AND @@SERVERNAME = 'instanceName' +OPTION(RECOMPILE) diff --git a/receiver/sqlserverreceiver/testdata/perfCounterQueryWithoutInstanceName.txt b/receiver/sqlserverreceiver/testdata/perfCounterQueryWithoutInstanceName.txt new file mode 100644 index 000000000000..0f8e4f7da9d5 --- /dev/null +++ b/receiver/sqlserverreceiver/testdata/perfCounterQueryWithoutInstanceName.txt @@ -0,0 +1,165 @@ + +SET DEADLOCK_PRIORITY -10; +IF SERVERPROPERTY('EngineEdition') NOT IN (2,3,4) BEGIN /*NOT IN Standard,Enterprise,Express*/ + DECLARE @ErrorMessage AS nvarchar(500) = 'Connection string Server:'+ @@ServerName + ',Database:' + DB_NAME() +' is not a SQL Server Standard, Enterprise or Express. This query is only supported on these editions.'; + RAISERROR (@ErrorMessage,11,1) + RETURN +END + +DECLARE + @SqlStatement AS nvarchar(max) + ,@MajorMinorVersion AS int = CAST(PARSENAME(CAST(SERVERPROPERTY('ProductVersion') AS nvarchar),4) AS int)*100 + CAST(PARSENAME(CAST(SERVERPROPERTY('ProductVersion') AS nvarchar),3) AS int) + +DECLARE @PCounters TABLE +( + [object_name] nvarchar(128) + ,[counter_name] nvarchar(128) + ,[instance_name] nvarchar(128) + ,[cntr_value] bigint + ,[cntr_type] int + PRIMARY KEY([object_name], [counter_name], [instance_name]) +); + +WITH PerfCounters AS ( +SELECT DISTINCT + RTRIM(spi.[object_name]) [object_name] + ,RTRIM(spi.[counter_name]) [counter_name] + ,RTRIM(spi.[instance_name]) AS [instance_name] + ,CAST(spi.[cntr_value] AS bigint) AS [cntr_value] + ,spi.[cntr_type] + FROM sys.dm_os_performance_counters AS spi + WHERE + counter_name IN ( + 'SQL Compilations/sec' + ,'SQL Re-Compilations/sec' + ,'User Connections' + ,'Batch Requests/sec' + ,'Logouts/sec' + ,'Logins/sec' + ,'Processes blocked' + ,'Latch Waits/sec' + ,'Average Latch Wait Time (ms)' + ,'Full Scans/sec' + ,'Index Searches/sec' + ,'Page Splits/sec' + ,'Page lookups/sec' + ,'Page reads/sec' + ,'Page writes/sec' + ,'Readahead pages/sec' + ,'Lazy writes/sec' + ,'Checkpoint pages/sec' + ,'Table Lock Escalations/sec' + ,'Page life expectancy' + ,'Log File(s) Size (KB)' + ,'Log File(s) Used Size (KB)' + ,'Data File(s) Size (KB)' + ,'Transactions/sec' + ,'Write Transactions/sec' + ,'Active Transactions' + ,'Log Growths' + ,'Active Temp Tables' + ,'Logical Connections' + ,'Temp Tables Creation Rate' + ,'Temp Tables For Destruction' + ,'Free Space in tempdb (KB)' + ,'Version Store Size (KB)' + ,'Memory Grants Pending' + ,'Memory Grants Outstanding' + ,'Free list stalls/sec' + ,'Buffer cache hit ratio' + ,'Buffer cache hit ratio base' + ,'Database Pages' + ,'Backup/Restore Throughput/sec' + ,'Total Server Memory (KB)' + ,'Target Server Memory (KB)' + ,'Log Flushes/sec' + ,'Log Flush Wait Time' + ,'Memory broker clerk size' + ,'Log Bytes Flushed/sec' + ,'Bytes Sent to Replica/sec' + ,'Log Send Queue' + ,'Bytes Sent to Transport/sec' + ,'Sends to Replica/sec' + ,'Bytes Sent to Transport/sec' + ,'Sends to Transport/sec' + ,'Bytes Received from Replica/sec' + ,'Receives from Replica/sec' + ,'Flow Control Time (ms/sec)' + ,'Flow Control/sec' + ,'Resent Messages/sec' + ,'Redone Bytes/sec' + ,'XTP Memory Used (KB)' + ,'Transaction Delay' + ,'Log Bytes Received/sec' + ,'Log Apply Pending Queue' + ,'Redone Bytes/sec' + ,'Recovery Queue' + ,'Log Apply Ready Queue' + ,'CPU usage %' + ,'CPU usage % base' + ,'Queued requests' + ,'Requests completed/sec' + ,'Blocked tasks' + ,'Active memory grant amount (KB)' + ,'Disk Read Bytes/sec' + ,'Disk Read IO Throttled/sec' + ,'Disk Read IO/sec' + ,'Disk Write Bytes/sec' + ,'Disk Write IO Throttled/sec' + ,'Disk Write IO/sec' + ,'Used memory (KB)' + ,'Forwarded Records/sec' + ,'Background Writer pages/sec' + ,'Percent Log Used' + ,'Log Send Queue KB' + ,'Redo Queue KB' + ,'Mirrored Write Transactions/sec' + ,'Group Commit Time' + ,'Group Commits/Sec' + ,'Workfiles Created/sec' + ,'Worktables Created/sec' + ,'Distributed Query' + ,'DTC calls' + ,'Query Store CPU usage' + ,'Query Store physical reads' + ,'Query Store logical reads' + ,'Query Store logical writes' + ) OR ( + spi.[object_name] LIKE '%User Settable%' + OR spi.[object_name] LIKE '%SQL Errors%' + OR spi.[object_name] LIKE '%Batch Resp Statistics%' + ) OR ( + spi.[instance_name] IN ('_Total') + AND spi.[counter_name] IN ( + 'Lock Timeouts/sec' + ,'Lock Timeouts (timeout > 0)/sec' + ,'Number of Deadlocks/sec' + ,'Lock Waits/sec' + ,'Latch Waits/sec' + ) + ) +) + +INSERT INTO @PCounters SELECT * FROM PerfCounters; + +SELECT + 'sqlserver_performance' AS [measurement] + ,REPLACE(@@SERVERNAME,'\',':') AS [sql_instance] + ,pc.[object_name] AS [object] + ,pc.[counter_name] AS [counter] + ,CASE pc.[instance_name] WHEN '_Total' THEN 'Total' ELSE ISNULL(pc.[instance_name],'') END AS [instance] + ,CAST(CASE WHEN pc.[cntr_type] = 537003264 AND pc1.[cntr_value] > 0 THEN (pc.[cntr_value] * 1.0) / (pc1.[cntr_value] * 1.0) * 100 ELSE pc.[cntr_value] END AS float(10)) AS [value] + ,CAST(pc.[cntr_type] AS varchar(25)) AS [counter_type] +FROM @PCounters AS pc +LEFT OUTER JOIN @PCounters AS pc1 + ON ( + pc.[counter_name] = REPLACE(pc1.[counter_name],' base','') + OR pc.[counter_name] = REPLACE(pc1.[counter_name],' base',' (ms)') + ) + AND pc.[object_name] = pc1.[object_name] + AND pc.[instance_name] = pc1.[instance_name] + AND pc1.[counter_name] LIKE '%base' +WHERE + pc.[counter_name] NOT LIKE '% base' + +OPTION(RECOMPILE)