# Microsft SQL Server Extension - Best Practices

**URL:** <https://community.dynatrace.com/t/microsft-sql-server-extension-best-practices/53575>\
**Category:** Extensions\
**Tags:** databases, sql, mssql, extensions\
**Created:** [October 1, 2025, 8:55am UTC](https://community.dynatrace.com/t/microsft-sql-server-extension-best-practices/53575 "2025-10-01T08:55:06Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joao1](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@Joao1](https://community.dynatrace.com/u/Joao1)\
**Post date:** [October 1, 2025, 8:55am UTC](https://community.dynatrace.com/t/microsft-sql-server-extension-best-practices/53575/1 "2025-10-01T08:55:06Z")

</div>

Hello,

I’m currently implementing a solution to monitor various Microsoft SQL Server Instances and Databases in a client. I’m currently having trouble with some metrics not having information about some databases. I was reading the documentation and i found this:

## Limitations

### Aggregated metrics for database files

The two metrics below

- sql-server.databases.file.usedSpace
- sql-server.databases.file.emptySpace

are only reported for the database the extension is currently connected to. This is due to&nbsp;sys.allocation\_units&nbsp;only containing information about used pages of the database that is currently used inside the connection.

That got me wondering about this part “are only reported for the database the extension is currently connected to”.

Now the question:

Does that mean that if a certain instance has 30 databases, when defining the endpoint, instead of just having the instance defined and only 1 endpoint, i need to define 30 endpoints with each having its own database explicited?

Thanks in advance,

João

---

<div class="post-metadata">

**Author:** ![AntonPineiro](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antonpineiro/32/49_2.png) [@AntonPineiro](https://community.dynatrace.com/u/AntonPineiro)\
**Post date:** [October 2, 2025, 6:53am UTC](https://community.dynatrace.com/t/microsft-sql-server-extension-best-practices/53575/2 "2025-10-02T06:53:56Z")

</div>

Hi,

You just need to define one endpoint, but you can see that metric only in database connected.

Best regards

---

<div class="post-metadata">

**Author:** ![Joao1](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@Joao1](https://community.dynatrace.com/u/Joao1)\
**Post date:** [October 2, 2025, 8:13am UTC](https://community.dynatrace.com/t/microsft-sql-server-extension-best-practices/53575/3 "2025-10-02T08:13:27Z")

</div>

Hello,

I understand what you’re saying and that’s what i currently have. But i’m missing data from some metrics.

My question:

If i want to have data from all databases (without missing metric data, and i also confirmed that the user has all the permissions needed (admin)), do i need to define a endpoint for each database, even if it belongs to the same instance?

If the database is not defined in the endpoint, is the default one “master” ?

Best regards,

Joao

---

<div class="post-metadata">

**Author:** ![Joao1](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@Joao1](https://community.dynatrace.com/u/Joao1)\
**Post date:** [October 6, 2025, 11:08pm UTC](https://community.dynatrace.com/t/microsft-sql-server-extension-best-practices/53575/4 "2025-10-06T23:08:07Z")

</div>

Update:

I found another instance where it seems you have to be connected to a specific database if you want to retrieve data for Longest Queries. Documentation:

"

### Top queries

#### How to enable?

Collection of top queries ordered by total duration can be enabled using the&nbsp;Queries&nbsp;feature set.

#### Prerequisites

- Query Store&nbsp; **must** &nbsp;be enabled on SQL Server instance.

- The database from which queries are collected is determined by:

---

<div class="post-metadata">

**Author:** ![Joao1](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@Joao1](https://community.dynatrace.com/u/Joao1)\
**Post date:** [November 6, 2025, 10:21am UTC](https://community.dynatrace.com/t/microsft-sql-server-extension-best-practices/53575/5 "2025-11-06T10:21:28Z")

</div>

Hi,

If possible, i need help with something related to the YAML of the extension. I was editing it for a custom extension using the same data source. I was trying to edit a query which is used for the database state, to get information for a specific database. My question:

1. I created a variable with perItem: true&nbsp;  
so that i can define it in each endpoint, which is called:

- id: database&nbsp; &nbsp; displayName: Database Name&nbsp; &nbsp; perItem: true&nbsp; &nbsp; type: textthis is the query:

metrics:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; - key: sql-server.databases.state&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value: col:state&nbsp; &nbsp; &nbsp; &nbsp; query: \>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SELECT&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;AS database\_name,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; state,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; state\_desc,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; recovery\_model\_desc,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; user\_access\_desc,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; is\_auto\_close\_on,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ISNULL(&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DATABASEPROPERTYEX(name, ‘Updateability’),&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CASE&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; is\_read\_only&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WHEN&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; THEN&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ‘READ\_WRITE’&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ELSE&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ‘READ\_ONLY’&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; END&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ) AS updateability&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FROM&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sys.databases&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WHERE&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name = 'var:database’I tried it like that with ‘var:database’ and with ${var:database} and both didn’t work. Does anyone know a way to dynamically put the information there?

---

<div class="post-metadata">

**Author:** ![jose\_montanez](https://avatars.discourse-cdn.com/v4/letter/j/9e8a1a/32.png) [@jose\_montanez](https://community.dynatrace.com/u/jose_montanez)\
**Post date:** [November 7, 2025, 3:37pm UTC](https://community.dynatrace.com/t/microsft-sql-server-extension-best-practices/53575/6 "2025-11-07T15:37:35Z")

</div>

Does your [variable](https://docs.dynatrace.com/docs/ingest-from/extensions/develop-your-extensions/extension-yaml#variables) definition have the ‘vars’ like this? I don’t use in a query, but in my dimensions var:name works.

vars:- id: …

---

<div class="post-metadata">

**Author:** ![gsaharan](https://avatars.discourse-cdn.com/v4/letter/g/ee7513/32.png) [@gsaharan](https://community.dynatrace.com/u/gsaharan)\
**Post date:** [November 7, 2025, 4:05pm UTC](https://community.dynatrace.com/t/microsft-sql-server-extension-best-practices/53575/7 "2025-11-07T16:05:28Z")

</div>

Hi all,

I am also working on the same extension, did anyone faced any “ERROR” like-Failed to assign monitoring configuration to ActiveGate. Reason: High system resources consumption detected for datasources (soft limit)

Do we have to make any changed in the AG config file?

---

<div class="post-metadata">

**Author:** ![Gramblicka-DXC](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@Gramblicka-DXC](https://community.dynatrace.com/u/Gramblicka-DXC)\
**Post date:** [January 28, 2026, 10:21am UTC](https://community.dynatrace.com/t/microsft-sql-server-extension-best-practices/53575/8 "2026-01-28T10:21:23Z")

</div>

Hi,

yes, this issue is caused by the implementation by dynatrace. I raised a product idea for this yet i was told it is what it is. It connects always to master so any user dbs are simply not having their data gathered. You have to rely on disk monitoring for size.
