SQLServer
SQL Server 采集器采集 SQL Server waitstats、database_io 等相关指标
配置¶
SQL Server 版本 >= 2008, 已测试的版本:
- 2017
- 2019
- 2022
前置条件¶
- 创建用户:
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:
注意事项
注意,执行上述操作需要相应权限的帐号,否则可能会导致用户创建失败或者授权失败。
- 自建的 SQL Server 需要具备 WITH GRANT OPTION、CREATE ANY LOGIN、CREATE ANY USER、ALTER ANY LOGIN 权限的用户,也可以直接使用具有 sysadmin 角色的用户或者 local 用户授权。
- RDS for SQL Server 则需要使用高权限账号进行授权。
采集器配置¶
进入 DataKit 安装目录下的 conf.d/samples 目录,复制 sqlserver.conf.sample 并命名为 sqlserver.conf。示例如下:
[[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"
配置好后,重启 DataKit 即可。
目前可以通过 ConfigMap 方式注入采集器配置来开启采集器。
日志采集配置¶
Note
必须将 DataKit 安装在 SQLServer 所在主机才能采集日志。
如需采集 SQL Server 的日志,可在 sqlserver.conf 中 将 files 打开,并写入 SQL Server 日志文件的绝对路径。比如:
开启日志采集以后,默认会产生日志来源(source)为 sqlserver 的日志。
数据库监控 (DBM)¶
数据库监控(Database Monitoring,DBM)功能提供对 SQL Server 数据库性能的深度可见性,通过收集查询指标、活动会话和执行计划来帮助分析和优化数据库性能。
启用 DBM¶
[inputs.sqlserver.dbm]
# 启用 DBM 功能(默认:false)
enabled = true
# 存储过程字符数限制(默认:500)
stored_procedure_characters_limit = 500
查询指标 (Metric)¶
收集 SQL 查询的累积执行统计信息,按查询签名、执行计划哈希和数据库进行聚合。包含执行次数、CPU 时间、逻辑读取、物理读取、等待时间等,通过计算导数指标(两次采集之间的差值)来反映查询的实际执行情况。
注意:只有连续两个采集窗口都出现的查询才会上报指标。首次采集到的查询仅作为基线,不会上报指标。
[inputs.sqlserver.dbm.metric]
# 启用查询指标采集(默认: true)
enabled = true
# 采集间隔(默认: 60s)
collection_interval = "60s"
# sys.dm_exec_query_stats 查询的最大行数限制(默认: 10000)
# 这限制了聚合前的初始查询结果大小
dm_exec_query_stats_row_limit = 10000
# 每个采集间隔报告的最大查询数(默认: 250)
# 按导数执行时间排序后,只报告前 N 个查询
max_queries = 250
# 查询过滤的回看窗口(秒,默认: 120)
# 只收集在此时间窗口内执行的查询(基于 last_execution_time + last_elapsed_time)
lookback_window = 120
# 启用执行计划采集(默认: true)
plan_enabled = true
# 执行计划对象缓存 TTL(默认: 1h)
plan_cache_ttl = "1h"
# 执行计划采集的最大运行时间(秒,默认: 30)
# 如果采集时间超过此值,将跳过执行计划采集
max_run_time = 30
执行计划 (Plan):当 plan_enabled = true 时,会同时采集执行计划。
活动查询 (Activity)¶
收集当前正在执行的查询和活动会话信息。记录会话状态、等待事件、阻塞信息、SQL 文本(已脱敏)等,用于实时监控数据库的当前活动状态。
会话指标 (Session):基于活动查询数据,会自动生成会话指标。
连接指标 (Connection):独立查询数据库连接信息,按用户名、状态、数据库等维度统计连接数。
[inputs.sqlserver.dbm.activity]
# 启用活动查询信息采集(默认: true)
enabled = true
# 活动指标采集间隔(默认: 10s)
collection_interval = "10s"
# sys.dm_exec_sessions 查询的最大行数限制(默认: 1000)
dm_exec_sessions_row_limit = 1000
指标¶
以下所有数据采集,默认会追加全局选举 tag,也可以在配置中通过 [inputs.sqlserver.tags] 指定其它标签:
sqlserver_metric¶
指标集包含 SQL Server server、performance、wait stats、database IO、schedulers、volume space、database size/files/backup 和 DBM (metric/session/connection) 相关指标,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_instance ( tag) |
SQL Server instance identifier derived from server name |
| 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: - |
对象¶
database¶
SQLServer object metrics( Version-1.78.0)
| Tags & Fields | Description |
|---|---|
| database_instance ( tag) |
SQL Server instance identifier derived from server name |
| database_type ( tag) |
The type of the database. The value is SQLServer |
| host ( tag) |
The hostname of the SQLServer server |
| name ( tag) |
The object identifier. The value is <server>-<database_instance> |
| 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_instance ( tag) |
SQL Server instance identifier derived from server name |
| 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_instance ( tag) |
SQL Server instance identifier derived from server name |
| 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 指标字段结构¶
message 字段基本结构如下:
{
"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¶
setting 字段中的数据来源于 sys.configurations 系统视图,该表包含了 SQL Server 服务器的全局变量信息,详细字段可以参考 SQL Server 文档。
databases¶
databases 字段保存了 SQL Server 服务器上所有数据库的信息,每个数据库的信息如下:
| 字段名 | 描述 | 类型 |
|---|---|---|
name |
数据库名称 | string |
owner_name |
数据库所有者名称(如 dbo) | string |
collation |
数据库默认排序规则(如 SQL_Latin1_General_CP1_CI_AS) | string |
schemas |
包含表信息的列表 | list |
schemas¶
schemas 字段保存了数据库中所有架构的信息,每个架构的信息如下:
| 字段名 | 描述 | 类型 |
|---|---|---|
name |
架构名称 | string |
owner_name |
架构所有者名称(如 dbo) | string |
tables |
包含表信息的列表 | list |
tables 字段保存了架构中包含的所有表的信息,每个表的信息如下:
| 字段名 | 描述 | 类型 |
|---|---|---|
name |
表名称 | string |
columns |
包含列信息的列表 | list |
indexes |
包含索引信息的列表 | list |
foreign_keys |
包含外键信息的列表 | list |
partitions |
包含分区信息的列表 | dict |
tables.columns 字段保存了表包含的所有列的信息,每个列的信息如下:
| 字段名 | 描述 | 类型 |
|---|---|---|
name |
列名称 | string |
data_type |
列数据类型 | string |
nullable |
列是否为空 | string |
default |
列默认值 | string |
tables.indexes 字段保存了表包含的所有索引的信息,每个索引的信息如下:
| 字段名 | 描述 | 类型 |
|---|---|---|
name |
索引名称 | string |
type |
索引类型 | string |
is_unique |
索引是否唯一 | string |
is_primary_key |
索引是否为主键 | string |
column_names |
索引包含的列名称 | string |
is_disabled |
索引是否被禁用 | string |
is_unique_constraint |
索引是否为唯一约束 | string |
tables.foreign_keys 字段保存了表包含的所有外键的信息,每个外键的信息如下:
| 字段名 | 描述 | 类型 |
|---|---|---|
foreign_key_name |
外键名称 | string |
referencing_table |
引用表名称 | string |
referenced_table |
被引用表名称 | string |
referencing_columns |
引用列名称 | string |
referenced_columns |
被引用列名称 | string |
update_action |
更新时的级联操作 | string |
delete_action |
删除时的级联操作 | string |
tables.partitions 字段保存了表包含的所有分区的数量,具体字段描述如下:
| 字段名 | 描述 | 类型 |
|---|---|---|
partition_count |
分区数量 | number |
日志¶
以下指标集均以日志形式收集,所有日志等级均为 info。
sqlserver_lock_row¶
| Tags & Fields | Description |
|---|---|
| database_instance ( tag) |
SQL Server instance identifier derived from server name |
| 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 |
|---|---|
| database_instance ( tag) |
SQL Server instance identifier derived from server name |
| 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 |
|---|---|
| database_instance ( tag) |
SQL Server instance identifier derived from server name |
| 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 |
|---|---|
| database_instance ( tag) |
SQL Server instance identifier derived from server name |
| 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¶
收集当前活动的查询、会话信息、等待事件和阻塞信息
| Tags & Fields | Description |
|---|---|
| command ( tag) |
The type of command being executed. |
| database_instance ( tag) |
SQL Server instance identifier derived from server name |
| 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 功能切割字段说明¶
SQL Server 通用日志文本示例:
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
切割后的字段列表如下:
| 字段名 | 字段值 | 说明 |
|---|---|---|
msg |
spid... |
日志内容 |
time |
1622169967780000000 |
纳秒时间戳(作为行协议时间) |
origin |
spid10s |
源 |
status |
info |
由于日志没有明确字段说明日志等级,默认为 info |