Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event support in dogstatsd #532

Merged
merged 4 commits into from
Jul 31, 2013
Merged

Event support in dogstatsd #532

merged 4 commits into from
Jul 31, 2013

Conversation

LotharSee
Copy link
Contributor

This PR allow DogStatsD to send events.

The event syntax is like this:
_e{title_length,body_length}:title|body|p:priority|k:aggregation_key|t:alert_type|s:source_type_name|d:date_happened|h:hostname|#tag1,tag2
Some details:

  • Only title and body are required, others are optional, order doesn't matter
  • title and body length are computed based on the utf-8 length. (it allows to use "|" in the title and the body).
  • New lines are replaced by two characters "\n". Which mean a "\n" in the body will be rendered as a new line.

Exemple:
_e{8,21}My title:The world is burning!|h:my_computer|#danger,on_fire

I need some review about this protocol modification before adding it everywhere (documentation, librairies, dogstatsd client in the agent, ...).

One last thing: for now, events are sent one by one. I have two solutions to fix it:

  • Update our API to allow multiple events
  • Use the same endpoint as the agent
    What's the best?

@alq666
Copy link
Member

alq666 commented Jun 10, 2013

@LotharSee works as-is with python 2.4?

@LotharSee
Copy link
Contributor Author

Not tested yet, I will.
(It should be fine, I am not using Python 2.4+ functions).

@conorbranagan
Copy link
Member

Maybe a dumb question, but is there a max size of these packets? Can you write an event that's too big to fit into one packet?

@LotharSee
Copy link
Contributor Author

Yeah the maximum size is 8K.

I will add a limit in the dogstatsd client.
For the server, there is nothing specific that we can do. The truncated content may create a truncated event or be skipped if it doesn't respect the protocol.

@elijahandrews
Copy link
Contributor

@LotharSee What's the status of this? Should it go in 3.8.0 (the release I'm building this week)?

@LotharSee
Copy link
Contributor Author

I prefer to keep it away form this release.
This PR is here to facilitate reviews, I won't merge it until it is really useful (I guess after the 3.8.0).

meta = metadata[title_length+text_length+1:]
for m in meta.split('|')[1:]:
if m[0] == u't':
event['alert_type'] = m[2:]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to avoid hard coding these keys and just pass along keys to the server which would do the validation? Having these on the client side makes it difficult to change them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants