Mercurial > prosody-modules
annotate mod_measure_lua/mod_measure_lua.lua @ 5511:0860497152af
mod_http_oauth2: Record hash of client_id to allow future verification
RFC 6819 section 5.2.2.2 states that refresh tokens MUST be bound to the
client. In order to do that, we must record something that can
definitely tie the client to the grant. Since the full client_id is so
large (why we have this client_subset function), a hash is stored
instead.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 02 Jun 2023 10:14:16 +0200 |
parents | 78f1515575ab |
children |
rev | line source |
---|---|
4578
d95fcde6e39d
mod_measure_lua: add openmetrics-spirited way to collect lua memory use
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
1 module:set_global() |
d95fcde6e39d
mod_measure_lua: add openmetrics-spirited way to collect lua memory use
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
2 |
d95fcde6e39d
mod_measure_lua: add openmetrics-spirited way to collect lua memory use
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
3 local custom_metric = require "core.statsmanager".metric |
d95fcde6e39d
mod_measure_lua: add openmetrics-spirited way to collect lua memory use
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
4 local gc_bytes = custom_metric( |
d95fcde6e39d
mod_measure_lua: add openmetrics-spirited way to collect lua memory use
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
5 "gauge", "lua_heap", "bytes", |
d95fcde6e39d
mod_measure_lua: add openmetrics-spirited way to collect lua memory use
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
6 "Memory used by objects under control of the Lua garbage collector" |
d95fcde6e39d
mod_measure_lua: add openmetrics-spirited way to collect lua memory use
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
7 ):with_labels() |
d95fcde6e39d
mod_measure_lua: add openmetrics-spirited way to collect lua memory use
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
8 |
d95fcde6e39d
mod_measure_lua: add openmetrics-spirited way to collect lua memory use
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
9 module:hook("stats-update", function () |
d95fcde6e39d
mod_measure_lua: add openmetrics-spirited way to collect lua memory use
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
10 local kbytes = collectgarbage("count"); |
d95fcde6e39d
mod_measure_lua: add openmetrics-spirited way to collect lua memory use
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
11 gc_bytes:set(kbytes * 1024); |
d95fcde6e39d
mod_measure_lua: add openmetrics-spirited way to collect lua memory use
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
12 end); |
d95fcde6e39d
mod_measure_lua: add openmetrics-spirited way to collect lua memory use
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
13 |
4602
78f1515575ab
mod_measure_lua: Use gauge instead of counter for Lua version (thanks jonas’)
Kim Alvefur <zash@zash.se>
parents:
4601
diff
changeset
|
14 custom_metric("gauge", "lua_info", "", "Lua runtime version", { "version" }):with_labels(_VERSION):set(1); |