Class: DatadogCompoundMetrics

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog_compound_metrics.rb,
lib/datadog_compound_metrics/version.rb,
lib/datadog_compound_metrics/configuration.rb,
lib/datadog_compound_metrics/compound_metric.rb,
lib/datadog_compound_metrics/compound_metrics_worker.rb

Defined Under Namespace

Modules: Version Classes: CompoundMetric, CompoundMetricsWorker, Configuration

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.add_compound_metric(metric_name) {|compound_metric| ... } ⇒ Object

Yields:

  • (compound_metric)


28
29
30
31
32
# File 'lib/datadog_compound_metrics.rb', line 28

def self.add_compound_metric(metric_name)
  compound_metric = DatadogCompoundMetrics::CompoundMetric.new(metric_name)
  yield compound_metric
  compound_metrics << compound_metric
end

.compound_metricsObject



34
35
36
# File 'lib/datadog_compound_metrics.rb', line 34

def self.compound_metrics
  @compound_metrics ||= []
end

.configurationObject



20
21
22
# File 'lib/datadog_compound_metrics.rb', line 20

def self.configuration
  @configuration ||= DatadogCompoundMetrics::Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



24
25
26
# File 'lib/datadog_compound_metrics.rb', line 24

def self.configure
  yield configuration
end

.loaderObject



14
15
16
17
18
# File 'lib/datadog_compound_metrics.rb', line 14

def self.loader
  @loader ||= Zeitwerk::Loader.for_gem.tap do |loader|
    loader.ignore("#{__dir__}/datadog-compound-metrics.rb")
  end
end

.reset_configObject



49
50
51
# File 'lib/datadog_compound_metrics.rb', line 49

def self.reset_config
  @configuration = nil
end

.reset_metricsObject



53
54
55
# File 'lib/datadog_compound_metrics.rb', line 53

def self.reset_metrics
  @compound_metrics = []
end

.schedule_jobObject



38
39
40
41
42
43
44
45
46
47
# File 'lib/datadog_compound_metrics.rb', line 38

def self.schedule_job
  Sidekiq::Cron::Job.create(
    name: "DatadogCompoundMetrics::CompoundMetricsWorker",
    cron: configuration.sidekiq_cron_schedule,
    class: "DatadogCompoundMetrics::CompoundMetricsWorker",
    queue: configuration.sidekiq_queue,
    args: [],
    active_job: false
  )
end