Skip to content

Commit

Permalink
Adds new memory related metrics for mssql integration (#5668)
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanKurek authored Nov 2, 2023
1 parent ad9bec2 commit 3683a95
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ Main (unreleased)

- Support clustering in `loki.source.podlogs` (@rfratto).

- Adds new metrics (`mssql_server_total_memory_bytes`, `mssql_server_target_memory_bytes`,
and `mssql_available_commit_memory_bytes`) for `mssql` integration.

v0.37.3 (2023-10-26)
-----------------

Expand Down
33 changes: 31 additions & 2 deletions pkg/integrations/mssql/collector_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ metrics:
values: [virtual_memory_bytes]
query_ref: mssql_process_memory

- metric_name: mssql_available_commit_memory_bytes
type: gauge
help: 'SQL Server available to be committed memory size.'
values: [available_commit_limit_bytes]
query_ref: mssql_process_memory

- metric_name: mssql_memory_utilization_percentage
type: gauge
help: 'The percentage of committed memory that is in the working set.'
Expand All @@ -133,6 +139,21 @@ metrics:
values: [page_fault_count]
query_ref: mssql_process_memory

#
# Collected from sys.dm_os_sys_info
#
- metric_name: mssql_server_total_memory_bytes
type: gauge
help: 'SQL Server committed memory in the memory manager.'
values: [committed_memory_bytes]
query_ref: mssql_os_sys_info

- metric_name: mssql_server_target_memory_bytes
type: gauge
help: 'SQL Server target committed memory set for the memory manager.'
values: [committed_memory_target_bytes]
query_ref: mssql_os_sys_info

#
# Collected from sys.dm_os_sys_memory
#
Expand Down Expand Up @@ -168,13 +189,21 @@ queries:
sys.dm_io_virtual_file_stats(null, null) a
INNER JOIN sys.master_files b ON a.database_id = b.database_id AND a.file_id = b.file_id
GROUP BY a.database_id
# Populates `mssql_resident_memory_bytes`, `mssql_virtual_memory_bytes`, `mssql_memory_utilization_percentage` and
# `mssql_page_fault_count`.
# Populates `mssql_resident_memory_bytes`, `mssql_virtual_memory_bytes`, mssql_available_commit_memory_bytes,
# and `mssql_memory_utilization_percentage`, and `mssql_page_fault_count_total`
- query_name: mssql_process_memory
query: |
SELECT
physical_memory_in_use_kb * 1024 AS resident_memory_bytes,
virtual_address_space_committed_kb * 1024 AS virtual_memory_bytes,
available_commit_limit_kb * 1024 AS available_commit_limit_bytes,
memory_utilization_percentage,
page_fault_count
FROM sys.dm_os_process_memory
# Populates `mssql_server_total_memory_bytes` and `mssql_server_target_memory_bytes`.
- query_name: mssql_os_sys_info
query: |
SELECT
committed_kb * 1024 AS committed_memory_bytes,
committed_target_kb * 1024 AS committed_memory_target_bytes
FROM sys.dm_os_sys_info

0 comments on commit 3683a95

Please sign in to comment.