comparison mod_prometheus/mod_prometheus.lua @ 3952:343dc9dd70dd

mod_prometheus: Ensure mod_http is loaded where the http interface is exposed (thanks Martin) Loading mod_http globally does not have the desired effect, it needs to be loaded in the host context where module:provides is called.
author Kim Alvefur <zash@zash.se>
date Sat, 21 Mar 2020 18:05:22 +0100
parents ccbfe7df02dc
children fb4a50bf60f1
comparison
equal deleted inserted replaced
3951:32d9d155a9b9 3952:343dc9dd70dd
4 -- Copyright (C) 2018 Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> 4 -- Copyright (C) 2018 Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
5 -- 5 --
6 -- This module is MIT/X11 licensed. 6 -- This module is MIT/X11 licensed.
7 7
8 module:set_global(); 8 module:set_global();
9 module:depends "http";
10 9
11 local tostring = tostring; 10 local tostring = tostring;
12 local t_insert = table.insert; 11 local t_insert = table.insert;
13 local t_concat = table.concat; 12 local t_concat = table.concat;
14 local socket = require "socket"; 13 local socket = require "socket";
138 end 137 end
139 return t_concat(answer, ""); 138 return t_concat(answer, "");
140 end 139 end
141 140
142 function module.add_host(module) 141 function module.add_host(module)
142 module:depends "http";
143 module:provides("http", { 143 module:provides("http", {
144 default_path = "metrics"; 144 default_path = "metrics";
145 route = { 145 route = {
146 GET = get_metrics; 146 GET = get_metrics;
147 }; 147 };