Microsoft SQL Server

SQL Server monitoring for fast queries and healthy databases

by Obseria · Databases and messaging
  • OpenTelemetry
  • Infrastructure Observability
  • Databases and messaging
Category
Databases and messaging
Key metrics
10
Ready-made
5 dashboards & alerts
Setup
3 steps
Standard
OTLP

Create a login with VIEW SERVER STATE, add the sqlserver receiver to the OpenTelemetry Collector and Obseria shows batch requests, buffer cache, lock waits, transaction log usage and connections, next to the .NET and Java services that query them.

Minimal permissions

The sqlserver receiver needs VIEW SERVER STATE and VIEW ANY DEFINITION, no sysadmin rights and nothing installed inside the instance.

Windows and Linux

On Windows the receiver can read SQL Server performance counters locally; with server, port and credentials it connects directly, also to SQL Server on Linux and in containers.

Database and application together

Obseria Intelligence relates slow application requests to lock waits, a shrinking buffer cache or a full transaction log on the instance.

Obseria interface

Obseria apps and capabilities: observability, APM, infrastructure and integrations
Obseria home dashboard with service health, open problems, SLO compliance and ingestion
Obseria trace explorer with span list and span attributes

Ready the moment data arrives

  • SQL Server overview: batch requests, compilations, connections
  • Buffer pool: page life expectancy and cache hit ratio
  • Alert on rising lock wait time
  • Alert on transaction log usage per database
  • Slowest SQL statements by calling service

What Obseria monitors in SQL Server

Workload

Batch requests, SQL compilations and recompilations and transactions per second.

Buffer cache and memory

Page life expectancy, buffer cache hit ratio and page splits.

Locks and blocking

Lock wait rate and average lock wait time, the starting point for blocking analysis.

Transaction log

Log usage, log growths and flush waits per database.

Connections

User connections, to spot connection leaks and pool misconfiguration.

Application queries

Client spans from OpenTelemetry-instrumented .NET, Java, Python and Node.js services show which code runs which statement.

The SQL Server signals that matter

Obseria collects these values automatically and shows them in ready-made dashboards and alerts.

MetricUnitWhat it tells you
sqlserver.batch.request.rate{requests}/sBatch requests per second, the core throughput signal of an instance.
sqlserver.batch.sql_compilation.rate{compilations}/sSQL compilations per second; high values relative to batch requests point to missing plan reuse.
sqlserver.batch.sql_recompilation.rate{compilations}/sRecompilations per second, often caused by schema changes or volatile statistics.
sqlserver.page.life_expectancysHow long a page stays in the buffer pool; a sudden drop means memory pressure.
sqlserver.page.buffer_cache.hit_ratio%Share of page reads served from memory instead of disk.
sqlserver.page.split.rate{pages}/sPage splits per second, a sign of fragmentation from inserts into full pages.
sqlserver.lock.wait.rate{requests}/sLock requests per second that had to wait; rising values mean blocking.
sqlserver.lock.wait_time.avgmsAverage wait time for locks, to judge how much blocking hurts.
sqlserver.transaction_log.usageByTransaction log space in use per database, to act before the log fills up.
sqlserver.user.connection.count{connections}Connected users; steady growth often points to a connection leak.

Set up SQL Server monitoring in minutes

  1. 1

    Create a monitoring login

    Create a login and user such as otel and grant VIEW SERVER STATE and VIEW ANY DEFINITION.

  2. 2

    Add the receiver

    Add the sqlserver receiver to the OpenTelemetry Collector or Obseria Agent with server, port, username and password; all four must be set together.

  3. 3

    Send to Obseria

    Export via otlphttp to your Obseria OTLP endpoint; the instance appears in the database view with its metrics.

Example configuration · YAML
# Monitoring login (run once in SQL Server):
#   CREATE LOGIN otel WITH PASSWORD = 'a-strong-password';
#   CREATE USER otel FOR LOGIN otel;
#   GRANT VIEW SERVER STATE TO otel;
#   GRANT VIEW ANY DEFINITION TO otel;
receivers:
  sqlserver:
    server: mssql
    port: 1433
    username: otel
    password: ${env:MSSQL_PASSWORD}
    collection_interval: 30s
exporters:
  otlphttp:
    endpoint: ${env:OBSERIA_OTLP_ENDPOINT}
    headers:
      Authorization: "Bearer ${env:OBSERIA_TOKEN}"
service:
  pipelines:
    metrics:
      receivers: [sqlserver]
      exporters: [otlphttp]

Why SQL Server monitoring matters

