class Riffer::Config::Metrics
Metrics-related global configuration, independent of config.tracing so a host can run one signal without the other.
Attributes
The backend riffer routes measurements through; defaults to nil, a no-op. Riffer auto-detects no backend; assigning one is opt-in.
Whether riffer records OTEL metric instruments; defaults to true, a no-op until a host wires an OTEL metrics SDK.
Public Class Methods
Source
# File lib/riffer/config.rb, line 122 def initialize @enabled = true @backend = nil end
Public Instance Methods
Source
# File lib/riffer/config.rb, line 141 def backend=(value) unless value.nil? || value.respond_to?(:record_histogram) raise Riffer::ArgumentError, "metrics backend must respond to #record_histogram" end @backend = value Riffer::Metrics.reset! end
Sets the metrics backend riffer routes measurements through. Raises Riffer::ArgumentError unless the value is nil or responds to record_histogram.
Source
# File lib/riffer/config.rb, line 132 def enabled=(value) @enabled = Riffer::Helpers::Boolean.coerce(value, attribute: "enabled") end
Sets the enabled flag, coercing boolean-ish values so an env-var +โfalseโ+ (truthy in Ruby) doesnโt silently keep metrics on. Raises Riffer::ArgumentError on an unrecognized value.