Skip to content

Commit

Permalink
Files structure changed (#279)
Browse files Browse the repository at this point in the history
Massive repo refactoring:

- move metrics/default_metrics/tarantool to metrics/tarantool
- rename files like submodule/init.lua to submodule.lua
- tests structure tries to follow repo structure
- move some tests to another files (e.g. collectors tests)
- remove average collector
- rename promtool_test.lua to promtool.lua to not be run with other tests
- add init function in tests
  • Loading branch information
yngvar-antonsson authored Aug 31, 2021
1 parent 3b3405c commit 79f6b15
Show file tree
Hide file tree
Showing 43 changed files with 457 additions and 642 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- collector's method `remove` to clear observations with given label pairs [#263](https://github.com/tarantool/metrics/issues/263)
- `counter:reset()` method [#260](https://github.com/tarantool/metrics/issues/260)

### Removed
- Average collector

## [0.10.0] - 2021-08-03
### Changed
- metrics registry refactoring to search with `O(1)` [#188](https://github.com/tarantool/metrics/issues/188)
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ test_with_coverage_report: .rocks

.PHONY: test_promtool
test_promtool: .rocks
tarantool test/promtool_test.lua
tarantool test/promtool.lua
cat prometheus-input | promtool check metrics
rm prometheus-input

update-pot:
sphinx-build doc/monitoring doc/locale/en/ -c doc/ -d doc/.doctrees -b gettext
Expand Down
69 changes: 34 additions & 35 deletions metrics-scm-1.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,41 +22,40 @@ build = {
type = 'builtin',

modules = {
['metrics'] = 'metrics/init.lua',
['metrics.registry'] = 'metrics/registry.lua',
['metrics.quantile'] = 'metrics/quantile.lua',
['metrics.http_middleware'] = 'metrics/http_middleware.lua',
['metrics.collectors.shared'] = 'metrics/collectors/shared.lua',
['metrics.collectors.average'] = 'metrics/collectors/average.lua',
['metrics.collectors.summary'] = 'metrics/collectors/summary.lua',
['metrics.collectors.counter'] = 'metrics/collectors/counter.lua',
['metrics.collectors.gauge'] = 'metrics/collectors/gauge.lua',
['metrics.collectors.histogram'] = 'metrics/collectors/histogram.lua',
['metrics.plugins.graphite'] = 'metrics/plugins/graphite/init.lua',
['metrics.plugins.prometheus'] = 'metrics/plugins/prometheus/init.lua',
['metrics.plugins.json'] = 'metrics/plugins/json/init.lua',
['metrics.default_metrics.tarantool'] = 'metrics/default_metrics/tarantool/init.lua',
['metrics.default_metrics.tarantool.fibers'] = 'metrics/default_metrics/tarantool/fibers.lua',
['metrics.default_metrics.tarantool.info'] = 'metrics/default_metrics/tarantool/info.lua',
['metrics.default_metrics.tarantool.memory'] = 'metrics/default_metrics/tarantool/memory.lua',
['metrics.default_metrics.tarantool.network'] = 'metrics/default_metrics/tarantool/network.lua',
['metrics.default_metrics.tarantool.operations'] = 'metrics/default_metrics/tarantool/operations.lua',
['metrics.default_metrics.tarantool.replicas'] = 'metrics/default_metrics/tarantool/replicas.lua',
['metrics.default_metrics.tarantool.runtime'] = 'metrics/default_metrics/tarantool/runtime.lua',
['metrics.default_metrics.tarantool.slab'] = 'metrics/default_metrics/tarantool/slab.lua',
['metrics.default_metrics.tarantool.spaces'] = 'metrics/default_metrics/tarantool/spaces.lua',
['metrics.default_metrics.tarantool.system'] = 'metrics/default_metrics/tarantool/system.lua',
['metrics.default_metrics.tarantool.cpu'] = 'metrics/default_metrics/tarantool/cpu.lua',
['metrics.cartridge'] = 'metrics/cartridge.lua',
['metrics.cartridge.issues'] = 'metrics/cartridge/issues.lua',
['metrics.cartridge.clock'] = 'metrics/cartridge/clock.lua',
['metrics.psutils.cpu'] = 'metrics/psutils/cpu.lua',
['metrics.psutils.psutils_linux'] = 'metrics/psutils/psutils_linux.lua',
['metrics.tarantool.luajit'] = 'metrics/tarantool/luajit.lua',
['metrics.tarantool.vinyl'] = 'metrics/tarantool/vinyl.lua',
['metrics.utils'] = 'metrics/utils.lua',
['cartridge.roles.metrics'] = 'cartridge/roles/metrics.lua',
['cartridge.health'] = 'cartridge/health.lua',
['metrics'] = 'metrics/init.lua',
['metrics.registry'] = 'metrics/registry.lua',
['metrics.quantile'] = 'metrics/quantile.lua',
['metrics.http_middleware'] = 'metrics/http_middleware.lua',
['metrics.collectors.shared'] = 'metrics/collectors/shared.lua',
['metrics.collectors.summary'] = 'metrics/collectors/summary.lua',
['metrics.collectors.counter'] = 'metrics/collectors/counter.lua',
['metrics.collectors.gauge'] = 'metrics/collectors/gauge.lua',
['metrics.collectors.histogram'] = 'metrics/collectors/histogram.lua',
['metrics.plugins.graphite'] = 'metrics/plugins/graphite.lua',
['metrics.plugins.prometheus'] = 'metrics/plugins/prometheus.lua',
['metrics.plugins.json'] = 'metrics/plugins/json.lua',
['metrics.tarantool'] = 'metrics/tarantool.lua',
['metrics.tarantool.fibers'] = 'metrics/tarantool/fibers.lua',
['metrics.tarantool.info'] = 'metrics/tarantool/info.lua',
['metrics.tarantool.memory'] = 'metrics/tarantool/memory.lua',
['metrics.tarantool.network'] = 'metrics/tarantool/network.lua',
['metrics.tarantool.operations'] = 'metrics/tarantool/operations.lua',
['metrics.tarantool.replicas'] = 'metrics/tarantool/replicas.lua',
['metrics.tarantool.runtime'] = 'metrics/tarantool/runtime.lua',
['metrics.tarantool.slab'] = 'metrics/tarantool/slab.lua',
['metrics.tarantool.spaces'] = 'metrics/tarantool/spaces.lua',
['metrics.tarantool.system'] = 'metrics/tarantool/system.lua',
['metrics.tarantool.cpu'] = 'metrics/tarantool/cpu.lua',
['metrics.cartridge'] = 'metrics/cartridge.lua',
['metrics.cartridge.issues'] = 'metrics/cartridge/issues.lua',
['metrics.tarantool.clock'] = 'metrics/tarantool/clock.lua',
['metrics.psutils.cpu'] = 'metrics/psutils/cpu.lua',
['metrics.psutils.psutils_linux'] = 'metrics/psutils/psutils_linux.lua',
['metrics.tarantool.luajit'] = 'metrics/tarantool/luajit.lua',
['metrics.tarantool.vinyl'] = 'metrics/tarantool/vinyl.lua',
['metrics.utils'] = 'metrics/utils.lua',
['cartridge.roles.metrics'] = 'cartridge/roles/metrics.lua',
['cartridge.health'] = 'cartridge/health.lua',
}
}

Expand Down
2 changes: 1 addition & 1 deletion metrics/cartridge.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ local metrics = require('metrics')

local cartridge_metrics = {
require('metrics.cartridge.issues'),
require('metrics.cartridge.clock'),
require('metrics.tarantool.clock'),
}

local function enable()
Expand Down
59 changes: 0 additions & 59 deletions metrics/collectors/average.lua

This file was deleted.

5 changes: 1 addition & 4 deletions metrics/http_middleware.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
local log = require('log')
local export = {}

export.DEFAULT_HISTOGRAM_BUCKETS = {
Expand All @@ -22,7 +21,7 @@ export.DEFAULT_SUMMARY_PARAMS = {

--- Build default histogram collector
--
-- @string[opt='histogram'] type_name `histogram` or `average` or `summary`
-- @string[opt='histogram'] type_name `histogram` or `summary`
-- @string[opt='http_server_requests'] name
-- @string[opt='HTTP Server Requests'] help
-- @return collector
Expand All @@ -35,8 +34,6 @@ function export.build_default_collector(type_name, name, help)
extra = {export.DEFAULT_HISTOGRAM_BUCKETS}
elseif type_name == 'summary' then
extra = {export.DEFAULT_QUANTILES, export.DEFAULT_SUMMARY_PARAMS}
elseif type_name == 'average' then
log.warn('Average collector is deprecated. Use summary collector instead.')
else
error('Unknown collector type_name: ' .. tostring(type_name))
end
Expand Down
2 changes: 1 addition & 1 deletion metrics/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ return {
invoke_callbacks = invoke_callbacks,
set_global_labels = set_global_labels,
enable_default_metrics = function(include, exclude)
require('metrics.default_metrics.tarantool').enable(include, exclude)
require('metrics.tarantool').enable(include, exclude)
end,
enable_cartridge_metrics = function()
log.warn('metrics.enable_cartridge_metrics() is deprecated. Use metrics.enable_default_metrics() instead.')
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
local metrics = require('metrics')

local default_metrics = {
network = require('metrics.default_metrics.tarantool.network'),
operations = require('metrics.default_metrics.tarantool.operations'),
system = require('metrics.default_metrics.tarantool.system'),
replicas = require('metrics.default_metrics.tarantool.replicas'),
info = require('metrics.default_metrics.tarantool.info'),
slab = require('metrics.default_metrics.tarantool.slab'),
runtime = require('metrics.default_metrics.tarantool.runtime'),
memory = require('metrics.default_metrics.tarantool.memory'),
spaces = require('metrics.default_metrics.tarantool.spaces'),
fibers = require('metrics.default_metrics.tarantool.fibers'),
cpu = require('metrics.default_metrics.tarantool.cpu'),
network = require('metrics.tarantool.network'),
operations = require('metrics.tarantool.operations'),
system = require('metrics.tarantool.system'),
replicas = require('metrics.tarantool.replicas'),
info = require('metrics.tarantool.info'),
slab = require('metrics.tarantool.slab'),
runtime = require('metrics.tarantool.runtime'),
memory = require('metrics.tarantool.memory'),
spaces = require('metrics.tarantool.spaces'),
fibers = require('metrics.tarantool.fibers'),
cpu = require('metrics.tarantool.cpu'),
vinyl = require('metrics.tarantool.vinyl'),
luajit = require('metrics.tarantool.luajit'),
cartridge_issues = require('metrics.cartridge.issues'),
clock = require('metrics.cartridge.clock'),
clock = require('metrics.tarantool.clock'),
}

local function delete_collectors(list)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
50 changes: 2 additions & 48 deletions rpm/tarantool-metrics.spec
Original file line number Diff line number Diff line change
Expand Up @@ -25,54 +25,8 @@ cp -rv metrics %{br_luapkgdir}
cp -rv cartridge %{br_luapkgdir}

%files
%dir %{luapkgdir}/metrics
%{luapkgdir}/metrics/init.lua
%{luapkgdir}/metrics/http_middleware.lua
%{luapkgdir}/metrics/registry.lua
%{luapkgdir}/metrics/quantile.lua
%dir %{luapkgdir}/metrics/collectors
%{luapkgdir}/metrics/collectors/counter.lua
%{luapkgdir}/metrics/collectors/average.lua
%{luapkgdir}/metrics/collectors/gauge.lua
%{luapkgdir}/metrics/collectors/histogram.lua
%{luapkgdir}/metrics/collectors/summary.lua
%{luapkgdir}/metrics/collectors/shared.lua
%dir %{luapkgdir}/metrics/plugins
%dir %{luapkgdir}/metrics/plugins/prometheus
%{luapkgdir}/metrics/plugins/prometheus/init.lua
%dir %{luapkgdir}/metrics/plugins/graphite
%{luapkgdir}/metrics/plugins/graphite/init.lua
%dir %{luapkgdir}/metrics/plugins/json
%{luapkgdir}/metrics/plugins/json/init.lua
%dir %{luapkgdir}/metrics/default_metrics
%dir %{luapkgdir}/metrics/default_metrics/tarantool
%{luapkgdir}/metrics/default_metrics/tarantool/fibers.lua
%{luapkgdir}/metrics/default_metrics/tarantool/info.lua
%{luapkgdir}/metrics/default_metrics/tarantool/init.lua
%{luapkgdir}/metrics/default_metrics/tarantool/memory.lua
%{luapkgdir}/metrics/default_metrics/tarantool/network.lua
%{luapkgdir}/metrics/default_metrics/tarantool/operations.lua
%{luapkgdir}/metrics/default_metrics/tarantool/replicas.lua
%{luapkgdir}/metrics/default_metrics/tarantool/runtime.lua
%{luapkgdir}/metrics/default_metrics/tarantool/slab.lua
%{luapkgdir}/metrics/default_metrics/tarantool/spaces.lua
%{luapkgdir}/metrics/default_metrics/tarantool/system.lua
%{luapkgdir}/metrics/default_metrics/tarantool/cpu.lua
%{luapkgdir}/metrics/cartridge.lua
%dir %{luapkgdir}/metrics/cartridge
%{luapkgdir}/metrics/cartridge/issues.lua
%{luapkgdir}/metrics/cartridge/clock.lua
%dir %{luapkgdir}/metrics/psutils
%{luapkgdir}/metrics/psutils/cpu.lua
%{luapkgdir}/metrics/psutils/psutils_linux.lua
%{luapkgdir}/metrics/utils.lua
%dir %{luapkgdir}/metrics/tarantool
%{luapkgdir}/metrics/tarantool/luajit.lua
%{luapkgdir}/metrics/tarantool/vinyl.lua
%dir %{luapkgdir}/cartridge
%{luapkgdir}/cartridge/health.lua
%dir %{luapkgdir}/cartridge/roles
%{luapkgdir}/cartridge/roles/metrics.lua
%{luapkgdir}/metrics
%{luapkgdir}/cartridge

%doc README.md
%doc doc/monitoring/getting_started.rst
Expand Down
33 changes: 0 additions & 33 deletions test/collectors/average_test.lua

This file was deleted.

Loading

0 comments on commit 79f6b15

Please sign in to comment.