Module: PrometheusExporter
- Defined in:
- lib/prometheus_exporter.rb,
lib/prometheus_exporter/client.rb,
lib/prometheus_exporter/version.rb
Defined Under Namespace
Modules: Instrumentation, Metric, Server
Classes: Client, LocalClient, Middleware, OjCompat
Constant Summary
collapse
- DEFAULT_PORT =
9394
- DEFAULT_PREFIX =
'ruby_'
- DEFAULT_TIMEOUT =
2
- VERSION =
"0.4.16"
- @@has_oj =
nil
Class Method Summary
collapse
Class Method Details
.detect_json_serializer(preferred) ⇒ Object
22
23
24
25
26
27
28
|
# File 'lib/prometheus_exporter.rb', line 22
def self.detect_json_serializer(preferred)
if preferred.nil?
preferred = :oj if has_oj?
end
preferred == :oj ? OjCompat : JSON
end
|
.has_oj? ⇒ Boolean
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/prometheus_exporter.rb', line 31
def self.has_oj?
(
@@has_oj ||=
begin
require 'oj'
:true
rescue LoadError
:false
end
) == :true
end
|