Class: Kirei::Logging::Metric
- Inherits:
-
Object
- Object
- Kirei::Logging::Metric
- Extended by:
- T::Sig
- Defined in:
- lib/kirei/logging/metric.rb
Class Method Summary collapse
Class Method Details
.call(metric_name, value = 1, tags: {}) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/kirei/logging/metric.rb', line 16 def self.call(metric_name, value = 1, tags: {}) return if ENV["NO_METRICS"] == "true" inject_defaults() # Do not `compact_blank` tags, since one might want to track empty strings/"false"/NULLs. # NOT having any tag doesn't tell the user if the tag was empty or not set at all. StatsD.increment(metric_name, value, tags: ) end |
.inject_defaults(tags) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/kirei/logging/metric.rb', line 27 def self.inject_defaults() App.config..each_pair do |key, default_value| [key] ||= default_value end ["enduser.id"] ||= Thread.current[:enduser_id] ["service.name"] ||= Kirei::App.config.app_name # OpenTelemetry::SemanticConventions::Resource::SERVICE_NAME ["service.version"] = Kirei::App.version # OpenTelemetry::SemanticConventions::Resource::SERVICE_VERSION end |