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

DEPLOY_EVENT =
"deploy"
FEATURE_EVENT =
"feature"
PROVISION_EVENT =
"provision"
REFRESH_EVENT =
"refresh"
SUPPORTED_TYPES =
[
  DEPLOY_EVENT,
  FEATURE_EVENT,
  PROVISION_EVENT,
  REFRESH_EVENT
].freeze

Instance Method Summary collapse

Instance Method Details

#data_dog?Boolean

Returns:

  • (Boolean)


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

def data_dog?; end

#dog_tagsObject



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

def dog_tags; end

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

This end point allows you to post events to the DataDog 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

  • description (String)

    Event description. Supports newlines (\n)

  • :type. (String, nil)

    It is recommended to use the constants

  • :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”.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/inst_statsd/event.rb', line 72

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

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

#instanceObject



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

def instance; end