Skip to content

Commit

Permalink
Fix LJ metrics naming (#393)
Browse files Browse the repository at this point in the history
Co-authored-by: Igor Zolotarev <i.zolotarev@corp.mail.ru>
  • Loading branch information
Andrei Sidorov and yngvar-antonsson authored Aug 9, 2022
1 parent 53576e0 commit d4df067
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 1 deletion.
31 changes: 30 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,39 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `tnt_election_vote`
- `tnt_election_leader`
- `tnt_election_term`
- Renamed LuaJit metrics:
- `lj_gc_allocated_total`
- `lj_gc_freed_total`
- `lj_gc_steps_atomic_total`
- `lj_gc_steps_finalize_total`
- `lj_gc_steps_pause_total`
- `lj_gc_steps_propagate_total`
- `lj_gc_steps_sweep_total`
- `lj_gc_steps_sweepstring_total`
- `lj_jit_snap_restore_total`
- `lj_jit_trace_abort_total`
- `lj_strhash_hit_total`
- `lj_strhash_miss_total`

### Deprecated

- Metrics:
- `lj_gc_allocated`
- `lj_gc_freed`
- `lj_gc_steps_atomic`
- `lj_gc_steps_finalize`
- `lj_gc_steps_pause`
- `lj_gc_steps_propagate`
- `lj_gc_steps_sweep`
- `lj_gc_steps_sweepstring`
- `lj_jit_snap_restore`
- `lj_jit_trace_abort`
- `lj_strhash_hit`
- `lj_strhash_miss`

### Removed

- Deprecated metrics
- Deprecated metrics from previous releases

## [0.14.0] - 2022-06-28
### Fixed
Expand Down
4 changes: 4 additions & 0 deletions metrics/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ return {
invoke_callbacks = invoke_callbacks,
set_global_labels = set_global_labels,
enable_default_metrics = function(include, exclude)
require('log').warn('metrics lj_gc_allocated, lj_gc_freed, lj_gc_steps_atomic, '..
'lj_gc_steps_finalize, lj_gc_steps_pause, lj_gc_steps_propagate, lj_gc_steps_sweep, ' ..
'lj_gc_steps_sweepstring, lj_jit_snap_restore, lj_jit_trace_abort, lj_strhash_hit, ' ..
'lj_strhash_miss are deprecated and will be removed in next releases.')
require('metrics.tarantool').enable(include, exclude)
end,
http_middleware = require('metrics.http_middleware'),
Expand Down
35 changes: 35 additions & 0 deletions metrics/tarantool/luajit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,31 @@ local function update()
local lj_metrics = misc.getmetrics()
collectors_list.gc_freed =
utils.set_counter('gc_freed', 'Total amount of freed memory', lj_metrics.gc_freed, nil, LJ_PREFIX)
collectors_list.gc_freed_total =
utils.set_counter('gc_freed_total', 'Total amount of freed memory', lj_metrics.gc_freed, nil, LJ_PREFIX)
collectors_list.strhash_hit =
utils.set_counter('strhash_hit', 'Number of strings being interned', lj_metrics.strhash_hit, nil, LJ_PREFIX)
collectors_list.strhash_hit_total =
utils.set_counter('strhash_hit_total', 'Total number of strings being interned',
lj_metrics.strhash_hit, nil, LJ_PREFIX)
collectors_list.gc_steps_atomic =
utils.set_counter('gc_steps_atomic', 'Count of incremental GC steps (atomic state)',
lj_metrics.gc_steps_atomic, nil, LJ_PREFIX)
collectors_list.gc_steps_atomic_total =
utils.set_counter('gc_steps_atomic_total', 'Total count of incremental GC steps (atomic state)',
lj_metrics.gc_steps_atomic, nil, LJ_PREFIX)
collectors_list.strhash_miss =
utils.set_counter('strhash_miss', 'Total number of strings allocations during the platform lifetime',
lj_metrics.strhash_miss, nil, LJ_PREFIX)
collectors_list.strhash_miss_total =
utils.set_counter('strhash_miss_total', 'Total number of strings allocations during the platform lifetime',
lj_metrics.strhash_miss, nil, LJ_PREFIX)
collectors_list.gc_steps_sweepstring =
utils.set_counter('gc_steps_sweepstring', 'Count of incremental GC steps (sweepstring state)',
lj_metrics.gc_steps_sweepstring, nil, LJ_PREFIX)
collectors_list.gc_steps_sweepstring_total =
utils.set_counter('gc_steps_sweepstring_total', 'Total count of incremental GC steps (sweepstring state)',
lj_metrics.gc_steps_sweepstring, nil, LJ_PREFIX)
collectors_list.gc_strnum =
utils.set_gauge('gc_strnum', 'Amount of allocated string objects', lj_metrics.gc_strnum, nil, LJ_PREFIX)
collectors_list.gc_tabnum =
Expand All @@ -34,32 +48,53 @@ local function update()
collectors_list.jit_snap_restore =
utils.set_counter('jit_snap_restore', 'Overall number of snap restores',
lj_metrics.jit_snap_restore, nil, LJ_PREFIX)
collectors_list.jit_snap_restore_total =
utils.set_counter('jit_snap_restore_total', 'Overall number of snap restores',
lj_metrics.jit_snap_restore, nil, LJ_PREFIX)
collectors_list.gc_memory =
utils.set_gauge('gc_memory', 'Memory currently allocated', lj_metrics.gc_total, nil, LJ_PREFIX)
collectors_list.gc_udatanum =
utils.set_gauge('gc_udatanum', 'Amount of allocated udata objects', lj_metrics.gc_udatanum, nil, LJ_PREFIX)
collectors_list.gc_steps_finalize =
utils.set_counter('gc_steps_finalize', 'Count of incremental GC steps (finalize state)',
lj_metrics.gc_steps_finalize, nil, LJ_PREFIX)
collectors_list.gc_steps_finalize_total =
utils.set_counter('gc_steps_finalize_total', 'Total count of incremental GC steps (finalize state)',
lj_metrics.gc_steps_finalize, nil, LJ_PREFIX)
collectors_list.gc_allocated =
utils.set_counter('gc_allocated', 'Total amount of allocated memory', lj_metrics.gc_allocated, nil, LJ_PREFIX)
collectors_list.gc_allocated_total =
utils.set_counter('gc_allocated_total', 'Total amount of allocated memory',
lj_metrics.gc_allocated, nil, LJ_PREFIX)
collectors_list.jit_trace_num =
utils.set_gauge('jit_trace_num', 'Amount of JIT traces', lj_metrics.jit_trace_num, nil, LJ_PREFIX)
collectors_list.gc_steps_sweep =
utils.set_counter('gc_steps_sweep', 'Count of incremental GC steps (sweep state)',
lj_metrics.gc_steps_sweep, nil, LJ_PREFIX)
collectors_list.gc_steps_sweep_total =
utils.set_counter('gc_steps_sweep_total', 'Total count of incremental GC steps (sweep state)',
lj_metrics.gc_steps_sweep, nil, LJ_PREFIX)
collectors_list.jit_trace_abort =
utils.set_counter('jit_trace_abort', 'Overall number of abort traces',
lj_metrics.jit_trace_abort, nil, LJ_PREFIX)
collectors_list.jit_trace_abort_total =
utils.set_counter('jit_trace_abort_total', 'Overall number of abort traces',
lj_metrics.jit_trace_abort, nil, LJ_PREFIX)
collectors_list.jit_mcode_size =
utils.set_gauge('jit_mcode_size', 'Total size of all allocated machine code areas',
lj_metrics.jit_mcode_size, nil, LJ_PREFIX)
collectors_list.gc_steps_propagate =
utils.set_counter('gc_steps_propagate', 'Count of incremental GC steps (propagate state)',
lj_metrics.gc_steps_propagate, nil, LJ_PREFIX)
collectors_list.gc_steps_propagate_total =
utils.set_counter('gc_steps_propagate_total', 'Total count of incremental GC steps (propagate state)',
lj_metrics.gc_steps_propagate, nil, LJ_PREFIX)
collectors_list.gc_steps_pause =
utils.set_counter('gc_steps_pause', 'Count of incremental GC steps (pause state)',
lj_metrics.gc_steps_pause, nil, LJ_PREFIX)
collectors_list.gc_steps_pause_total =
utils.set_counter('gc_steps_pause_total', 'Total count of incremental GC steps (pause state)',
lj_metrics.gc_steps_pause, nil, LJ_PREFIX)
end

return {
Expand Down
12 changes: 12 additions & 0 deletions test/tarantool/lj_metrics_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,36 @@ g.test_lj_metrics = function()

local expected_lj_metrics = {
"lj_gc_freed",
"lj_gc_freed_total",
"lj_strhash_hit",
"lj_strhash_hit_total",
"lj_gc_steps_atomic",
"lj_gc_steps_atomic_total",
"lj_strhash_miss",
"lj_strhash_miss_total",
"lj_gc_steps_sweepstring",
"lj_gc_steps_sweepstring_total",
"lj_gc_strnum",
"lj_gc_tabnum",
"lj_gc_cdatanum",
"lj_jit_snap_restore",
"lj_jit_snap_restore_total",
"lj_gc_memory",
"lj_gc_udatanum",
"lj_gc_steps_finalize",
"lj_gc_steps_finalize_total",
"lj_gc_allocated",
"lj_gc_allocated_total",
"lj_jit_trace_num",
"lj_gc_steps_sweep",
"lj_gc_steps_sweep_total",
"lj_jit_trace_abort",
"lj_jit_trace_abort_total",
"lj_jit_mcode_size",
"lj_gc_steps_propagate",
"lj_gc_steps_propagate_total",
"lj_gc_steps_pause",
"lj_gc_steps_pause_total",
}

t.assert_items_equals(lj_metrics, expected_lj_metrics)
Expand Down

0 comments on commit d4df067

Please sign in to comment.