Method: Wavefront::Validators#wf_event_id?

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

#wf_event_id?(id) ⇒ Boolean

Ensure the given argument is a valid event ID. Event IDs are an epoch-millisecond timestamp followed by a : followed by the name of the event.

Parameters:

  • id (String)

    the event ID to validate

Returns:

  • (Boolean)

    true if the event ID is valid

Raises:

  • Wavefront::Exception::InvalidEventID if the event ID is not valid



287
288
289
290
291
# File 'lib/wavefront-sdk/validators.rb', line 287

def wf_event_id?(id)
  return true if id.is_a?(String) && id =~ /^\d{13}:.+/

  raise Wavefront::Exception::InvalidEventId, id
end