#
# Copyright (c) 2019-2020, Red Hat.
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
# 
# This file is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# for more details.
#
#
# Microsoft SQL server derived metrics
# These derived metrics complete calculation of those metrics requiring
# client-side computation using multiple base metrics from SQL Server.
#

mssql.buffer_manager.buffer_cache_hit_ratio = 100 * (mssql.buffer_manager.raw_buffer_cache_hit_ratio / mssql.buffer_manager.raw_buffer_cache_hit_ratio_base)
mssql.buffer_manager.buffer_cache_hit_ratio(oneline) = percentage of pages found in the buffer cache without reading from disk
mssql.buffer_manager.buffer_cache_hit_ratio(helptext) = '\
Ratio of raw_buffer_cache_hit_ratio over raw_buffer_cache_hit_ratio_base
as a percentage.'

mssql.databases.log_cache_hit_ratio = 100 * (mssql.databases.raw_log_cache_hit_ratio / mssql.databases.raw_log_cache_hit_ratio_base)
mssql.databases.log_cache_hit_ratio(oneline) = percentage of log cache reads satisfied from the log cache
mssql.databases.log_cache_hit_ratio(helptext) = '\
Ratio of raw_log_cache_hit_ratio over raw_log_cache_hit_ratio_base
as a percentage.'

mssql.latches.average_latch_wait_time = (mssql.latches.raw_average_latch_wait_time / mssql.latches.raw_average_latch_wait_time_base)
mssql.latches.average_latch_wait_time(oneline) = average delay associated with latch acquisition
mssql.latches.average_latch_wait_time(helptext) = '\
A latch is a short-term synchronization object that ensures data integrity
on objects in SQL Server memory.  A latch wait is a delay associated with
access to a latch, and may be caused by the I/O system not keeping up with
latch requests.'

mssql.locks.average_wait_time = (mssql.locks.raw_average_wait_time / mssql.locks.raw_average_wait_time_base)
mssql.locks.average_wait_time(oneline) = average delay associated with lock acquisition
mssql.locks.average_wait_time(helptext) = '\
Average lock wait time is aggregated time that processes spend waiting for
other processes to release a SQL Server lock.'

mssql.plan_cache.cache_hit_ratio = (mssql.plan_cache.raw_cache_hit_ratio / mssql.plan_cache.raw_cache_hit_ratio_base)
mssql.plan_cache.cache_hit_ratio(oneline) = percentage of plan cache reads satisfied from the plan cache
mssql.plan_cache.cache_hit_ratio(helptext) = '\
Ratio of raw_cache_hit_ratio over raw_cache_hit_ratio_base as a percentage.'
