Skip to content

Add a method to provide statistics about CRUD operations #224

Closed
@ligurio

Description

@ligurio

Description

This is a raw idea, but I hope it would be useful for CRUD users.

CRUD perform operations on storage servers, and sometimes we need to know how many operations were done on each storage (in tests for #222 and #166). Probably (it's a hypothesis now) our users need such information too. However, we cannot use box.stat on storage servers because CRUD is not a single who uses storage servers, there is at least vshard that can move buckets between servers in background.

In this ticket we need to understand

  • a priority of task
  • a set of counters interested in CRUD users
  • integration with metrics module?

Stat counters in Tarantool

CRUD implements the same interface as in Tarantool (create, replace, update, delete etc) and probably we can inherit stat interface from Tarantool too. See module box.stat:

tarantool> box.stat() -- return 11 tables
---
- DELETE:
    total: 1873949
    rps: 123
  SELECT:
    total: 1237723
    rps: 4099
  INSERT:
    total: 0
    rps: 0
  EVAL:
    total: 0
    rps: 0
  CALL:
    total: 0
    rps: 0
  REPLACE:
    total: 1239123
    rps: 7849
  UPSERT:
    total: 0
    rps: 0
  AUTH:
    total: 0
    rps: 0
  ERROR:
    total: 0
    rps: 0
  EXECUTE:
    total: 0
    rps: 0
  UPDATE:
    total: 0
    rps: 0
...

Stat counters in graphql

Also graphql.0 has a method to provide statistics:

function statistics.new(opts)
    local opts = opts or {}
    local resulting_object_cnt_max = opts.resulting_object_cnt_max
    local fetched_object_cnt_max = opts.fetched_object_cnt_max

    return setmetatable({
        resulting_object_cnt = 0,          -- retire
        fetches_cnt = 0,                   -- fetch
        fetched_object_cnt = 0,            -- fetch
        full_scan_cnt = 0,                 -- fetch
        index_lookup_cnt = 0,              -- fetch
        cache_hits_cnt = 0,                -- cache lookup
        cache_hit_objects_cnt = 0,         -- cache lookup
        limits = {
            resulting_object_cnt_max = resulting_object_cnt_max, -- retire limit
            fetched_object_cnt_max = fetched_object_cnt_max,     -- fetch limit
        }
    }, {
        __index = {
            objects_fetched = objects_fetched,
            objects_retired = objects_retired,
            cache_lookup = cache_lookup,
        }
    })
end

Metadata

Metadata

Labels

featureA new functionality

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions