module PrometheusExporter
Constants
- DEFAULT_BIND_ADDRESS
- DEFAULT_LABEL
- DEFAULT_PORT
per: github.com/prometheus/prometheus/wiki/Default-port-allocations
- DEFAULT_PREFIX
- DEFAULT_REALM
- DEFAULT_TIMEOUT
- VERSION
Public Class Methods
detect_json_serializer(preferred)
click to toggle source
# File lib/prometheus_exporter.rb, line 36 def self.detect_json_serializer(preferred) if preferred.nil? preferred = :oj if has_oj? end preferred == :oj ? OjCompat : JSON end
has_oj?()
click to toggle source
# File lib/prometheus_exporter.rb, line 45 def self.has_oj? ( @@has_oj ||= begin require 'oj' :true rescue LoadError :false end ) == :true end
hostname()
click to toggle source
# File lib/prometheus_exporter.rb, line 25 def self.hostname @hostname ||= begin require 'socket' Socket.gethostname rescue => e STDERR.puts "Unable to lookup hostname #{e}" "unknown-host" end end