Sha256: 8a4c80afacbfaa3b7063422a74c160ea92ba5a43879d66bbe45bb8c4b163b245
Contents?: true
Size: 856 Bytes
Versions: 9
Compression:
Stored size: 856 Bytes
Contents
module SnowmanIO class Metric include Mongoid::Document include Mongoid::Timestamps belongs_to :app has_many :checks, dependent: :destroy has_many :data_points, dependent: :destroy has_many :aggregations, dependent: :destroy KIND_AMOUNT = "amount" KIND_COUNTER = "counter" KIND_TIME = "time" field :name, type: String field :kind, type: String field :last_value, type: Float field :last_value_updated_at, type: DateTime def self.supported?(kind) kind.in? [ KIND_AMOUNT, KIND_COUNTER, KIND_TIME ] end def as_json(options = {}) super(options.merge(methods: [:check_ids])).tap do |o| o["id"] = o.delete("_id").to_s o["app_id"] = o["app_id"].to_s o["check_ids"] = o["check_ids"].map(&:to_s) end end end end
Version data entries
9 entries across 9 versions & 1 rubygems