Skip to content

Fix summary counter #407

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Sep 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- `tnt_synchro_queue_len` metric type
- Reset callbacks on hotreload
- Fix queries in quantile

## [0.15.0] - 2022-08-09
### Fixed
Expand Down
2 changes: 1 addition & 1 deletion metrics/quantile.lua
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ function stream:query(q)

local p = s.l[0]
local r = 0
for i = 1, s.l_len do
for i = 1, s.l_len-1 do -- samples buffer indexing starts from 0 to length-1
local c = s.l[i]
if r + c.Width + c.Delta > t then
return p.Value
Expand Down
49 changes: 49 additions & 0 deletions test/integration/highload_test.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
require('strict').on()

local fio = require('fio')

local t = require('luatest')
local g = t.group('highload')

g.test_eventloop = function()
local tmpdir = fio.tempdir()
if type(box.cfg) == 'function' then
box.cfg {
wal_dir = tmpdir,
memtx_dir = tmpdir,
}
end

local metrics = require('metrics')
local fiber = require('fiber')
local clock = require('clock')
local utils = require('test.utils')

local function monitor(collector)
local time_before
while true do
time_before = clock.monotonic()
fiber.yield()
collector:observe(clock.monotonic() - time_before)
end
end

metrics.set_global_labels({ alias = 'my_instance' })

local collector = metrics.summary('tnt_fiber_event_loop', 'event loop time',
{ [0.5] = 0.01, [0.9] = 0.01, [0.99] = 0.01, })
local fiber_object = fiber.create(function() monitor(collector) end)

for _ = 1, 10 do
fiber.sleep(0.1)
local observations = metrics.collect()

local obs_summary = utils.find_obs('tnt_fiber_event_loop',
{ alias = 'my_instance', quantile = 0.99 }, observations)

t.assert_not_inf(obs_summary.value)
end

fiber.kill(fiber_object:id())

end