forked from DataDog/datadogpy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevents.py
More file actions
27 lines (21 loc) · 713 Bytes
/
events.py
File metadata and controls
27 lines (21 loc) · 713 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2015-Present Datadog, Inc
"""
Event aggregator class.
"""
from datadog.util.compat import iteritems
class EventsAggregator(object):
"""
A simple event aggregator
"""
def __init__(self):
self._events = []
def add_event(self, **event):
# Clean empty values
event = dict((k, v) for k, v in iteritems(event) if v is not None)
self._events.append(event)
def flush(self):
events = self._events
self._events = []
return events