Microsoft SQL Server runs ERP systems, e-commerce backends and countless line-of-business applications. When it slows down, every service on top of it slows down too, and users see timeouts rather than error messages. The causes are often inside the engine: memory pressure that pushes pages out of the buffer pool, blocking chains around a long transaction, a transaction log that cannot grow or a plan cache that keeps recompiling. SQL Server monitoring makes these internals visible and links them to the applications that depend on the database.

The OpenTelemetry Collector provides the sqlserver receiver. On Windows it can read SQL Server performance counters locally; with server, port, username and password it connects directly and queries dynamic management views, which also works for SQL Server on Linux and in containers. The result is SQL Server performance monitoring with standard metric names such as sqlserver.batch.request.rate and sqlserver.page.life_expectancy.

Signals that matter for SQL Server performance monitoring

  • Workload: sqlserver.batch.request.rate shows throughput. Compared with sqlserver.batch.sql_compilation.rate and sqlserver.batch.sql_recompilation.rate it reveals whether plans are reused.
  • Memory: sqlserver.page.life_expectancy and sqlserver.page.buffer_cache.hit_ratio tell you whether the working set fits into the buffer pool.
  • Blocking: sqlserver.lock.wait.rate and sqlserver.lock.wait_time.avg show how often and how long sessions wait for locks.
  • Transaction log: sqlserver.transaction_log.usage per database warns before the log runs out of space.
  • Connections: sqlserver.user.connection.count reveals connection leaks and pools that are larger than the server can handle.

Common SQL Server problems and how to detect them

Memory pressure

A large report or a missing index can read big tables and evict hot pages from the buffer pool. Page life expectancy drops sharply, disk reads rise and unrelated queries become slow at the same moment.

Blocking chains

A long transaction that holds locks makes other sessions wait. Rising lock waits together with flat CPU and growing request latency in application traces are the typical pattern.

Full or fast-growing transaction log

Missing log backups in the full recovery model or one huge transaction let the log grow until the disk is full and writes stop. Trend alerts on log usage per database catch this early.

Plan cache churn

Ad hoc queries with literal values or frequent schema changes force compilations. CPU rises while batch requests stay flat, which the compilation ratio makes obvious.

Connection leaks

Code paths that do not close connections slowly fill the pool until requests fail. A connection count that only grows after a deploy points to the release that introduced the leak.

Best practices for SQL Server database monitoring

  1. Use a dedicated login with VIEW SERVER STATE and VIEW ANY DEFINITION instead of a sysadmin account.
  2. Run one receiver per instance and set server, port, username and password together, since the receiver rejects a partial set.
  3. Alert on trends in page life expectancy, lock wait time and log usage rather than single fixed values.
  4. Instrument the .NET or Java services that use the database with OpenTelemetry, so slow statements appear as client spans with their calling endpoint.
  5. Collect host metrics from the database server as well, to separate SQL Server problems from disk or CPU limits.

How Obseria helps with SQL Server monitoring

Obseria receives SQL Server metrics over OTLP from the OpenTelemetry Collector or the Obseria Agent and shows them in the database view next to host metrics and traces. TopoGraph connects each instance with the services that query it. When requests slow down, Obseria Intelligence checks memory, blocking, log usage and recent deploys and presents the root cause with its chain of evidence. Dashboards, alerts and SLOs are included, and your data can stay in the EU region.

Database administrators and application teams look at the same data: the DBA sees page life expectancy and lock waits per instance, while developers see the slow statement inside the trace of their endpoint. That shared view shortens the discussion about whether a problem sits in the database or in the code.

Learn more

SQL Server monitoring FAQ

A login with VIEW SERVER STATE and VIEW ANY DEFINITION is enough. The receiver only reads performance data and does not need sysadmin rights.

Yes. Configure server, port, username and password so the receiver connects directly. Reading Windows performance counters is only available when the Collector runs on the Windows host itself.

Azure SQL metrics can be collected through the Azure integration via Azure Monitor. For SQL Server on Azure VMs or Azure SQL Managed Instance you can also use the sqlserver receiver with a direct connection; check which views your service tier exposes.

Yes, from the application side. OpenTelemetry instrumentation for .NET, Java, Python and Node.js records database client spans with the statement, so Obseria shows the slow query in the trace of the request that ran it.

The receiver queries performance counters and dynamic management views at the configured interval, for example every 30 seconds. These are lightweight read operations designed for monitoring.

Start monitoring SQL Server today

Connect SQL Server in minutes with OpenTelemetry or the Obseria Agent. Free for 14 days.