Skip to content

Commit

Permalink
rock: override built-in metrics
Browse files Browse the repository at this point in the history
The ability to override built-in modules was introduced with [1].
After [2], metrics will be embedded to core Tarantool. The ability to
override them with installed rock will make it possible to use old
Tarantool with new metrics. cartridge role, which was embedded to
tarantool/cartridge in [3], is also would be override.

1. tarantool/tarantool#7774
2. tarantool/tarantool#7725
3. tarantool/cartridge#2047

Closes tarantool/tarantool#7727
  • Loading branch information
DifferentialOrange committed Mar 23, 2023
1 parent b397c2e commit 324f50a
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 10 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ jobs:
with:
module-name: 'metrics'
version-pre-extraction-hook: |
local rock_utils = require('test.rock_utils')
rock_utils.remove_builtin('metrics')
rock_utils.assert_nonbuiltin('metrics')
require('test.rock_utils').assert_nonbuiltin('metrics')
package:
# Skip pull request jobs when the source branch is in the same
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/push_rockspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ jobs:
with:
module-name: 'metrics'
version-pre-extraction-hook: |
local rock_utils = require('test.rock_utils')
rock_utils.remove_builtin('metrics')
rock_utils.assert_nonbuiltin('metrics')
require('test.rock_utils').assert_nonbuiltin('metrics')
push-scm-rockspec:
runs-on: [ ubuntu-20.04 ]
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ doc/locale/en/
*.lua.c

build.luarocks
packpack
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- simultaneous `include` and `exclude` arguments
(`exclude` has higher priority)
- Build rock with cmake
- Override built-in metrics, if installed

### Deprecated
- Passing nonexistent metrics to `enable_default_metrics()`
Expand Down
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,13 @@ install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cartridge
DESTINATION ${TARANTOOL_INSTALL_LUADIR}
)

install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}
DESTINATION ${TARANTOOL_INSTALL_LUADIR}/override
)

install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cartridge
DESTINATION ${TARANTOOL_INSTALL_LUADIR}/override
)
4 changes: 4 additions & 0 deletions rpm/tarantool-metrics.spec
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@ Easy collecting, storing and manipulating metrics timeseriess.
mkdir -p %{br_luapkgdir}
cp -rv metrics %{br_luapkgdir}
cp -rv cartridge %{br_luapkgdir}
mkdir %{br_luapkgdir}/override
cp -rv metrics %{br_luapkgdir}/override
cp -rv cartridge %{br_luapkgdir}/override

%files
%{luapkgdir}/metrics
%{luapkgdir}/cartridge
%{luapkgdir}/override

%doc README.md
%doc doc/monitoring/getting_started.rst
Expand Down
6 changes: 2 additions & 4 deletions test/helper.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
require('strict').on()

-- Clean up built-in metrics to run tests with repository module.
local rock_utils = require('test.rock_utils')
rock_utils.remove_builtin('metrics')
rock_utils.assert_nonbuiltin('metrics')
-- Override should be preferred over built-in.
require('test.rock_utils').assert_nonbuiltin('metrics')


local fio = require('fio')
Expand Down

0 comments on commit 324f50a

Please sign in to comment.