---
title: Configure Microsoft SQL Server monitoring with OpenTelemetry Collector (CNCF)
source: https://docs.newrelic.com/docs/opentelemetry/db360/mssql/cncf
---

You can use the OpenTelemetry Collector for Microsoft SQL Server to monitor your instance. The OpenTelemetry Collector is a community-supported project that collects telemetry data from Microsoft SQL Server and sends it to New Relic.

By default, the OpenTelemetry Collector collects limited metrics from Microsoft SQL Server. To send query performance, wait-time, session, and other advanced metrics, you'll need to configure the OpenTelemetry Collector. This guide shows you how to configure it to collect advanced metrics from Microsoft SQL Server and send them to New Relic.

## Prerequisites [#prerequisites]

-   OpenTelemetry Collector Contrib (`otelcol-contrib`) installed and configured on your system. You can download the latest release from the [OpenTelemetry Collector releases](https://github.com/open-telemetry/opentelemetry-collector-releases/releases) page.

## Enable UI metrics [#enable]

You can enrich your New Relic platform experience by adding and enabling metrics in your `otelcol-contrib` configuration file. Using the configuration provided in this section, you can populate data for the following pages in the New Relic platform:

-   Overview
-   Query performance
-   Wait events
-   Sessions
-   Clients
-   Stored procedures

**Enable Overview page metrics**

The Overview page displays a high-level view of your Microsoft SQL Server instance, including key metrics such as database count, I/O, latency, operations, tempdb space, deadlock rate, and more.

To populate data for the Overview page in the New Relic platform, add the following configuration to your `otelcol-contrib` configuration file:

```yaml
receivers:
    sqlserver:

        # Enable comprehensive database metrics
      metrics:
        sqlserver.database.count:
          enabled: true
        sqlserver.database.io:
          enabled: true
        sqlserver.database.latency:
          enabled: true
        sqlserver.database.operations:
          enabled: true
        sqlserver.database.tempdb.space:
          enabled: true
        sqlserver.database.tempdb.version_store.size:
          enabled: true
        sqlserver.deadlock.rate:
          enabled: true
        sqlserver.os.wait.duration:
          enabled: true
        sqlserver.processes.blocked:
          enabled: true
        sqlserver.memory.grants.pending.count:
          enabled: true
        sqlserver.memory.area:
          enabled: true
```

**Enable Query performance, session, wait, client, and stored procedure metrics**

You can populate data for the following pages in the New Relic platform:

-   Query performance: Displays detailed information about the queries running on your Microsoft SQL Server instance in the following tabs:
    -   Normalized queries: Displays the execution and average CPU time graphs.
    -   Query samples: Displays individual query executions including start time, duration, wait type, wait time, database, DB user, and client host.
    -   Stored procedures: Displays performance metrics for the top stored procedures.
-   Wait events: Displays information about the wait events occurring on your Microsoft SQL Server instance. The Query samples view shows queries currently waiting along with their wait type and wait time.
-   Sessions: Displays information about the sessions connected to your Microsoft SQL Server instance, including session counts, session states, avg active session duration, blocked sessions, and individual session details.
-   Clients: Displays information about the clients connected to your Microsoft SQL Server instance, including active sessions, blocked sessions, connected DB users, and client host details.
-   Stored procedures: Displays performance metrics for the top stored procedures.

To populate data in these pages, add the following configuration to your `otelcol-contrib` configuration file:

```yaml
receivers:
    sqlserver:

        events:
            db.server.query_sample:
                enabled: true
            db.server.top_query:
                enabled: true
            db.server.query_plan:
                enabled: true
            db.server.top_procedure:
                enabled: true

        # Top query collection configuration
        top_query_collection:
            lookback_time: 60s
            max_query_sample_count: 1000
            top_query_count: 250
            collection_interval: 60s

        # Query sample collection configuration
        query_sample_collection:
            max_rows_per_query: 100

        # Top stored procedure collection configuration
        top_procedure_collection:
            max_procedure_sample_count: 1000
            top_procedure_count: 250
            collection_interval: 60s
```

**Enable all waits in Wait event tab**

The All waits view shows instance-level wait time broken down by wait category and individual wait type.

To enable All waits in the New Relic platform Wait event tab, add the following configuration to your `otelcol-contrib` configuration file:

```yaml
receivers:
    sqlserver:

        metrics:
            sqlserver.os.wait.duration:
                enabled: true
```

## Restart the OpenTelemetry Collector

Restart the OpenTelemetry Collector to apply the configuration changes by running the following command:

```powershell
Restart-Service -Name "otelcol-contrib"
```

## Related documentation [#related-docs]

[Introduction to MSSQL monitoring with NRDOT](https://docs.newrelic.com/docs/opentelemetry/db360/mssql/introduction)

Learn about all the available installation methods for MSSQL monitoring with New Relic.

[Troubleshooting](https://docs.newrelic.com/docs/opentelemetry/db360/mssql/troubleshooting)

Learn how to troubleshoot your MSSQL monitoring setup in New Relic.

[Metrics reference](https://docs.newrelic.com/docs/opentelemetry/db360/mssql/metrics-reference)

Learn about the available metrics collected by the NRDOT Collector.
