Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Counter ¶
Counter prometheus.counter(config) return lua (user data, error) config table:
{ namespace="node_scout", subsystem="nf_conntrack", name="insert_failed", help="insert_failed from nf_conntrack", labels={"one", "two"}, -- optional }
func Gauge ¶
Gauge prometheus.gauge(config) return lua (user data, error) config table:
{ namespace="node_scout", subsystem="nf_conntrack", name="insert_failed", help="insert_failed from nf_conntrack", labels={"one", "two"}, -- optional }
func Preload ¶
Preload adds prometheus to the given Lua state's package.preload table. After it has been preloaded, it can be loaded using require:
local prometheus = require("prometheus")
func Start ¶
Start prometheus_client_ud
Example ¶
prometheus:start(string)
package main import ( "log" "github.com/vadv/gopher-lua-libs/http" prometheus "github.com/vadv/gopher-lua-libs/prometheus/client" "github.com/vadv/gopher-lua-libs/time" lua "github.com/yuin/gopher-lua" ) func main() { state := lua.NewState() prometheus.Preload(state) time.Preload(state) http.Preload(state) source := ` local prometheus = require("prometheus") local time = require("time") local http = require("http_client") local pp = prometheus.register(":18080") pp:start() time.sleep(1) local client = http.client({timeout=5}) local request = http.request("GET", "http://127.0.0.1:18080/") local result = client:do_request(request) print(result.code) local request = http.request("GET", "http://127.0.0.1:18080/metrics") local result = client:do_request(request) print(result.code) ` if err := state.DoString(source); err != nil { log.Fatal(err.Error()) } }
Output: 404 200
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.