SQLServer
SQL Server Collector collects SQL Server waitstats, database_io and other related metrics.
Configuration¶
SQL Server version >= 2008, tested version:
- 2017
- 2019
- 2022
Prerequisites¶
-
SQL Server version >= 2019
-
Create a user:
Linux、Windows:
USE master;
GO
CREATE LOGIN [datakit] WITH PASSWORD = N'yourpassword';
GO
GRANT VIEW SERVER STATE TO [datakit];
GO
GRANT VIEW ANY DEFINITION TO [datakit];
GO
Aliyun RDS SQL Server:
Collector Configuration¶
Go to the conf.d/samples directory under the DataKit installation directory, copy sqlserver.conf.sample and name it sqlserver.conf. Examples are as follows:
[[inputs.sqlserver]]
## your sqlserver host ,example ip:port
host = ""
## your sqlserver user,password
user = ""
password = ""
## Instance name. If not specified, a connection to the default instance is made.
instance_name = ""
## Database name to query. Default is master.
database = "master"
## by default, support TLS 1.2 and above.
## set to true if server side uses TLS 1.0 or TLS 1.1
allow_tls10 = false
## connection timeout default: 30s
connect_timeout = "30s"
## Metric name in metric_exclude_list will not be collected.
metric_exclude_list = [""]
## parameters to be added to the connection string
## Examples:
## "encrypt=disable"
## "certificate=/path/to/cert.pem"
## reference: https://github.com/microsoft/go-mssqldb?tab=readme-ov-file#connection-parameters-and-dsn
#
# connection_parameters = "encrypt=disable"
## (optional) collection interval, default is 10s
interval = "10s"
## Set true to enable election
election = true
## v2+ override all measurement names to "sqlserver_metric", default: v2
## If you want to use the old metric set, you can change it to "v1"
measurement_version = "v2"
## configure db_filter to filter out metrics from certain databases according to their database_name tag.
## If leave blank, no metric from any database is filtered out.
# db_filter = ["some_db_instance_name", "other_db_instance_name"]
## collect object
[inputs.sqlserver.object]
# Set true to enable collecting objects
enabled = true
# interval to collect sqlserver object which will be greater than collection interval
interval = "600s"
## Database Monitoring (DBM) configuration
## DBM provides deep visibility into database performance by collecting query metrics, activity, and execution plans
[inputs.sqlserver.dbm]
# Set true to enable DBM metrics collection
enabled = false
# Maximum number of characters to collect from stored procedures (default: 500)
stored_procedure_characters_limit = 500
## Config DBM metric (query metrics)
## Collects cumulative execution statistics of SQL queries aggregated by query signature, query plan hash, and database
[inputs.sqlserver.dbm.metric]
# Set true to enable collecting query metrics
enabled = true
# Collection interval for query metrics (default: 60s)
collection_interval = "60s"
# Maximum number of rows to collect from sys.dm_exec_query_stats (default: 10000)
# This limits the initial query result size before aggregation
dm_exec_query_stats_row_limit = 10000
# Maximum number of queries to report per collection interval (default: 500)
# Only the top N queries (sorted by derivative elapsed time) will be reported as metrics
max_queries = 500
# Lookback window in seconds for filtering queries (default: 300)
# Only queries that executed within this time window (based on last_execution_time + last_elapsed_time) will be collected
lookback_window = 300
# Enable plan collection (default: true)
plan_enabled = true
# Plan object cache TTL (default: 1h)
plan_cache_ttl = "1h"
# Maximum runtime in seconds for plan collection (default: 30)
# If collection takes longer than this, plan collection will be skipped
max_run_time = 30
## Config DBM activity (current active queries)
## Collects information about currently executing queries and active sessions
[inputs.sqlserver.dbm.activity]
# Set true to enable collecting active query information
enabled = true
# Collection interval for activity metrics (default: 10s)
collection_interval = "10s"
# Maximum number of rows to collect from sys.dm_exec_sessions (default: 1000)
dm_exec_sessions_row_limit = 1000
## Run a custom SQL query and collect corresponding metrics.
#
# [[inputs.sqlserver.custom_queries]]
# sql = '''
# select counter_name,cntr_type,cntr_value
# from sys.dm_os_performance_counters
# '''
# metric = "sqlserver_custom_stat"
# tags = ["counter_name","cntr_type"]
# interval = "10s"
# fields = ["cntr_value"]
# [inputs.sqlserver.log]
# files = []
# #grok pipeline script path
# pipeline = "sqlserver.p"
[inputs.sqlserver.tags]
# some_tag = "some_value"
# more_tag = "some_other_value"
After configuration, restart DataKit.
The collector can now be turned on by ConfigMap Injection Collector Configuration.
Log Collector Configuration¶
Note
DataKit must be installed on the host where SQLServer is running.
To collect SQL Server logs, enable files in sqlserver.conf and write to the absolute path of the SQL Server log file. For example:
When log collection is turned on, a log with a log (aka source) ofsqlserver is collected.
Database Monitoring (DBM)¶
Database Monitoring (DBM) provides deep visibility into SQL Server database performance by collecting query metrics, activity sessions, and execution plans to help analyze and optimize database performance.
Enable DBM¶
[inputs.sqlserver.dbm]
# Enable DBM feature (default: false)
enabled = true
# Maximum number of characters to collect from stored procedures (default: 500)
stored_procedure_characters_limit = 500
Query Metrics¶
Collects cumulative execution statistics of SQL queries aggregated by query signature, query plan hash, and database. Contains execution count, CPU time, logical reads, physical reads, wait time, etc. Reflects actual query execution through derivative metrics (differences between two collections).
Note: Only queries that appear in two consecutive collection windows will report metrics. Queries collected for the first time are only used as a baseline and will not report metrics.
[inputs.sqlserver.dbm.metric]
# Enable query metrics collection (default: true)
enabled = true
# Collection interval (default: 60s)
collection_interval = "60s"
# Maximum number of rows to collect from sys.dm_exec_query_stats (default: 10000)
# This limits the initial query result size before aggregation
dm_exec_query_stats_row_limit = 10000
# Maximum number of queries to report per collection interval (default: 250)
# Only the top N queries (sorted by derivative elapsed time) will be reported as metrics
max_queries = 250
# Lookback window in seconds for filtering queries (default: 120)
# Only queries that executed within this time window (based on last_execution_time + last_elapsed_time) will be collected
lookback_window = 120
# Enable plan collection (default: true)
plan_enabled = true
# Plan object cache TTL (default: 1h)
plan_cache_ttl = "1h"
# Maximum runtime in seconds for plan collection (default: 30)
# If collection takes longer than this, plan collection will be skipped
max_run_time = 30
Execution Plans: When plan_enabled = true, execution plans will also be collected.
Activity Queries¶
Collects information about currently executing queries and active sessions. Records session status, wait events, blocking information, SQL text (obfuscated), etc., used for real-time monitoring of current database activity.
Session Metrics: Session metrics are automatically generated based on activity query data.
Connection Metrics: Independently queries database connection information, aggregating connection count by dimensions such as username, status, database.
[inputs.sqlserver.dbm.activity]
# Enable active query information collection (default: true)
enabled = true
# Collection interval for activity metrics (default: 10s)
collection_interval = "10s"
# Maximum number of rows to collect from sys.dm_exec_sessions (default: 1000)
dm_exec_sessions_row_limit = 1000
Metrics¶
For all of the following data collections, the global election tags will be added automatically, we can add extra tags in [inputs.sqlserver.tags] if needed:
sqlserver_metric¶
Metric set including SQL Server server, performance, wait stats, database IO, schedulers, volume space, database size/files/backup, and DBM (metric/session/connection) statistics, unified in v2
| Tags & Fields | Description |
|---|---|
| connection_status ( tag) |
Connection status from SQL Server sys.dm_exec_sessions: running, sleeping, etc. |
| counter_instance ( tag) |
Name of the specific instance of the counter, for example a database, process, wait type, or resource pool. |
| counter_name ( tag) |
Name of the counter. To get more information about a counter, this is the name of the topic to select from the list of counters in Use SQL Server Objects. |
| counter_type ( tag) |
Type of the counter |
| cpu_id ( tag) |
CPU ID assigned to the scheduler. |
| database_name ( tag) |
The name of the database |
| file_id ( tag) |
ID of the file within database |
| file_type ( tag) |
Description of the file type, ROWS/LOG/FILESTREAM/FULLTEXT (Full-text catalogs earlier than SQL Server 2008.) |
| file_type_code ( tag) |
File type code: 0 = Rows, 1 = Log, 2 = File-Stream, 3 = Identified for informational purposes only, 4 = Full-text |
| logical_filename ( tag) |
Logical name of the file in the database |
| object_name ( tag) |
Category to which this counter belongs. |
| physical_filename ( tag) |
Operating-system file name. |
| physical_name ( tag) |
Operating-system file name |
| procedure_name ( tag) |
The name of the stored procedure in the format 'schema_name.procedure_name' (if applicable) |
| query_hash ( tag) |
The binary hash value of the query generated by SQL Server |
| query_plan_hash ( tag) |
The binary hash value of the query execution plan generated by SQL Server |
| query_signature ( tag) |
Hash signature generated from database_name:procedure_name:query_hash to link metrics and objects |
| scheduler_id ( tag) |
ID of the scheduler. All schedulers that are used to run regular queries have ID numbers less than 1048576. Those schedulers that have IDs greater than or equal to 1048576 are used internally by SQL Server, such as the dedicated administrator connection scheduler. Is not nullable. |
| schema_name ( tag) |
The schema name of the stored procedure (if applicable) |
| server ( tag) |
The address of the server. The value is host:port |
| session_status ( tag) |
Session status: active (has active request), idle (sleeping session), blocked (being blocked) |
| sqlserver_host ( tag) |
Host name which installed SQLServer |
| state ( tag) |
Database file state: 0 = Online, 1 = Restoring, 2 = Recovering, 3 = Recovery_Pending, 4 = Suspect, 5 = Unknown, 6 = Offline, 7 = Defunct |
| state_desc ( tag) |
Description of the file state |
| user_name ( tag) |
The name of the database user |
| volume_mount_point ( tag) |
Mount point at which the volume is rooted. Can return an empty string. Returns null on Linux operating system. |
| wait_category ( tag) |
Wait category info (e.g., Other Disk IO, Network IO, Parallelism, SQL CLR, Service Broker, etc.) |
| wait_group ( tag) |
Datakit unified wait group: Lock, I/O, Concurrency, Memory, Network, CPU, Commit/Log, Other. |
| wait_type ( tag) |
Name of the wait type. For more information, see Types of Waits, later in this topic |
| active_transactions | Number of active transactions across all databases on the SQL Server instance. Type: int | (count) Unit: count Tagged by: counter_instance, counter_name, counter_type, object_name |
| active_workers_count | Number of workers that are active. An active worker is never preemptive, must have an associated task, and is either running, runnable, or suspended. Is not nullable. Type: int | (count) Unit: count Tagged by: cpu_id, scheduler_id |
| auto_param_attempts | Number of auto-parameterization attempts per second. Type: int | (count) Unit: count Tagged by: counter_instance, counter_name, counter_type, object_name |
| avg_elapsed_time | The average elapsed time (microseconds) per query execution during the collection interval (calculated from delta_elapsed_time / delta_execution_count). Type: int | (gauge) Unit: time,μs Tagged by: database_name, procedure_name, query_hash, query_plan_hash, query_signature, schema_name |
| backup_count | The total count of successful backups made for a database Type: int | (gauge) Unit: count Tagged by: database_name |
| backup_restore_throughput | Read/write throughput for backup and restore operations of a database per second. Type: int | (count) Unit: count Tagged by: counter_instance, counter_name, counter_type, object_name |
| batch_requests | The number of batch requests per second. Type: int | (count) Unit: count Tagged by: counter_instance, counter_name, counter_type, object_name |
| buffer_cache_hit_ratio | The ratio of data pages found and read from the buffer cache over all data page requests. Type: float | (gauge) Unit: percent,percent Tagged by: counter_instance, counter_name, counter_type, object_name |
| cache_object_counts | Number of cache objects in the cache. Type: int | (count) Unit: count Tagged by: counter_instance, counter_name, counter_type, object_name |
| cache_pages | Number of 8-kilobyte (KB) pages used by cache objects. Type: int | (count) Unit: count Tagged by: counter_instance, counter_name, counter_type, object_name |
| checkpoint_pages | The number of pages flushed to disk per second by a checkpoint or other operation that require all dirty pages to be flushed. Type: int | (count) Unit: count Tagged by: counter_instance, counter_name, counter_type, object_name |
| cntr_value | Current value of the counter Type: int | (count) Unit: count Tagged by: counter_instance, counter_name, counter_type, object_name |
| committed_memory | The amount of memory committed to the memory manager. Version > 2008 Type: int | (gauge) Unit: digital,B |
| connection_count | Number of user connections in this dimension group Type: int | (gauge) Unit: count Tagged by: connection_status, database_name, user_name |
| connection_memory | Specifies the total amount of dynamic memory the server is using for maintaining connections. Type: int | (gauge) Unit: digital,KB Tagged by: counter_instance, counter_name, counter_type, object_name |
| context_switches_count | Number of context switches that have occurred on this scheduler Type: int | (count) Unit: count Tagged by: cpu_id, scheduler_id |
| cpu_count | Specifies the number of logical CPUs on the system. Not nullable Type: int | (count) Unit: count |
| current_tasks_count | Number of current tasks that are associated with this scheduler. Type: int | (count) Unit: count Tagged by: cpu_id, scheduler_id |
| current_workers_count | Number of workers that are associated with this scheduler. This count includes workers that are not assigned any task. Is not nullable. Type: int | (count) Unit: count Tagged by: cpu_id, scheduler_id |
| data_size | The size of file of Rows Type: float | (gauge) Unit: digital,MB Tagged by: database_name |
| database_cache_memory | Specifies the amount of memory the server is currently using for the database pages cache. Type: int | (gauge) Unit: digital,KB Tagged by: counter_instance, counter_name, counter_type, object_name |
| db_offline | Num of database state in offline Type: int | (count) Unit: count |
| db_online | Num of database state in online Type: int | (count) Unit: count |
| db_recovering | Num of database state in recovering Type: int | (count) Unit: count |
| db_recovery_pending | Num of database state in recovery_pending Type: int | (count) Unit: count |
| db_restoring | Num of database state in restoring Type: int | (count) Unit: count |
| db_suspect | Num of database state in suspect Type: int | (count) Unit: count |
| deadlocks | Number of lock requests per second that resulted in a deadlock. Type: int | (count) Unit: count Tagged by: counter_instance, counter_name, counter_type, object_name |
| delta_clr_time | The time (microseconds) spent inside CLR during the collection interval (delta value). Type: int | (count) Unit: time,μs Tagged by: database_name, procedure_name, query_hash, query_plan_hash, query_signature, schema_name |
| delta_columnstore_segment_reads | The number of columnstore segments read during the collection interval (delta value). Type: int | (count) Unit: count Tagged by: database_name, procedure_name, query_hash, query_plan_hash, query_signature, schema_name |
| delta_columnstore_segment_skips | The number of columnstore segments skipped during the collection interval (delta value). Type: int | (count) Unit: count Tagged by: database_name, procedure_name, query_hash, query_plan_hash, query_signature, schema_name |
| delta_dop | The degree of parallelism used during the collection interval (delta value). Type: int | (count) Unit: count Tagged by: database_name, procedure_name, query_hash, query_plan_hash, query_signature, schema_name |
| delta_elapsed_time | The elapsed time (microseconds) for query executions during the collection interval (delta value). Type: int | (count) Unit: time,μs Tagged by: database_name, procedure_name, query_hash, query_plan_hash, query_signature, schema_name |
| delta_execution_count | The number of times the query was executed during the collection interval (delta value). Type: int | (count) Unit: count Tagged by: database_name, procedure_name, query_hash, query_plan_hash, query_signature, schema_name |
| delta_grant_kb | The amount of memory granted (KB) during the collection interval (delta value). Type: int | (count) Unit: digital,KB Tagged by: database_name, procedure_name, query_hash, query_plan_hash, query_signature, schema_name |
| delta_ideal_grant_kb | The ideal amount of memory (KB) that should have been granted during the collection interval (delta value). Type: int | (count) Unit: digital,KB Tagged by: database_name, procedure_name, query_hash, query_plan_hash, query_signature, schema_name |
| delta_logical_writes | The number of logical writes performed during the collection interval (delta value). Type: int | (count) Unit: count Tagged by: database_name, procedure_name, query_hash, query_plan_hash, query_signature, schema_name |
| delta_physical_reads | The number of physical reads performed during the collection interval (delta value). Type: int | (count) Unit: count Tagged by: database_name, procedure_name, query_hash, query_plan_hash, query_signature, schema_name |
| delta_query_logical_reads | The number of logical reads performed during the collection interval (delta value). Type: int | (count) Unit: count Tagged by: database_name, procedure_name, query_hash, query_plan_hash, query_signature, schema_name |
| delta_reserved_threads | The number of reserved threads used during the collection interval (delta value). Type: int | (count) Unit: count Tagged by: database_name, procedure_name, query_hash, query_plan_hash, query_signature, schema_name |
| delta_rows | The number of rows returned during the collection interval (delta value). Type: int | (count) Unit: count Tagged by: database_name, procedure_name, query_hash, query_plan_hash, query_signature, schema_name |
| delta_spills | The number of pages spilled to disk during the collection interval (delta value). Type: int | (count) Unit: count Tagged by: database_name, procedure_name, query_hash, query_plan_hash, query_signature, schema_name |
| delta_used_grant_kb | The amount of granted memory actually used (KB) during the collection interval (delta value). Type: int | (count) Unit: digital,KB Tagged by: database_name, procedure_name, query_hash, query_plan_hash, query_signature, schema_name |
| delta_used_threads | The number of used threads during the collection interval (delta value). Type: int | (count) Unit: count Tagged by: database_name, procedure_name, query_hash, query_plan_hash, query_signature, schema_name |
| delta_worker_time | The CPU time (microseconds) consumed by query executions during the collection interval (delta value). Type: int | (count) Unit: time,μs Tagged by: database_name, procedure_name, query_hash, query_plan_hash, query_signature, schema_name |
| failed_auto_params | Number of failed auto-parameterization attempts per second. Type: int | (count) Unit: count Tagged by: counter_instance, counter_name, counter_type, object_name |
| flow_control | Number of times flow-control initiated in the last second. Flow Control Time (ms/sec) divided by Flow Control/sec is the average time per wait. Type: int | (count) Unit: count Tagged by: counter_instance, counter_name, counter_type, object_name |
| full_scans | Number of unrestricted full scans per second. These can be either base-table or full-index scans. Type: int | (count) Unit: count Tagged by: counter_instance, counter_name, counter_type, object_name |
| granted_workspace_memory | Specifies the total amount of memory currently granted to executing processes, such as hash, sort, bulk copy, and index creation operations. Type: int | (gauge) Unit: digital,KB Tagged by: counter_instance, counter_name, counter_type, object_name |
| is_idle | Scheduler is idle. No workers are currently running Type: bool | (gauge) Unit: N/A Tagged by: cpu_id, scheduler_id |
| is_online | If SQL Server is configured to use only some of the available processors on the server, this configuration can mean that some schedulers are mapped to processors that are not in the affinity mask. If that is the case, this column returns 0. This value means that the scheduler is not being used to process queries or batches. Type: bool | (gauge) Unit: N/A Tagged by: cpu_id, scheduler_id |
| latch_waits | Number of latch requests that could not be granted immediately. Type: int | (count) Unit: count Tagged by: counter_instance, counter_name, counter_type, object_name |
| load_factor | Internal value that indicates the perceived load on this scheduler Type: int | (count) Unit: count Tagged by: cpu_id, scheduler_id |
| lock_memory | Specifies the total amount of dynamic memory the server is using for locks. Type: int | (gauge) Unit: digital,KB Tagged by: counter_instance, counter_name, counter_type, object_name |
| lock_waits | The number of times per second that SQL Server is unable to retain a lock right away for a resource. Type: int | (count) Unit: count Tagged by: counter_instance, counter_name, counter_type, object_name |
| log_bytes_flushed | Total number of log bytes flushed. Type: int | (gauge) Unit: digital,B Tagged by: counter_instance, counter_name, counter_type, object_name |
| log_flush_wait_time | Total wait time (in milliseconds) to flush the log. On an Always On secondary database, this value indicates the wait time for log records to be hardened to disk. Type: int | (gauge) Unit: time,ms Tagged by: counter_instance, counter_name, counter_type, object_name |
| log_flushes | Number of log flushes per second. Type: int | (count) Unit: count Tagged by: counter_instance, counter_name, counter_type, object_name |
| log_pool_memory | Total amount of dynamic memory the server is using for Log Pool. Type: int | (gauge) Unit: digital,KB Tagged by: counter_instance, counter_name, counter_type, object_name |
| log_size | The size of file of Log Type: float | (gauge) Unit: digital,MB Tagged by: database_name |
| longest_transaction_running_time | The time (in seconds) that the oldest active transaction has been running. Only works if database is under read committed snapshot isolation level. Type: int | (gauge) Unit: time,ms Tagged by: counter_instance, counter_name, counter_type, object_name |
| max_wait_time_ms | Maximum wait time on this wait type. Type: int | (gauge) Unit: time,ms Tagged by: wait_category, wait_type |
| memory_grants_outstanding | Specifies the total number of processes that have successfully acquired a workspace memory grant. Type: int | (count) Unit: count Tagged by: counter_instance, counter_name, counter_type, object_name |
| memory_grants_pending | Specifies the total number of processes waiting for a workspace memory grant. Type: int | (count) Unit: count Tagged by: counter_instance, counter_name, counter_type, object_name |
| optimizer_memory | Specifies the total amount of dynamic memory the server is using for query optimization. Type: int | (gauge) Unit: digital,KB Tagged by: counter_instance, counter_name, counter_type, object_name |
| page_life_expectancy | Duration that a page resides in the buffer pool. Type: int | (gauge) Unit: time,ms Tagged by: counter_instance, counter_name, counter_type, object_name |
| page_reads | Indicates the number of physical database page reads that are issued per second. This statistic displays the total number of physical page reads across all databases. Type: int | (count) Unit: count Tagged by: counter_instance, counter_name, counter_type, object_name |
| page_splits | The number of page splits per second. Type: int | (count) Unit: count Tagged by: counter_instance, counter_name, counter_type, object_name |
| page_writes | Indicates the number of physical database page writes that are issued per second. Type: int | (count) Unit: count Tagged by: counter_instance, counter_name, counter_type, object_name |
| pending_disk_io_count | Number of pending I/Os that are waiting to be completed. Type: int | (count) Unit: count Tagged by: cpu_id, scheduler_id |
| physical_memory | Total physical memory on the machine. Version > 2008 Type: int | (gauge) Unit: digital,B |
| preemptive_switches_count | Number of times that workers on this scheduler have switched to the preemptive mode Type: int | (count) Unit: count Tagged by: cpu_id, scheduler_id |
| processes_blocked | The number of processes blocked. Type: int | (count) Unit: count Tagged by: counter_instance, counter_name, counter_type, object_name |
| read_bytes | Total number of bytes read on this file Type: int | (gauge) Unit: digital,B Tagged by: database_name, file_type, logical_filename, physical_filename |
| read_latency_ms | Total time, in milliseconds, that the users waited for reads issued on the file. Type: int | (gauge) Unit: time,ms Tagged by: database_name, file_type, logical_filename, physical_filename |
| reads | Number of reads issued on the file. Type: int | (count) Unit: count Tagged by: database_name, file_type, logical_filename, physical_filename |
| resource_wait_ms | wait_time_ms-signal_wait_time_ms Type: int | (gauge) Unit: time,ms Tagged by: wait_category, wait_type |
| rg_read_stall_ms | Does not apply to:: SQL Server 2008 through SQL Server 2012 (11.x).Total IO latency introduced by IO resource governance for reads Type: int | (gauge) Unit: time,ms Tagged by: database_name, file_type, logical_filename, physical_filename |
| rg_write_stall_ms | Does not apply to:: SQL Server 2008 through SQL Server 2012 (11.x).Total IO latency introduced by IO resource governance for writes. Is not nullable. Type: int | (gauge) Unit: time,ms Tagged by: database_name, file_type, logical_filename, physical_filename |
| runnable_tasks_count | Number of workers, with tasks assigned to them, that are waiting to be scheduled on the runnable queue. Type: int | (count) Unit: count Tagged by: cpu_id, scheduler_id |
| safe_auto_params | Number of safe auto-parameterization attempts per second. Type: int | (count) Unit: count Tagged by: counter_instance, counter_name, counter_type, object_name |
| server_memory | Memory used Type: int | (gauge) Unit: digital,B |
| session_blocked_count | Number of sessions that are being blocked Type: int | (gauge) Unit: count Tagged by: database_name, session_status, user_name, wait_group |
| session_blocking_count | Number of sessions that are blocking other sessions Type: int | (gauge) Unit: count Tagged by: database_name, session_status, user_name, wait_group |
| session_group_count | Number of sessions in this dimension group Type: int | (gauge) Unit: count Tagged by: database_name, session_status, user_name, wait_group |
| session_max_elapsed_time | Maximum elapsed time among active sessions in this group (milliseconds). Note: Only active sessions have this data. Type: int | (gauge) Unit: time,ms Tagged by: database_name, session_status, user_name, wait_group |
| session_total_cpu_time | Total CPU time consumed by active sessions in this group (milliseconds). Note: Only active sessions have this data. Type: int | (gauge) Unit: time,ms Tagged by: database_name, session_status, user_name, wait_group |
| session_total_elapsed_time | Total elapsed time for active sessions in this group (milliseconds). Note: Only active sessions have this data. Type: int | (gauge) Unit: time,ms Tagged by: database_name, session_status, user_name, wait_group |
| session_total_logical_reads | Total number of logical reads by active sessions in this group. Note: Only active sessions have this data. Type: int | (gauge) Unit: count Tagged by: database_name, session_status, user_name, wait_group |
| session_total_open_transaction_count | Total number of open transactions across active sessions in this group. Note: Only active sessions have this data. Type: int | (gauge) Unit: count Tagged by: database_name, session_status, user_name, wait_group |
| session_total_reads | Total number of reads by active sessions in this group. Note: Only active sessions have this data. Type: int | (gauge) Unit: count Tagged by: database_name, session_status, user_name, wait_group |
| session_total_wait_time | Total wait time for active sessions in this group (milliseconds). Note: Only active sessions have this data. Type: int | (gauge) Unit: time,ms Tagged by: database_name, session_status, user_name, wait_group |
| session_total_writes | Total number of writes by active sessions in this group. Note: Only active sessions have this data. Type: int | (gauge) Unit: count Tagged by: database_name, session_status, user_name, wait_group |
| signal_wait_time_ms | Difference between the time that the waiting thread was signaled and when it started running Type: int | (gauge) Unit: time,ms Tagged by: wait_category, wait_type |
| size | Current size of the database file Type: int | (gauge) Unit: digital,KB Tagged by: database_name, file_id, file_type_code, physical_name, state, state_desc |
| sql_cache_memory | Specifies the amount of memory the server is using for the dynamic SQL cache. Type: int | (gauge) Unit: digital,KB Tagged by: counter_instance, counter_name, counter_type, object_name |
| sql_compilations | The number of SQL compilations per second. Type: int | (count) Unit: count Tagged by: counter_instance, counter_name, counter_type, object_name |
| sql_re_compilations | The number of SQL re-compilations per second. Type: int | (count) Unit: count Tagged by: counter_instance, counter_name, counter_type, object_name |
| stolen_server_memory | Specifies the amount of memory the server is using for purposes other than database pages. Type: int | (gauge) Unit: digital,KB Tagged by: counter_instance, counter_name, counter_type, object_name |
| target_memory | Amount of memory that can be consumed by the memory manager. When this value is larger than the committed memory, then the memory manager will try to obtain more memory. When it is smaller, the memory manager will try to shrink the amount of memory committed. Version > 2008 Type: int | (gauge) Unit: digital,B |
| total_clr_time | The total time (microseconds) spent inside CLR (cumulative value from SQL Server). Type: int | (gauge) Unit: time,μs Tagged by: database_name, procedure_name, query_hash, query_plan_hash, query_signature, schema_name |
| total_columnstore_segment_reads | The total number of columnstore segments read (cumulative value from SQL Server). Type: int | (gauge) Unit: count Tagged by: database_name, procedure_name, query_hash, query_plan_hash, query_signature, schema_name |
| total_columnstore_segment_skips | The total number of columnstore segments skipped (cumulative value from SQL Server). Type: int | (gauge) Unit: count Tagged by: database_name, procedure_name, query_hash, query_plan_hash, query_signature, schema_name |
| total_cpu_usage_ms | Applies to: SQL Server 2016 (13.x) and laterTotal CPU consumed by this scheduler as reported by non-preemptive workers. Type: int | (gauge) Unit: time,ms Tagged by: cpu_id, scheduler_id |
| total_dop | The total degree of parallelism used (cumulative value from SQL Server). Type: int | (gauge) Unit: count Tagged by: database_name, procedure_name, query_hash, query_plan_hash, query_signature, schema_name |
| total_elapsed_time | The total elapsed time (microseconds) for query executions (cumulative value from SQL Server). Type: int | (gauge) Unit: time,μs Tagged by: database_name, procedure_name, query_hash, query_plan_hash, query_signature, schema_name |
| total_execution_count | The total number of query executions (cumulative value from SQL Server). Type: int | (gauge) Unit: count Tagged by: database_name, procedure_name, query_hash, query_plan_hash, query_signature, schema_name |
| total_grant_kb | The total amount of memory granted (KB) (cumulative value from SQL Server). Type: int | (gauge) Unit: digital,KB Tagged by: database_name, procedure_name, query_hash, query_plan_hash, query_signature, schema_name |
| total_ideal_grant_kb | The total ideal amount of memory (KB) that should have been granted (cumulative value from SQL Server). Type: int | (gauge) Unit: digital,KB Tagged by: database_name, procedure_name, query_hash, query_plan_hash, query_signature, schema_name |
| total_logical_reads | The total number of logical reads (cumulative value from SQL Server). Type: int | (gauge) Unit: count Tagged by: database_name, procedure_name, query_hash, query_plan_hash, query_signature, schema_name |
| total_logical_writes | The total number of logical writes (cumulative value from SQL Server). Type: int | (gauge) Unit: count Tagged by: database_name, procedure_name, query_hash, query_plan_hash, query_signature, schema_name |
| total_physical_reads | The total number of physical reads (cumulative value from SQL Server). Type: int | (gauge) Unit: count Tagged by: database_name, procedure_name, query_hash, query_plan_hash, query_signature, schema_name |
| total_reserved_threads | The total number of reserved threads used (cumulative value from SQL Server). Type: int | (gauge) Unit: count Tagged by: database_name, procedure_name, query_hash, query_plan_hash, query_signature, schema_name |
| total_rows | The total number of rows returned (cumulative value from SQL Server). Type: int | (gauge) Unit: count Tagged by: database_name, procedure_name, query_hash, query_plan_hash, query_signature, schema_name |
| total_scheduler_delay_ms | Applies to: SQL Server 2016 (13.x) and laterThe time between one worker switching out and another one switching in Type: int | (gauge) Unit: time,ms Tagged by: cpu_id, scheduler_id |
| total_server_memory | Specifies the amount of memory the server has committed using the memory manager. Type: int | (gauge) Unit: digital,KB Tagged by: counter_instance, counter_name, counter_type, object_name |
| total_spills | The total number of pages spilled to disk (cumulative value from SQL Server). Type: int | (gauge) Unit: count Tagged by: database_name, procedure_name, query_hash, query_plan_hash, query_signature, schema_name |
| total_used_grant_kb | The total amount of granted memory actually used (KB) (cumulative value from SQL Server). Type: int | (gauge) Unit: digital,KB Tagged by: database_name, procedure_name, query_hash, query_plan_hash, query_signature, schema_name |
| total_used_threads | The total number of used threads (cumulative value from SQL Server). Type: int | (gauge) Unit: count Tagged by: database_name, procedure_name, query_hash, query_plan_hash, query_signature, schema_name |
| total_worker_time | The total CPU time (microseconds) consumed by query executions (cumulative value from SQL Server). Type: int | (gauge) Unit: time,μs Tagged by: database_name, procedure_name, query_hash, query_plan_hash, query_signature, schema_name |
| transaction_delay | Total delay in waiting for unterminated commit acknowledgment for all the current transactions, in milliseconds. Type: int | (count) Unit: count Tagged by: counter_instance, counter_name, counter_type, object_name |
| transactions | Number of transactions started for the SQL Server instance per second. Type: int | (count) Unit: count Tagged by: counter_instance, counter_name, counter_type, object_name |
| uptime | Total time elapsed since the last computer restart Type: int | (gauge) Unit: time,ms |
| user_connections | Number of user connections. Type: int | (count) Unit: count Tagged by: counter_instance, counter_name, counter_type, object_name |
| version_cleanup_rate | The cleanup rate of the version store in tempdb. Type: int | (gauge) Unit: digital,KB Tagged by: counter_instance, counter_name, counter_type, object_name |
| version_generation_rate | The generation rate of the version store in tempdb. Type: int | (gauge) Unit: digital,KB Tagged by: counter_instance, counter_name, counter_type, object_name |
| version_store_size | The size of the version store in tempdb. Type: int | (gauge) Unit: digital,KB Tagged by: counter_instance, counter_name, counter_type, object_name |
| virtual_memory | Amount of virtual memory available to the process in user mode. Version > 2008 Type: int | (gauge) Unit: digital,B |
| volume_available_space_bytes | Available free space on the volume Type: int | (gauge) Unit: digital,B Tagged by: volume_mount_point |
| volume_total_space_bytes | Total size in bytes of the volume Type: int | (gauge) Unit: digital,B Tagged by: volume_mount_point |
| volume_used_space_bytes | Used size in bytes of the volume Type: int | (gauge) Unit: digital,B Tagged by: volume_mount_point |
| wait_time_ms | Total wait time for this wait type in milliseconds. This time is inclusive of signal_wait_time_ms Type: int | (gauge) Unit: time,ms Tagged by: wait_category, wait_type |
| waiting_tasks_count | Number of waits on this wait type. This counter is incremented at the start of each wait. Type: int | (count) Unit: count Tagged by: wait_category, wait_type |
| work_queue_count | Number of tasks in the pending queue. These tasks are waiting for a worker to pick them up Type: int | (count) Unit: count Tagged by: cpu_id, scheduler_id |
| write_bytes | Total number of bytes written to the file Type: int | (gauge) Unit: digital,B Tagged by: database_name, file_type, logical_filename, physical_filename |
| write_latency_ms | Total time, in milliseconds, that users waited for writes to be completed on the file Type: int | (gauge) Unit: time,ms Tagged by: database_name, file_type, logical_filename, physical_filename |
| write_transactions | Number of transactions that wrote to all databases on the SQL Server instance and committed, in the last second. Type: int | (count) Unit: count Tagged by: counter_instance, counter_name, counter_type, object_name |
| writes | Number of writes issued on the file. Type: int | (count) Unit: count Tagged by: database_name, file_type, logical_filename, physical_filename |
| yield_count | Internal value that is used to indicate progress on this scheduler. This value is used by the Scheduler Monitor to determine whether a worker on the scheduler is not yielding to other workers on time. Type: int | (count) Unit: count Tagged by: cpu_id, scheduler_id |
collector¶
| Tags & Fields | Description |
|---|---|
| instance ( tag) |
Server addr of the instance |
| job ( tag) |
Server name of the instance |
| up | Type: int | (gauge) Unit: - |
Object¶
database¶
SQLServer object metrics( Version-1.78.0)
| Tags & Fields | Description |
|---|---|
| database_type ( tag) |
The type of the database. The value is SQLServer |
| host ( tag) |
The hostname of the SQLServer server |
| name ( tag) |
The name of the database. The value is host:port in default |
| port ( tag) |
The port of the SQLServer server |
| server ( tag) |
The server address of the SQLServer server |
| version ( tag) |
The version of the SQLServer server |
| avg_query_time | The average time taken by a query to execute Type: float Unit: timeStamp,usec |
| message | Summary of database information Type: string Unit: - |
| qps | The number of queries executed by the database per second Type: float Unit: gauge |
| tps | The number of transactions executed by the database per second Type: float Unit: gauge |
| uptime | The number of seconds that the server has been up Type: int Unit: time,s |
db_query¶
SQL Server DBM query objects. Each object represents a unique SQL query identified by query_signature, containing the obfuscated SQL text and encryption status.
| Tags & Fields | Description |
|---|---|
| database_name ( tag) |
The name of the database |
| database_type ( tag) |
The type of the database. The value is SQLServer |
| procedure_name ( tag) |
The name of the stored procedure in the format 'schema_name.procedure_name' (if applicable) |
| query_hash ( tag) |
The binary hash value of the query generated by SQL Server |
| query_signature ( tag) |
Hash signature generated from database_name:procedure_name:query_hash to link metrics and objects |
| schema_name ( tag) |
The schema name of the stored procedure (if applicable) |
| server ( tag) |
The server address (host:port) |
| sqlserver_host ( tag) |
Host name which installed SQLServer |
| is_encrypted | Whether the SQL text is encrypted in the database Type: bool | (bool) Unit: - |
| message | The obfuscated/normalized SQL text (full text) Type: string Unit: - |
db_exec_plan¶
SQL Server DBM plan objects. Each object represents a unique execution plan identified by query_signature:query_plan_hash, containing the obfuscated plan content and encryption status.
| Tags & Fields | Description |
|---|---|
| database_name ( tag) |
The name of the database |
| database_type ( tag) |
The type of the database. The value is SQLServer |
| name ( tag) |
Hash signature generated from query_signature:query_plan_hash |
| plan_type ( tag) |
The format of the plan content. The value is XML |
| procedure_name ( tag) |
The name of the stored procedure in the format 'schema_name.procedure_name' (if applicable) |
| query_hash ( tag) |
The binary hash value of the query generated by SQL Server |
| query_plan_hash ( tag) |
The binary hash value of the query execution plan generated by SQL Server |
| query_signature ( tag) |
Hash signature generated from database_name:procedure_name:query_hash to link metrics and objects |
| schema_name ( tag) |
The schema name of the stored procedure (if applicable) |
| server ( tag) |
The server address (host:port) |
| sqlserver_host ( tag) |
Host name which installed SQLServer |
| is_encrypted | Whether the execution plan is encrypted in the database Type: bool | (bool) Unit: - |
| message | The obfuscated/normalized execution plan content (full content) Type: string Unit: - |
| plan_handle | The plan handle of the execution plan Type: string | (string) Unit: - |
| statement_end_offset | The end offset of the statement in the execution plan Type: int | (gauge) Unit: count |
| statement_start_offset | The start offset of the statement in the execution plan Type: int | (gauge) Unit: count |
message Metric Field Structure¶
The basic structure of the message field is as follows:
{
"setting": [ # settings information
{
"name": "recovery interval (min)",
"value": "123",
"value_in_use": "0",
"maximum": "10",
"minimum": "0",
"is_dynamic": true,
"is_advanced": true
}
...
],
"databases": [ # databases information
{
"name": "db1",
"owner_name": "dbo",
"collation": "SQL_Latin1_General_CP1_CI_AS",
"schemas": [
{
"name": "schema1",
"owner_name": "dbo",
"tables": [
{
"name": "table1",
"columns": [], # columns information
"indexes": [], # indexes information
"foreign_keys": [], # foreign keys information
"partitions": { # partitions information
"partition_count": 1
}
}
...
]
}
]
}
...
]
}
setting¶
The data in the setting field is derived from the sys.configurations system view, which contains information about the global variables of the SQL Server instance. For detailed fields, you can refer to the SQL Server documentation.
databases¶
The databases field stores information about all databases on the SQL Server instance. The information for each database is as follows:
| Field Name | Description | Type |
|---|---|---|
name |
The name of the database | string |
owner_name |
The name of the database owner (e.g., dbo) | string |
collation |
The default collation of the database (e.g., SQL_Latin1_General_CP1_CI_AS) | string |
schemas |
A list containing table information | list |
schemas¶
The schemas field stores information about all schemas in the database. The information for each schema is as follows:
| Field Name | Description | Type |
|---|---|---|
name |
The name of the schema | string |
owner_name |
The name of the schema owner (e.g., dbo) | string |
tables |
A list containing table information | list |
The tables field stores information about all tables included in the schema. The information for each table is as follows:
| Field Name | Description | Type |
|---|---|---|
name |
The name of the table | string |
columns |
A list containing column information | list |
indexes |
A list containing index information | list |
foreign_keys |
A list containing foreign key information | list |
partitions |
A dictionary containing partition information | dict |
The tables.columns field stores information about all columns included in the table. The information for each column is as follows:
| Field Name | Description | Type |
|---|---|---|
name |
The name of the column | string |
data_type |
The data type of the column | string |
nullable |
Whether the column allows null values | string |
default |
The default value of the column | string |
The tables.indexes field stores information about all indexes included in the table. The information for each index is as follows:
| Field Name | Description | Type |
|---|---|---|
name |
The name of the index | string |
type |
The type of the index | string |
is_unique |
Whether the index is unique | string |
is_primary_key |
Whether the index is a primary key | string |
column_names |
The names of the columns included in the index | string |
is_disabled |
Whether the index is disabled | string |
is_unique_constraint |
Whether the index is a unique constraint | string |
The tables.foreign_keys field stores information about all foreign keys included in the table. The information for each foreign key is as follows:
| Field Name | Description | Type |
|---|---|---|
foreign_key_name |
The name of the foreign key | string |
referencing_table |
The name of the referencing table | string |
referenced_table |
The name of the referenced table | string |
referencing_columns |
The names of the referencing columns | string |
referenced_columns |
The names of the referenced columns | string |
update_action |
The cascading action for updates | string |
delete_action |
The cascading action for deletions | string |
The tables.partitions field stores the number of all partitions included in the table. The specific field description is as follows:
| Field Name | Description | Type |
|---|---|---|
partition_count |
The number of partitions | number |
Logging¶
Following measurements are collected as logs with the level of info.
sqlserver_lock_row¶
| Tags & Fields | Description |
|---|---|
| server ( tag) |
The address of the server. The value is host:port |
| sqlserver_host ( tag) |
Host name which installed SQLServer |
| blocking_session_id | ID of the session that is blocking the request Type: int | (count) Unit: count |
| cpu_time | CPU time in milliseconds that is used by the request Type: int | (gauge) Unit: time,ms |
| host_name | Name of the client workstation that is specific to a session Type: string | (string) Unit: TODO |
| last_request_end_time | Time of the last completion of a request on the session, in second Type: int | (gauge) Unit: time,ms |
| last_request_start_time | Time at which the last request on the session began, in second Type: int | (gauge) Unit: time,ms |
| logical_reads | Number of logical reads that have been performed by the request Type: int | (count) Unit: count |
| login_name | SQL Server login name under which the session is currently executing Type: string | (string) Unit: TODO |
| memory_usage | Number of 8-KB pages of memory used by this session Type: int | (count) Unit: count |
| message | Text of the SQL query Type: string | (string) Unit: TODO |
| row_count | Number of rows returned on the session up to this point Type: int | (count) Unit: count |
| session_id | ID of the session to which this request is related Type: int | (count) Unit: count |
| session_status | Status of the session Type: string | (string) Unit: TODO |
sqlserver_lock_table¶
| Tags & Fields | Description |
|---|---|
| server ( tag) |
The address of the server. The value is host:port |
| sqlserver_host ( tag) |
Host name which installed SQLServer |
| db_name | Name of the database under which this resource is scoped Type: string | (string) Unit: TODO |
| object_name | Name of the entity in a database with which a resource is associated Type: string | (string) Unit: TODO |
| request_mode | Mode of the request Type: string | (string) Unit: TODO |
| request_session_id | Session ID that currently owns this request Type: int | (count) Unit: count |
| request_status | Current status of this request Type: string | (string) Unit: TODO |
| resource_type | Represents the resource type Type: string | (string) Unit: TODO |
sqlserver_lock_dead¶
| Tags & Fields | Description |
|---|---|
| server ( tag) |
The address of the server. The value is host:port |
| sqlserver_host ( tag) |
Host name which installed SQLServer |
| blocking_object_name | Indicates the name of the object to which this partition belongs Type: string | (string) Unit: TODO |
| blocking_session_id | ID of the session that is blocking the request Type: int | (count) Unit: count |
| blocking_text | Text of the SQL query which is blocking Type: string | (string) Unit: TODO |
| db_name | Name of the database under which this resource is scoped Type: string | (string) Unit: TODO |
| message | Text of the SQL query which is blocking Type: string | (string) Unit: TODO |
| request_mode | Mode of the request Type: string | (string) Unit: TODO |
| request_session_id | Session ID that currently owns this request Type: int | (count) Unit: count |
| requesting_text | Text of the SQL query which is requesting Type: string | (string) Unit: TODO |
| resource_type | Represents the resource type Type: string | (string) Unit: TODO |
sqlserver_logical_io¶
| Tags & Fields | Description |
|---|---|
| server ( tag) |
The address of the server. The value is host:port |
| sqlserver_host ( tag) |
Host name which installed SQLServer |
| avg_logical_io | Average number of logical writes and logical reads Type: int | (count) Unit: count |
| creation_time | The Unix time at which the plan was compiled, in millisecond Type: int | (count) Unit: count |
| execution_count | Number of times that the plan has been executed since it was last compiled Type: int | (count) Unit: count |
| last_execution_time | Last time at which the plan started executing, unix time in millisecond Type: int | (count) Unit: count |
| message | Text of the SQL query Type: string | (string) Unit: TODO |
| total_logical_io | Total number of logical writes and logical reads Type: int | (count) Unit: count |
| total_logical_reads | Total amount of logical reads Type: int | (count) Unit: count |
| total_logical_writes | Total amount of logical writes Type: int | (count) Unit: count |
sqlserver_worker_time¶
| Tags & Fields | Description |
|---|---|
| server ( tag) |
The address of the server. The value is host:port |
| sqlserver_host ( tag) |
Host name which installed SQLServer |
| avg_worker_time | Average amount of CPU time, reported in milliseconds Type: int | (count) Unit: count |
| creation_time | The Unix time at which the plan was compiled, in millisecond Type: int | (count) Unit: count |
| execution_count | Number of times that the plan has been executed since it was last compiled Type: int | (count) Unit: count |
| last_execution_time | Last time at which the plan started executing, unix time in millisecond Type: int | (count) Unit: count |
| message | Text of the SQL query Type: string | (string) Unit: TODO |
| total_worker_time | Total amount of CPU time, reported in milliseconds Type: int | (count) Unit: count |
sqlserver_dbm_activity¶
Collect the currently active queries, session information, wait events, and blocking information.
| Tags & Fields | Description |
|---|---|
| command ( tag) |
The type of command being executed. |
| database_name ( tag) |
The name of the database |
| host_name ( tag) |
The host name of the client |
| procedure_name ( tag) |
The name of the stored procedure in the format 'schema_name.procedure_name' (if applicable) |
| program_name ( tag) |
The name of the client program |
| query_hash ( tag) |
The hash value computed from the query. |
| query_plan_hash ( tag) |
The hash value computed from the query plan. |
| query_signature ( tag) |
Hash signature generated from database_name:procedure_name:query_hash to link metrics and objects |
| request_status ( tag) |
The status of the request. |
| schema_name ( tag) |
The schema name of the stored procedure (if applicable) |
| server ( tag) |
The server address (host:port) |
| session_status ( tag) |
The status of the session. |
| sqlserver_host ( tag) |
Host name which installed SQLServer |
| user_name ( tag) |
The login name of the user |
| wait_group ( tag) |
Datakit unified wait group: Lock, I/O, Concurrency, Memory, Network, CPU, Commit/Log, Other. |
| wait_type ( tag) |
The type of wait. |
| blocking_session_id | The ID of the blocking session. 0 means not blocked. Type: int | (gauge) Unit: count |
| client_address | The client network address Type: string | (string) Unit: N/A |
| client_interface_name | The name of the client interface used by the application (e.g., 'Microsoft JDBC Driver for SQL Server', 'ODBC'). Type: string | (string) Unit: N/A |
| client_port | The client TCP port Type: string | (string) Unit: N/A |
| context_info | The CONTEXT_INFO value for the session. Type: string | (string) Unit: - |
| cpu_time | The CPU time in milliseconds Type: int | (gauge) Unit: time,ms |
| deadlock_priority | The deadlock priority for the session. Type: int | (gauge) Unit: N/A |
| estimated_completion_time | The estimated completion time (milliseconds) for the current operation. Type: int | (gauge) Unit: time,ms |
| is_user_process | Indicates whether the session is a user process (1) or a system process (0). Type: bool | (bool) Unit: - |
| last_request_start_time | The last time a request started in the session. Type: int | (gauge) Unit: time,ms |
| last_wait_type | The last wait type encountered by this request. Type: string | (string) Unit: N/A |
| lock_timeout | The lock timeout period in milliseconds. Type: int | (gauge) Unit: time,ms |
| logical_reads | The number of logical reads Type: int | (gauge) Unit: count |
| message | The text of the normalized SQL text Type: string | (string) Unit: N/A |
| open_transaction_count | The number of open transactions for the session. Type: int | (gauge) Unit: count |
| percent_complete | The percentage of work completed for the current operation. Type: int | (gauge) Unit: count |
| procedure_text | The obfuscated/normalized stored procedure text (if applicable). Type: string | (string) Unit: N/A |
| query_start | The time when the request started executing. Type: string | (string) Unit: N/A |
| reads | The number of reads Type: int | (gauge) Unit: count |
| row_count | The number of rows Type: int | (gauge) Unit: count |
| session_id | The session ID Type: int | (gauge) Unit: count |
| total_elapsed_time | The total elapsed time in milliseconds Type: int | (gauge) Unit: time,ms |
| transaction_id | The ID of the transaction that the request is part of. Type: int | (gauge) Unit: count |
| transaction_isolation_level | The transaction isolation level of the request. Type: int | (gauge) Unit: N/A |
| wait_resource | The resource being waited on Type: string | (string) Unit: N/A |
| wait_time | The wait time in milliseconds Type: int | (gauge) Unit: time,ms |
| writes | The number of writes Type: int | (gauge) Unit: count |
Pipeline for SQLServer logging¶
- SQL Server Common Log Pipeline
Example of common log text:
2021-05-28 10:46:07.78 spid10s 0 transactions rolled back in database 'msdb' (4:0). This is an informational message only. No user action is required
The list of extracted fields are as follows:
| Field Name | Field Value | Description |
|---|---|---|
msg |
spid... | log content |
time |
1622169967780000000 | nanosecond timestamp (as row protocol time) |
origin |
spid10s | source |
status |
info | As the log does not have an explicit field to describe the log level, the default is info. |