Sha256: c89364ec1608140ece8382059cb6b15c46a43a77cd6a90e505d6b4ffd0533423
Contents?: true
Size: 479 Bytes
Versions: 9
Compression:
Stored size: 479 Bytes
Contents
require "json" monitor.enable_cache monitor.http.mount('/metrics.json', ->(env) { metrics = monitor.cached match = env['PATH_INFO'] match = (match.length == 0 || match == '/') ? nil : %r{^(?:#{ match.sub(/^\//, '').split(/&/).map {|it| Regexp.escape(Rack::Utils.unescape(it)) }.join('|') })(?:\||$)} json = JSON.generate( match ? metrics.select {|k,v| k =~ match} : metrics) [200, {'Content-Type' => 'text/json'}, [json]] }) return nil
Version data entries
9 entries across 9 versions & 1 rubygems