• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tarantool / tarantool / 12077912174
88%

Build:
DEFAULT BRANCH: master
Ran 29 Nov 2024 02:49AM UTC
Jobs 1
Files 518
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

29 Nov 2024 02:18AM UTC coverage: 87.332% (-0.004%) from 87.336%
12077912174

push

github

Totktonada
config: add alerts namespaces

This patch adds public API to raise alerts.

Closes #10873
Closes TNTP-226

@TarantoolBot document
Title: Public alerts API

Users can now raise their own alerts (similar to the alerts raised by
the `config` module).

New available methods:
- `config:new_alerts_namespace(alerts_namespace_name)` - creates a new
  alerts namespaces and returns it. `alerts_namespace_name` must be a
  string and can not contain a colon (":").
- `alerts_namespace:add(alert)` - raises new alert of type warning.
  `alert` must be a table. `alert.message` is logged and the alert will
  be shown in `box.info.config.alerts`.
- `alerts_namespace:set(key, alert)` - raises new alert of type warning,
  or replaces an existing, raised with the same 'key' in the namespace.
  `alert` must be a table. `alert.message` is logged and the alert will
  be shown in `box.info.config.alerts`. `key` must be a string and can
  not contain a colon (":").
- `alerts_namespace:unset(key)` - discards the alert with the
  corresponding 'key' in the namespace. `key` must be a
  string and can not contain a colon (":"). If an alert with the
  corresponding key does not exist in the namespace, does nothing.
- `alerts_namespace:clear()` - discards all alerts from the namespace,
  removing them from `box.info.config.alerts`.

Alerts namespaces with the same name will point to the same alerts
namespace. During configuration update all alerts from namespaces are
removed from `box.info.config.alerts`.

The `alert.type` is forced to be `"warn"`, anything except `"warn"` or
`nil` is considered an error.

Any keys in `alert` which start with an underscore will be ignored.

Example usage:

```lua
local config = require('config')

-- Create a new alerts namespace 'my_alerts'.
local alerts = config:new_alerts_namespace('my_alerts')

-- Raise a new alert.
alerts:add({
    message = 'Test alert',
    my_field = 'my_value',
})

-- Raise a new alert with a key.
alerts:set("my_alert", {
  ... (continued)

69506 of 123342 branches covered (56.35%)

102432 of 117291 relevant lines covered (87.33%)

2868578.39 hits per line

Jobs
ID Job ID Ran Files Coverage
1 12077912174.1 29 Nov 2024 02:49AM UTC 0
87.33
GitHub Action Run
Source Files on build 12077912174
Detailed source file information is not available for this build.
  • Back to Repo
  • 46913462 on github
  • Prev Build on master (#12077515526)
  • Next Build on master (#12078228676)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc