Method: Wavefront::Validators#wf_derivedmetric_id?

Defined in:
lib/wavefront-sdk/validators.rb

#wf_derivedmetric_id?(id) ⇒ Boolean

Ensure the given argument is a valid derived metric ID. IDs are the millisecond epoch timestamp at which the derived metric was created.

Parameters:

Returns:

  • (Boolean)

    True if the ID is valid

Raises:

  • Wavefront::Exception::InvalidDerivedMetricId



271
272
273
274
275
276
# File 'lib/wavefront-sdk/validators.rb', line 271

def wf_derivedmetric_id?(id)
  id = id.to_s if id.is_a?(Numeric)
  return true if id.is_a?(String) && id =~ /^\d{13}$/

  raise Wavefront::Exception::InvalidDerivedMetricId, id
end