Class: Speedshop::Cloudwatch::MetricMapper

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/speedshop/cloudwatch/metric_mapper.rb

Overview

Maps this gem’s built-in metric families in METRICS to CloudWatch datums. The Yabeda adapter bypasses this class and builds datums directly because Yabeda metrics are dynamic and don’t need to be present in METRICS.

Instance Method Summary collapse

Instance Method Details

#report(metric:, value: nil, statistic_values: nil, dimensions: {}, integration: nil) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/speedshop/cloudwatch/metric_mapper.rb', line 14

def report(metric:, value: nil, statistic_values: nil, dimensions: {}, integration: nil)
  return unless config.environment_enabled?

  metric_name = metric.to_sym
  resolved_integration = integration || find_integration_for_metric(metric_name)
  return unless resolved_integration
  return unless metric_allowed?(resolved_integration, metric_name)

  Reporter.instance.enqueue(build_datum(
    metric_name: metric_name,
    integration: resolved_integration,
    value: value,
    statistic_values: statistic_values,
    dimensions: dimensions
  ))
end