Class: Tiler::Widgets::Metric

Inherits:
Tiler::Widget show all
Defined in:
lib/tiler/widgets/metric.rb

Instance Attribute Summary

Attributes inherited from Tiler::Widget

#config, #panel

Class Method Summary collapse

Methods inherited from Tiler::Widget

#data, #empty?, #initialize, #label, #partial, #query_class, supports_color_config?, supports_palette_config?

Constructor Details

This class inherits a constructor from Tiler::Widget

Class Method Details

.example_configObject

Defer to Tiler::Widget#empty? — empty when no data_source AND no preview.



30
31
32
33
# File 'lib/tiler/widgets/metric.rb', line 30

def self.example_config
  { "aggregation" => "avg", "value_column" => "duration",
    "time_window" => "24h", "suffix" => "ms" }
end

.example_payloadObject



35
36
37
# File 'lib/tiler/widgets/metric.rb', line 35

def self.example_payload
  { "status" => "ok", "duration" => 142.3 }
end

.example_previewObject



39
40
41
42
43
# File 'lib/tiler/widgets/metric.rb', line 39

def self.example_preview
  { "value" => 142, "label" => "Sample metric",
    "prefix" => "", "suffix" => "ms",
    "aggregation" => "avg", "time_window" => "24h" }
end