module Invoca::Metrics::Source::ClassMethods
Public Instance Methods
declare_metrics(&block)
click to toggle source
# File lib/invoca/metrics.rb, line 91 def declare_metrics(&block) dsl = Invoca::Metrics::Prometheus::DeclareMetrics::Dsl.new(self) dsl.instance_eval(&block) dsl.declared_metrics.each do |metric| Invoca::Metrics::Prometheus.metrics.register(metric) end end
metrics()
click to toggle source
# File lib/invoca/metrics.rb, line 77 def metrics metrics_for(config_key: Invoca::Metrics.default_config_key) end
metrics_for(config_key:, namespace: nil)
click to toggle source
# File lib/invoca/metrics.rb, line 81 def metrics_for(config_key:, namespace: nil) config_from_key = Invoca::Metrics.config[config_key] || {} metrics_config = if (effective_namespace = namespace || @metrics_namespace) config_from_key.merge(namespace: effective_namespace) else config_from_key end Client.metrics(**Invoca::Metrics.default_client_config.merge(metrics_config)) end
metrics_namespace(namespace)
click to toggle source
# File lib/invoca/metrics.rb, line 73 def metrics_namespace(namespace) @metrics_namespace = namespace end
prometheus_metrics()
click to toggle source
# File lib/invoca/metrics.rb, line 99 def prometheus_metrics Invoca::Metrics::Prometheus.metrics end