Module: InstStatsd::Event

Included in:
Statsd
Defined in:
lib/inst_statsd/event.rb

Overview

Mix-in methods for supporting DataDog events See docs.datadoghq.com/service_management/events/

Constant Summary collapse

SUPPORTED_TYPES =
%i[
  deploy
  feature_disabled
  feature_enabled
  provision
  refresh
].freeze

Instance Method Summary collapse

Instance Method Details

#data_dog?Boolean

Returns:

  • (Boolean)


16
# File 'lib/inst_statsd/event.rb', line 16

def data_dog?; end

#dog_tagsObject



17
# File 'lib/inst_statsd/event.rb', line 17

def dog_tags; end

#event(title, text, type: nil, tags: {}, alert_type: nil, priority: nil, date_happened: nil) ⇒ Object

This end point allows you to post events to the DatDog event stream.

Examples:

Report an event:

InstStatsd::Statsd.event(
    "Quiz API Deploy",
    "<release> was deployed to Quiz API",
    tags: {foo: 'bar'},
    type: 'deploy',
    alert_type: :success
)

Parameters:

  • title (String)

    Event title

  • text (String)

    Event text. Supports newlines (\n)

  • :type (String, nil)

    Can be “deploy”, “feature_disabled”, “feature_enabled”, “provision”, or “refresh”

  • :tags (Hash)

    tags to be added to event. Note that the environment, service, and other data are automatically added as tags for you without specifying them here.

  • :date_happened (Integer, String, nil)

    (nil) Assign a timestamp to the event. Default is now when none

  • :priority (String, nil)

    (‘normal’) Can be “normal” or “low”

  • :alert_type (String, nil)

    (‘info’) Can be “error”, “warning”, “info” or “success”.



41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/inst_statsd/event.rb', line 41

def event(title, text, type: nil, tags: {}, alert_type: nil, priority: nil, date_happened: nil)
  return unless instance && data_dog?

  instance.event(
    title,
    text,
    **{
      alert_type: alert_type,
      priority: priority,
      date_happened: date_happened,
      tags: tags_from_opts(tags, type, dog_tags)
    }.compact
  )
end

#instanceObject



15
# File 'lib/inst_statsd/event.rb', line 15

def instance; end