@@ -7,12 +7,9 @@ local checks = require('checks')
7
7
local errors = require (' errors' )
8
8
local fiber = require (' fiber' )
9
9
local fun = require (' fun' )
10
- local log = require (' log' )
11
- local vshard = require (' vshard' )
12
10
13
11
local dev_checks = require (' crud.common.dev_checks' )
14
12
local stash = require (' crud.common.stash' )
15
- local utils = require (' crud.common.utils' )
16
13
local op_module = require (' crud.stats.operation' )
17
14
18
15
local StatsError = errors .new_class (' StatsError' , {capture_stack = false })
@@ -249,34 +246,6 @@ function stats.get(space_name)
249
246
return internal :get_registry ().get (space_name )
250
247
end
251
248
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
-
280
249
-- Hack to set __gc for a table in Lua 5.1
281
250
-- See https://stackoverflow.com/questions/27426704/lua-5-1-workaround-for-gc-metamethod-for-tables
282
251
-- or https://habr.com/ru/post/346892/
@@ -351,26 +320,13 @@ local function wrap_pairs_gen(build_latency, space_name, op, gen, param, state)
351
320
end
352
321
353
322
local 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' )
355
324
356
325
local finish_time = clock .monotonic ()
357
326
local latency = finish_time - start_time
358
327
359
328
local registry = internal :get_registry ()
360
329
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
-
374
330
if call_status == false then
375
331
registry .observe (latency , space_name , op , ' error' )
376
332
error ((... ), 2 )
0 commit comments