The alert flavor is the type of alert this is. It allows us to create
a loose grouping of like alerts.

For example, the “mfbt” alert flavor covers all alerts about mfbt.

To get an alert flavor, write up a bug
asking for a flavor to be created. Please state exactly what you’ll be
using the flavor for. You should probably have a token first since
without the token you can’t emit any alerts.

Note

A single token can GET/POST for multiple flavors, so you can write
a single emitter that has a single token and have it generate
alerts of multiple flavors.

importjsonimportrequestsheaders={'content-type':'application/json','accept':'application/json; indent=4','fjord-authorization':'Token cd64de0e6c4c491f90fe1d362104c1e5',}payload={'severity':5,'summary':'mfbt now!','description':'it is 4:00pm on a friday and it is mfbt.','flavor':'mfbt','emitter_name':'mfbt-watcher','emitter_version':1,'start_time':'2015-02-28T07:22:48Z','links':[{'name':'example','url':'http://example.com'}]}resp=requests.post('https://input.mozilla.org/api/v1/alerts/alert/',data=json.dumps(payload),headers=headers)printresp.status_code# 201printresp.json()# something like {u'detail': {u'id': 4}}

These fields are required and have no defaults. If you do not provide
them, then you’ll get back an HTTP 400 with a message stating you
missed a required field.

field

type

notes

severity

integer

This is the severity of the alert. 0 = don’t care. 10 =
call the president.

summary

string

Brief summary of what the alert is about.

description

string

Involved description of all the details that help you
understand what this alert is about.

You can make this a JSON encoded field if you have lots
of key/value pairs you want to include.

flavor

string

The slug of the flavor this alert is for.

emitter_name

string

Max length: 100.

The name of the emitter that created this alert. It
could be a script name. It could be a sekret code-name
for the emitter. It could be skynet. So long as we can
distinguish it from other emitters, it’s all good.

emitter_version

integer

Start with 0.

Any time you change the shape of the data you’re
emitting or the kind of data you’re emitting in
the alert, you should increase the version number.

This helps you distinguish between the different
versions of alerts that you’ve pushed so far so that
you can parse them differently when you’re setting up
dashboards or reports about your alerts.