@@ -7,12 +7,9 @@ local checks = require('checks')
77local errors = require (' errors' )
88local fiber = require (' fiber' )
99local fun = require (' fun' )
10- local log = require (' log' )
11- local vshard = require (' vshard' )
1210
1311local dev_checks = require (' crud.common.dev_checks' )
1412local stash = require (' crud.common.stash' )
15- local utils = require (' crud.common.utils' )
1613local op_module = require (' crud.stats.operation' )
1714
1815local StatsError = errors .new_class (' StatsError' , {capture_stack = false })
@@ -249,34 +246,6 @@ function stats.get(space_name)
249246 return internal :get_registry ().get (space_name )
250247end
251248
252- local function resolve_space_name (space_id )
253- -- Resolving name with custom vshard router is not supported.
254- local vshard_router = vshard .router .static
255-
256- if vshard_router == nil then
257- log .warn (' Failed to resolve space name for stats: default vshard router not found' )
258- return nil
259- end
260-
261- local replicasets = vshard_router :routeall ()
262- if next (replicasets ) == nil then
263- log .warn (' Failed to resolve space name for stats: no replicasets found with default router' )
264- return nil
265- end
266-
267- local space , err = utils .get_space (space_id , vshard_router )
268- if err ~= nil then
269- log .warn (" An error occurred during getting space: %s" , err )
270- return nil
271- end
272- if space == nil then
273- log .warn (' Failed to resolve space name for stats: no space found for id %d with default router' , space_id )
274- return nil
275- end
276-
277- return space .name
278- end
279-
280249-- Hack to set __gc for a table in Lua 5.1
281250-- See https://stackoverflow.com/questions/27426704/lua-5-1-workaround-for-gc-metamethod-for-tables
282251-- or https://habr.com/ru/post/346892/
@@ -351,26 +320,13 @@ local function wrap_pairs_gen(build_latency, space_name, op, gen, param, state)
351320end
352321
353322local function wrap_tail (space_name , op , pairs , start_time , call_status , ...)
354- dev_checks (' string|number ' , ' string' , ' boolean' , ' number' , ' boolean' )
323+ dev_checks (' string' , ' string' , ' boolean' , ' number' , ' boolean' )
355324
356325 local finish_time = clock .monotonic ()
357326 local latency = finish_time - start_time
358327
359328 local registry = internal :get_registry ()
360329
361- -- If space id is provided instead of name, try to resolve name.
362- -- If resolve have failed, use id as string to observe space.
363- -- If using space id will be deprecated, remove this code as well,
364- -- see https://github.com/tarantool/crud/issues/255
365- if type (space_name ) ~= ' string' then
366- local name = resolve_space_name (space_name )
367- if name ~= nil then
368- space_name = name
369- else
370- space_name = tostring (space_name )
371- end
372- end
373-
374330 if call_status == false then
375331 registry .observe (latency , space_name , op , ' error' )
376332 error ((... ), 2 )
0 commit comments