Skip to content

Commit 324f50a

Browse files
rock: override built-in metrics
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
1 parent b397c2e commit 324f50a

File tree

7 files changed

+20
-10
lines changed

7 files changed

+20
-10
lines changed

.github/workflows/packaging.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ jobs:
2121
with:
2222
module-name: 'metrics'
2323
version-pre-extraction-hook: |
24-
local rock_utils = require('test.rock_utils')
25-
rock_utils.remove_builtin('metrics')
26-
rock_utils.assert_nonbuiltin('metrics')
24+
require('test.rock_utils').assert_nonbuiltin('metrics')
2725
2826
package:
2927
# Skip pull request jobs when the source branch is in the same

.github/workflows/push_rockspec.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ jobs:
2424
with:
2525
module-name: 'metrics'
2626
version-pre-extraction-hook: |
27-
local rock_utils = require('test.rock_utils')
28-
rock_utils.remove_builtin('metrics')
29-
rock_utils.assert_nonbuiltin('metrics')
27+
require('test.rock_utils').assert_nonbuiltin('metrics')
3028
3129
push-scm-rockspec:
3230
runs-on: [ ubuntu-20.04 ]

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ doc/locale/en/
1717
*.lua.c
1818

1919
build.luarocks
20+
packpack

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2323
- simultaneous `include` and `exclude` arguments
2424
(`exclude` has higher priority)
2525
- Build rock with cmake
26+
- Override built-in metrics, if installed
2627

2728
### Deprecated
2829
- Passing nonexistent metrics to `enable_default_metrics()`

CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,13 @@ install(
1818
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cartridge
1919
DESTINATION ${TARANTOOL_INSTALL_LUADIR}
2020
)
21+
22+
install(
23+
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}
24+
DESTINATION ${TARANTOOL_INSTALL_LUADIR}/override
25+
)
26+
27+
install(
28+
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cartridge
29+
DESTINATION ${TARANTOOL_INSTALL_LUADIR}/override
30+
)

rpm/tarantool-metrics.spec

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,14 @@ Easy collecting, storing and manipulating metrics timeseriess.
2323
mkdir -p %{br_luapkgdir}
2424
cp -rv metrics %{br_luapkgdir}
2525
cp -rv cartridge %{br_luapkgdir}
26+
mkdir %{br_luapkgdir}/override
27+
cp -rv metrics %{br_luapkgdir}/override
28+
cp -rv cartridge %{br_luapkgdir}/override
2629

2730
%files
2831
%{luapkgdir}/metrics
2932
%{luapkgdir}/cartridge
33+
%{luapkgdir}/override
3034

3135
%doc README.md
3236
%doc doc/monitoring/getting_started.rst

test/helper.lua

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
require('strict').on()
22

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

86

97
local fio = require('fio')

0 commit comments

Comments
 (0)