diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0c62d715..438da486 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,15 +18,28 @@ jobs: - "2.5" - "2.6" - "2.7" + - "2.8" cartridge: [ "", "1.2.0", "2.1.2", "2.4.0", "2.5.1", "2.6.0", "2.7.3" ] + include: + - tarantool: "2.x-latest" + cartridge: "2.7.3" + - tarantool: "2.x-latest" + cartridge: "" runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: tarantool/setup-tarantool@v1 + if: matrix.tarantool != '2.x-latest' with: tarantool-version: ${{ matrix.tarantool }} + - name: Install latest pre-release Tarantool 2.x + if: matrix.tarantool == '2.x-latest' + run: | + curl -L https://tarantool.io/pre-release/2/installer.sh | bash + sudo apt-get -y install tarantool + - name: lint run: make lint env: diff --git a/CHANGELOG.md b/CHANGELOG.md index 772445ac..eb032316 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `tnt_cpu_number` (same as `tnt_cpu_count`) - `tnt_cpu_time` (same as `tnt_cpu_total`) - `tnt_vinyl_scheduler_dump_total` (same as `tnt_vinyl_scheduler_dump_count`) + - `tnt_replication_lag` + - `tnt_vinyl_regulator_blocked_writers` + - `tnt_net_requests_in_progress_total` + - `tnt_net_requests_in_progress_current` + - `tnt_net_requests_in_stream_total` + - `tnt_net_requests_in_stream_current` + - `tnt_replication_lsn` ### Deprecated @@ -43,6 +50,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `tnt_cpu_count` - `tnt_cpu_total` - `tnt_vinyl_scheduler_dump_count` + - `tnt_replication__lag` + - `tnt_replication_master__lsn` + - `tnt_replication_replica__lsn` ## [0.12.0] - 2021-11-18 ### Changed diff --git a/Makefile b/Makefile index 2bb71d80..4f615278 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ rpm: .rocks: metrics-scm-1.rockspec tarantoolctl rocks make - tarantoolctl rocks install luatest 0.5.6 + tarantoolctl rocks install luatest 0.5.7 tarantoolctl rocks install luacov 0.13.0 tarantoolctl rocks install luacheck 0.26.0 if [ -z $(CARTRIDGE_VERSION) ]; then \ diff --git a/doc/monitoring/metrics_reference.rst b/doc/monitoring/metrics_reference.rst index fe0176c6..3f50ac71 100644 --- a/doc/monitoring/metrics_reference.rst +++ b/doc/monitoring/metrics_reference.rst @@ -219,6 +219,33 @@ Requests: * - ``tnt_net_requests_current`` - Number of pending network requests +Requests in progress: + +.. container:: table + + .. list-table:: + :widths: 25 75 + :header-rows: 0 + + * - ``tnt_net_requests_in_progress_total`` + - Total count of requests processed by tx thread + * - ``tnt_net_requests_in_progress_current`` + - Count of requests currently being processed in the tx thread + +Requests placed in queues of streams: + +.. container:: table + + .. list-table:: + :widths: 25 75 + :header-rows: 0 + + * - ``tnt_net_requests_in_stream_total`` + - Total count of requests, which was placed in queues of streams + for all time + * - ``tnt_net_requests_in_stream_current`` + - Count of requests currently waiting in queues of streams + .. _metrics-reference-fibers: Fibers @@ -316,12 +343,16 @@ Learn more about :ref:`replication in Tarantool `. - LSN number in vclock. This metric always has the label ``{id="id"}``, where ``id`` is the instance's number in the replica set. - * - ``tnt_replication_replica__lsn`` / ``tnt_replication_master__lsn`` - - LSN of the master/replica, where - ``id`` is the instance's number in the replica set. - * - ``tnt_replication__lag`` - - Replication lag value in seconds, where - ``id`` is the instance's number in the replica set. + * - ``tnt_replication_lsn`` + - LSN of the tarantool instance. + This metric always has labels ``{id="id", type="type"}``, where + ``id`` is the instance's number in the replica set, + ``type`` is ``master`` or ``replica``. + * - ``tnt_replication_lag`` + - Replication lag value in seconds. + This metric always has labels ``{id="id", stream="stream"}``, + where ``id`` is the instance's number in the replica set, + ``stream`` is ``downstream`` or ``upstream``. .. _metrics-reference-runtime: @@ -556,6 +587,9 @@ efficient. The value is slightly smaller than the amount of memory allocated for vinyl trees, reflected in the :ref:`vinyl_memory ` parameter. + * - ``tnt_vinyl_regulator_blocked_writers`` + - The number of fibers that are blocked waiting + for Vinyl level0 memory quota. Transactional activity ~~~~~~~~~~~~~~~~~~~~~~ diff --git a/metrics/init.lua b/metrics/init.lua index da1c9072..980d75dc 100644 --- a/metrics/init.lua +++ b/metrics/init.lua @@ -126,7 +126,8 @@ return { enable_default_metrics = function(include, exclude) log.warn('metrics tnt_net_sent_rps, tnt_net_received_rps, tnt_net_connections_rps, '.. 'tnt_net_requests_rps, tnt_stats_op_rps, tnt_space_count, tnt_fiber_count, ' .. - 'lj_gc_total, tnt_cpu_count, tnt_cpu_total, tnt_vinyl_scheduler_dump_count ' .. + 'lj_gc_total, tnt_cpu_count, tnt_cpu_total, tnt_vinyl_scheduler_dump_count, ' .. + 'tnt_replication__lag, tnt_replication_master/replica__lsn ' .. 'are deprecated and will be removed in next releases.') require('metrics.tarantool').enable(include, exclude) end, diff --git a/metrics/tarantool/info.lua b/metrics/tarantool/info.lua index b196e185..63e3c9b2 100644 --- a/metrics/tarantool/info.lua +++ b/metrics/tarantool/info.lua @@ -23,9 +23,15 @@ local function update_info_metrics() for k, v in ipairs(info.replication) do if v.upstream ~= nil then - local metric_name = 'replication_' .. k .. '_lag' - collectors_list[metric_name] = - utils.set_gauge(metric_name, 'Replication lag for instance ' .. k, v.upstream.lag) + local metric_name_old = 'replication_' .. k .. '_lag' + collectors_list[metric_name_old] = + utils.set_gauge(metric_name_old, 'Replication lag for instance ' .. k, v.upstream.lag) + collectors_list.replication_lag = + utils.set_gauge('replication_lag', 'Replication lag', v.upstream.lag, {stream = 'upstream', id = k}) + end + if v.downstream ~= nil then + collectors_list.replication_lag = + utils.set_gauge('replication_lag', 'Replication lag', v.downstream.lag, {stream = 'downstream', id = k}) end end diff --git a/metrics/tarantool/network.lua b/metrics/tarantool/network.lua index 32ae674e..2b9ae939 100644 --- a/metrics/tarantool/network.lua +++ b/metrics/tarantool/network.lua @@ -41,6 +41,25 @@ local function update_network_metrics() collectors_list.net_requests_current = utils.set_gauge('net_requests_current', 'Pending requests', box_stat_net.REQUESTS.current) end + + if box_stat_net.REQUESTS_IN_PROGRESS ~= nil then + collectors_list.net_requests_in_progress_total = + utils.set_counter('net_requests_in_progress_total', 'Requests in progress total amount', + box_stat_net.REQUESTS_IN_PROGRESS.total) + collectors_list.net_requests_in_progress_current = + utils.set_gauge('net_requests_in_progress_current', + 'Count of requests currently being processed in the tx thread', box_stat_net.REQUESTS_IN_PROGRESS.current) + end + + if box_stat_net.REQUESTS_IN_STREAM_QUEUE ~= nil then + collectors_list.net_requests_in_stream_total = + utils.set_counter('net_requests_in_stream_queue_total', + 'Total count of requests, which was placed in queues of streams', + box_stat_net.REQUESTS_IN_STREAM_QUEUE.total) + collectors_list.net_requests_in_stream_current = + utils.set_gauge('net_requests_in_stream_queue_current', + 'count of requests currently waiting in queues of streams', box_stat_net.REQUESTS_IN_STREAM_QUEUE.current) + end end diff --git a/metrics/tarantool/replicas.lua b/metrics/tarantool/replicas.lua index 4c79e3cf..a0c0d20a 100644 --- a/metrics/tarantool/replicas.lua +++ b/metrics/tarantool/replicas.lua @@ -16,6 +16,9 @@ local function update_replicas_metrics() local lsn = replication_info.lsn local metric_name = 'replication_replica_' .. k .. '_lsn' collectors_list[metric_name] = utils.set_gauge(metric_name, 'lsn for replica ' .. k, lsn - v) + + collectors_list.replication_lsn = + utils.set_gauge('replication_lsn', 'lsn for instance', lsn - v, {type = 'replica', id = k}) end end else @@ -29,6 +32,12 @@ local function update_replicas_metrics() 'lsn for master ' .. k, current_box_info.lsn - lsn ) + collectors_list.replication_lsn = utils.set_gauge( + 'replication_lsn', + 'lsn for instance', + current_box_info.lsn - lsn, + {type = 'master', id = k} + ) end end end diff --git a/metrics/tarantool/vinyl.lua b/metrics/tarantool/vinyl.lua index 945d128f..b7f7cdc0 100644 --- a/metrics/tarantool/vinyl.lua +++ b/metrics/tarantool/vinyl.lua @@ -24,6 +24,11 @@ local function update() collectors_list.vinyl_regulator_dump_watermark = utils.set_gauge('vinyl_regulator_dump_watermark', 'Point when dumping must occur', vinyl_stat.regulator.dump_watermark) + if vinyl_stat.regulator.blocked_writers ~= nil then + collectors_list.vinyl_regulator_blocked_writers = + utils.set_gauge('vinyl_regulator_blocked_writers', 'The number of fibers that are blocked waiting ' .. + 'for Vinyl level0 memory quota', vinyl_stat.regulator.blocked_writers) + end collectors_list.vinyl_tx_conflict = utils.set_gauge('vinyl_tx_conflict', 'Count of transaction conflicts', vinyl_stat.tx.conflict) diff --git a/test/tarantool/vinyl_test.lua b/test/tarantool/vinyl_test.lua index e187f812..c428bacb 100644 --- a/test/tarantool/vinyl_test.lua +++ b/test/tarantool/vinyl_test.lua @@ -26,5 +26,10 @@ g.test_vinyl_metrics_present = function() local metrics_cnt = fun.iter(metrics.collect()):filter(function(x) return x.metric_name:find('tnt_vinyl') end):length() - t.assert_equals(metrics_cnt, 20) + if utils.is_version_less(_TARANTOOL, '2.8.3') + and utils.is_version_greater(_TARANTOOL, '2.0.0') then + t.assert_equals(metrics_cnt, 20) + else + t.assert_equals(metrics_cnt, 21) + end end diff --git a/test/utils.lua b/test/utils.lua index 3cafdd4e..ca884d2b 100644 --- a/test/utils.lua +++ b/test/utils.lua @@ -62,9 +62,13 @@ function utils.find_metric(metric_name, metrics_data) return #m > 0 and m or nil end +local function to_number_multiple(...) + return unpack(fun.map(tonumber, {...}):totable()) +end + function utils.is_version_less(ver_str, reference_ver_str) - local major, minor, patch = string.match(ver_str, '^(%d+).(%d+).(%d+)') - local ref_major, ref_minor, ref_patch = string.match(reference_ver_str, '^(%d+).(%d+).(%d+)') + local major, minor, patch = to_number_multiple(string.match(ver_str, '^(%d+).(%d+).(%d+)')) + local ref_major, ref_minor, ref_patch = to_number_multiple(string.match(reference_ver_str, '^(%d+).(%d+).(%d+)')) if ( major < ref_major ) or ( major == ref_major and minor < ref_minor) or ( major == ref_major and minor == ref_minor and patch < ref_patch) then @@ -75,8 +79,8 @@ function utils.is_version_less(ver_str, reference_ver_str) end function utils.is_version_greater(ver_str, reference_ver_str) - local major, minor, patch = string.match(ver_str, '^(%d+).(%d+).(%d+)') - local ref_major, ref_minor, ref_patch = string.match(reference_ver_str, '^(%d+).(%d+).(%d+)') + local major, minor, patch = to_number_multiple(string.match(ver_str, '^(%d+).(%d+).(%d+)')) + local ref_major, ref_minor, ref_patch = to_number_multiple(string.match(reference_ver_str, '^(%d+).(%d+).(%d+)')) if ( major > ref_major ) or ( major == ref_major and minor > ref_minor) or ( major == ref_major and minor == ref_minor and patch > ref_patch) then