# Microsoft SQL Server Receiver

<!-- llms-txt-link: /llms.txt -->

> OpenTelemetry Collector receiver · contrib distribution

The `sqlserver` receiver grabs metrics/logs about a Microsoft SQL Server instance. The receiver works by either using the Windows Performance Counters, or by directly connecting to the instance and querying it. Windows Performance Counters are only available when running on Windows.

- **Component ID**: `contrib-sqlserverreceiver`
- **Name**: `sqlserverreceiver`
- **Type**: receiver
- **Distribution**: contrib
- **Repository**: `opentelemetry-collector-contrib`

## Stability

| Level | Signals |
| --- | --- |
| beta | metrics |
| development | logs |

## Attributes

| Attribute | Type | Description |
| --- | --- | --- |
| `cache.state` | string | The state of the cache objects. |
| `client.address` | string | Hostname or address of the client. |
| `client.port` | int | TCP port used by the client. |
| `database.status` | string | The current status of a database |
| `db.namespace` | string | The database name. |
| `db.query.text` | string | The text of the database query being executed. |
| `db.system.name` | string | The database management system (DBMS) product as identified by the client instrumentation. |
| `direction` | string | The direction of flow of bytes or operations. |
| `file_type` | string | The type of file being monitored. |
| `logical_filename` | string | The logical filename of the file being monitored. |
| `memory.pool` | string | The functional area of SQL Server memory. |
| `network.peer.address` | string | IP address of the peer client. |
| `network.peer.port` | int | TCP port used by the peer client. |
| `page.operations` | string | The page operation types. |
| `page.pool` | string | The type of page pool in the SQL Server buffer manager. |
| `performance_counter.object_name` | string | Category to which this counter belongs |
| `physical_filename` | string | The physical filename of the file being monitored. |
| `replica.direction` | string | The direction of flow of bytes for replica. |
| `server.address` | string | The network address of the server hosting the database. |
| `server.port` | int | The port number on which the server is listening. |
| `sqlserver.access.scan.type` | string | The type of access method scan being performed. |
| `sqlserver.blocking.start_time` | string | Timestamp of when the current blocking wait began (ISO 8601 format). |
| `sqlserver.blocking_session_id` | int | Session ID that is blocking the current session. 0 if none. |
| `sqlserver.client.app.name` | string | Name of the client application that initiated the session. |
| `sqlserver.command` | string | SQL command type being executed. |
| `sqlserver.context_info` | string | Context information for the session, represented as a hexadecimal string. |
| `sqlserver.cpu_time` | double | CPU time consumed by the query, in seconds. |
| `sqlserver.deadlock_priority` | int | Deadlock priority value for the session. |
| `sqlserver.estimated_completion_time` | double | Estimated time remaining for the request to complete, in seconds. |
| `sqlserver.execution_count` | int | Number of times that the plan has been executed since it was last compiled, reported in delta value. |
| `sqlserver.extent.operation.type` | string | The type of extent allocation operation. |
| `sqlserver.lock_timeout` | double | Lock timeout value in seconds. |
| `sqlserver.logical_reads` | int | Number of logical reads (data read from cache/memory). |
| `sqlserver.open_transaction_count` | int | Number of transactions currently open in the session. |
| `sqlserver.page.allocation.type` | string | The type of page allocation operation. |
| `sqlserver.page.compression.type` | string | The type of page compression operation. |
| `sqlserver.parameterization.result` | string | The result of an auto-parameterization attempt by the SQL Server query optimizer. |
| `sqlserver.percent_complete` | double | Percentage of work completed. |
| `sqlserver.plan.guidance.result` | string | Whether a SQL plan execution successfully used a matching plan guide (guided) or did not (misguided). |
| `sqlserver.procedure_execution_count` | int | Number of times that the procedure has been executed since it was last compiled, reported in delta value. |
| `sqlserver.procedure_id` | string | The SQL Server ID of the stored procedure, if any |
| `sqlserver.procedure_name` | string | The name of the stored procedure, if any |
| `sqlserver.query.last_started` | string | Timestamp of when the SQL query last started executing (ISO 8601 format). |
| `sqlserver.query.plan.creation_time` | string | Timestamp of when the SQL query execution plan was compiled (ISO 8601 format). |
| `sqlserver.query_hash` | string | Binary hash value calculated on the query and used to identify queries with similar logic, reported in the HEX format. |
| `sqlserver.query_plan` | string | The query execution plan used by the SQL Server. |
| `sqlserver.query_plan_hash` | string | Binary hash value calculated on the query execution plan and used to identify similar query execution plans, reported in the HEX format. |
| `sqlserver.query_start` | string | Timestamp of when the SQL query started (ISO 8601 format). |
| `sqlserver.reads` | int | Number of physical reads performed by the query. |
| `sqlserver.request_status` | string | Status of the request (e.g., running, suspended). |
| `sqlserver.row_count` | int | Number of rows affected or returned by the query. |
| `sqlserver.session.duration` | double | Total elapsed time in seconds the session has been actively executing requests. |
| `sqlserver.session.start_time` | string | Timestamp when the session was established (ISO 8601 format). |
| `sqlserver.session_id` | int | ID of the SQL Server session. |
| `sqlserver.session_status` | string | Status of the session (e.g., running, sleeping). |
| `sqlserver.total_elapsed_time` | double | Total elapsed time for completed executions of this plan, reported in delta seconds. |
| `sqlserver.total_grant_kb` | int | The total amount of reserved memory grant in KB this plan received since it was compiled, reported in delta value. |
| `sqlserver.total_logical_reads` | int | Total number of logical reads performed by executions of this plan since it was compiled, reported in delta value. |
| `sqlserver.total_logical_writes` | int | Total number of logical writes performed by executions of this plan since it was compiled, reported in delta value. |
| `sqlserver.total_physical_reads` | int | Total number of physical reads performed by executions of this plan since it was compiled, reported in delta value. |
| `sqlserver.total_rows` | int | Total number of rows returned by the query, reported in delta value. |
| `sqlserver.total_worker_time` | double | Total amount of CPU time that was consumed by executions of this plan since it was compiled, reported in delta seconds. |
| `sqlserver.transaction_id` | int | Unique ID of the active transaction. |
| `sqlserver.transaction_isolation_level` | int | Transaction isolation level used in the session. Represented as numeric constant. |
| `sqlserver.wait.resource.id` | string | SQL Server identifier for the locked or waited-on resource, if available. |
| `sqlserver.wait.resource.type` | string | SQL Server type of the locked or waited-on resource, if available. |
| `sqlserver.wait_resource` | string | The resource for which the session is waiting. |
| `sqlserver.wait_time` | double | Duration in seconds the request has been waiting. |
| `sqlserver.wait_type` | string | Type of wait encountered by the request. Empty if none. |
| `sqlserver.writes` | int | Number of writes performed by the query. |
| `table.state` | string | The state of the table. |
| `table.status` | string | The status of the table. |
| `tempdb.state` | string | The status of the tempdb space usage. |
| `transition.direction` | string | The direction of a superlatch transition. |
| `user.name` | string | Login name associated with the SQL Server session. |
| `wait.category` | string | Category of the reason for a wait. |
| `wait.type` | string | Type of the wait, view [WaitTypes documentation](https://learn.microsoft.com/en-us/sql/relational-databases/system-dynamic-management-views/sys-dm-os-wait-stats-transact-sql?view=sql-server-ver16#WaitTypes) for more information. |

## Data

- **JSON**: [/data/collector/components/contrib-sqlserverreceiver/contrib-sqlserverreceiver-3fdce87e3383.json](/data/collector/components/contrib-sqlserverreceiver/contrib-sqlserverreceiver-3fdce87e3383.json)
- **Explore**: [/collector/components/contrib/sqlserverreceiver](/collector/components/contrib/sqlserverreceiver)
