aboutsummaryrefslogtreecommitdiffstats
path: root/core/moduleapi.lua
Commit message (Collapse)AuthorAgeFilesLines
* core.moduleapi: Filter out unrelated direct replies to module:send_iqKim Alvefur2021-09-241-1/+4
| | | | | | | | | | | This is primarily something that happens with an internal query to mod_mam, which calls origin.send() several times with results, leading to the first such result being treated as the final response and resolving the promise. Now, these responses pass trough to the underlying origin.send(), where they can be caught. Tricky but not impossible. For remote queries, it's even trickier, you would likely need to bind a resource or similar.
* Statistics: Rewrite statistics backends to use OpenMetricsJonas Schäfer2021-04-181-19/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The metric subsystem of Prosody has had some shortcomings from the perspective of the current state-of-the-art in metric observability. The OpenMetrics standard [0] is a formalization of the data model (and serialization format) of the well-known and widely-used Prometheus [1] software stack. The previous stats subsystem of Prosody did not map well to that format (see e.g. [2] and [3]); the key reason is that it was trying to do too much math on its own ([2]) while lacking first-class support for "families" of metrics ([3]) and structured metric metadata (despite the `extra` argument to metrics, there was no standard way of representing common things like "tags" or "labels"). Even though OpenMetrics has grown from the Prometheus world of monitoring, it maps well to other popular monitoring stacks such as: - InfluxDB (labels can be mapped to tags and fields as necessary) - Carbon/Graphite (labels can be attached to the metric name with dot-separation) - StatsD (see graphite when assuming that graphite is used as backend, which is the default) The util.statsd module has been ported to use the OpenMetrics model as a proof of concept. An implementation which exposes the util.statistics backend data as Prometheus metrics is ready for publishing in prosody-modules (most likely as mod_openmetrics_prometheus to avoid breaking existing 0.11 deployments). At the same time, the previous measure()-based API had one major advantage: It is really simple and easy to use without requiring lots of knowledge about OpenMetrics or similar concepts. For that reason as well as compatibility with existing code, it is preserved and may even be extended in the future. However, code relying on the `stats-updated` event as well as `get_stats` from `statsmanager` will break because the data model has changed completely; in case of `stats-updated`, the code will simply not run (as the event was renamed in order to avoid conflicts); the `get_stats` function has been removed completely (so it will cause a traceback when it is attempted to be used). Note that the measure_*_event methods have been removed from the module API. I was unable to find any uses or documentation and thus deemed they should not be ported. Re-implementation is possible when necessary. [0]: https://openmetrics.io/ [1]: https://prometheus.io/ [2]: #959 [3]: #960
* core.moduleapi: Return resource path from module:get_directory() (API BC)Kim Alvefur2020-10-091-2/+2
| | | | | | | | | | | | | | | | | | | :get_directory has so far returned the base directory of the current module source code. This has worked well so far to load resources which tend to be included in the same directory, but with the plugin installer using LuaRocks, extra resources (e.g. templates and other assets) these are saved in a completely different directory. In be73df6765b9 core.modulemanager gained some code for finding that directory and saving it in module.resource_path but now the question is how this should be reflected in the API. A survey of community modules suggest the vast majority use the :get_directory method for locating templates and other assets, rather than the code (which would use module:require instead). Therefore this commit changes :get_directory to return the resource_path when available. This should work for most modules.
* core.moduleapi: Use resource path for :load_resource()Kim Alvefur2020-10-071-1/+1
|
* core.moduleapi: Allow passing a config table trough :measureKim Alvefur2019-01-041-2/+2
|
* moduleapi: Rename argument to silence luacheckKim Alvefur2020-04-011-2/+2
|
* moduleapi: Fix handling of replies to :send_iq from internal modulesKim Alvefur2020-03-221-1/+10
| | | | | Unclear exactly why, but replies to some queries to local modules would be discarded by stanza_router. This appears to fix it.
* core.moduleapi: Hook correct event type in some casesKim Alvefur2020-01-161-1/+2
| | | | | In rare cases, module.host can be a bare JID, in which case this test did the wrong thing.
* core.moduleapi: Rename local name for util.error for consistencyKim Alvefur2019-12-301-6/+6
| | | | It's called 'errors' everywhere else except here.
* core.moduleapi: Fix error context in :send_iq APIKim Alvefur2019-12-301-1/+1
| | | | | It got passed as argument to reject() instead of the util.error function and was lost.
* core.moduleapi: Restructure send_iq method for more atomic cleanupKim Alvefur2019-08-211-16/+23
| | | | | All cleanup in one spot instead of two, and at the end which fits with cleanup happening afterwards.
* core.moduleapi: Uppercase "IQ stanza" for consistencyKim Alvefur2019-08-211-1/+1
| | | | It's written like that elsewhere in the send_iq method
* moduleapi: Log suppressed status priority and message when not overridingMatthew Wild2019-03-261-1/+1
|
* moduleapi: Remove overly-verbose debug logging on module status changeMatthew Wild2019-03-261-1/+0
|
* moduleapi: New API for modules to set a statusMatthew Wild2019-03-191-0/+31
|
* core.moduleapi: Use convenience function for creating error object from stanzaKim Alvefur2018-12-301-3/+1
|
* core.moduleapi: Use util.error for :send_iq errorsKim Alvefur2018-12-301-5/+21
|
* core.moduleapi: Move util imports to topKim Alvefur2018-12-301-2/+4
|
* core.moduleapi: Add a promise-based API for tracking IQ stanzas (fixes #714)Kim Alvefur2018-12-281-0/+65
|
* moduleapi: Use pack from util.tableKim Alvefur2018-12-081-1/+1
|
* moduleapi: Prevent loading disabled module as dependency of enabled oneKim Alvefur2018-10-251-3/+3
| | | | Explicitly disabled module should stay disabled.
* core.moduleapi: Remove redundant conditionKim Alvefur2018-10-181-1/+1
|
* moduleapi: Remove multiple-parameters feature from module:shared()Matthew Wild2018-08-081-25/+24
| | | | | | Multiple paths are rarely used, and leads to less clear code than just calling module:shared() once per shared table. It also prevents us from extending the API with new parameters in the future.
* moduleapi: Use :send API from :broadcast for compactnessKim Alvefur2018-07-141-1/+1
|
* moduleapi: Lazy-load statsmanager on demandKim Alvefur2018-07-071-1/+1
|
* moduleapi: Lazy-load configmanager on demand simplify dependency graphKim Alvefur2018-07-071-1/+1
|
* moduleapi: Remove unused and undocumented :has_feature and :has_identityKim Alvefur2018-02-231-14/+0
|
* moduleapi: Warn if a module being loaded as a dependency has been disabledKim Alvefur2017-12-271-0/+3
|
* Merge 0.10->trunkKim Alvefur2017-03-161-15/+8
|\
| * core.moduleapi: Factor out code for getting a scalar config optionKim Alvefur2017-03-151-15/+8
| |
* | Merge 0.10->trunkKim Alvefur2017-03-061-2/+4
|\|
| * core: Split some very long lines [luacheck]Kim Alvefur2017-03-041-2/+4
| |
* | Merge 0.10->trunkMatthew Wild2016-08-311-1/+1
|\|
| * moduleapi: 'duration' became 'times'Matthew Wild2016-08-311-1/+1
| |
* | Merge 0.10->trunkKim Alvefur2016-04-071-2/+2
|\|
| * moduleapi: Allow an origin session to be passed to module:send()Kim Alvefur2016-04-061-2/+2
| |
* | Merge 0.10->trunkKim Alvefur2016-02-181-1/+1
|\|
| * loggingmanager,modulemanager,moduleapi: Ignore warning about accessing ↵Kim Alvefur2016-02-181-1/+1
| | | | | | | | _G.unpack [luacheck]
| * loggingmanager,modulemanager,moduleapi: Localize unpack compatible with Lua 5.2+Kim Alvefur2016-02-181-1/+2
| |
* | moduleapi: Silence luacheck warning about unused 'id' parameterMatthew Wild2016-02-051-1/+1
| |
* | Merge 0.10->trunkMatthew Wild2016-02-051-0/+14
|\|
| * moduleapi: Add API method for getting a file pathKim Alvefur2016-02-041-0/+14
| |
* | Merge 0.10->trunkMatthew Wild2016-02-011-4/+1
|\|
| * modulemanager, util.pluginloader: Move logic for locating some module ↵Matthew Wild2016-02-011-4/+1
| | | | | | | | libraries to pluginloader, to fix problems with non-filesystem errors being masked by the second load_code call
* | Merge 0.10->trunkKim Alvefur2015-08-201-6/+2
|\|
| * core.*: Remove use of module() functionKim Alvefur2015-02-211-6/+2
| |
* | Merge 0.10->trunkMatthew Wild2015-05-061-18/+29
|\|
| * moduleapi: Import util.stanza required for module:broadcast()Matthew Wild2015-05-061-0/+1
| |
| * moduleapi: Add luacheck annotationMatthew Wild2015-05-061-1/+1
| |
| * moduleapi: Minor variable renaming to avoid clashes with the 'type' functionMatthew Wild2015-05-061-14/+14
| |