Exemple #1
0
 def new_event(self):
     '''creates a new event from this builder, inheriting all fields and
        dynamic fields present in the builder'''
     ev = Event(fields=self._fields, client=self.client)
     ev.writekey = self.writekey
     ev.dataset = self.dataset
     ev.api_host = self.api_host
     ev.sample_rate = self.sample_rate
     return ev
Exemple #2
0
def send_now(data):
    '''
    DEPRECATED - This will likely be removed in a future major version.

    Creates an event with the data passed in and enqueues it to be sent.
    Contrary to the name, it does not block the application when called.

    Shorthand for:

        ev = libhoney.Event()
        ev.add(data)
        ev.send()
    '''
    if state.G_CLIENT is None:
        state.warn_uninitialized()
        return
    ev = Event(client=state.G_CLIENT)
    ev.add(data)
    ev.send()
Exemple #3
0
 def new_event(self):
     '''creates a new event from this builder, inheriting all fields and
        dynamic fields present in the builder'''
     ev = Event(fields=self._fields, client=self.client)
     ev.writekey = self.writekey
     ev.dataset = self.dataset
     ev.api_host = self.api_host
     ev.sample_rate = self.sample_rate
     return ev
def send_now(data):
    '''creates an event with the data passed in and sends it immediately.

    Shorthand for:

        ev = Event()
        ev.add(data)
        ev.send()
   '''
    if state.G_CLIENT is None:
        state.warn_uninitialized()
        return
    ev = Event(client=state.G_CLIENT)
    ev.add(data)
    ev.send()
Exemple #5
0
def send_now(data):
    '''
    DEPRECATED - This will likely be removed in a future major version.

    Creates an event with the data passed in and enqueues it to be sent.
    Contrary to the name, it does not block the application when called.

    Shorthand for:

        ev = Event()
        ev.add(data)
        ev.send()
    '''
    if state.G_CLIENT is None:
        state.warn_uninitialized()
        return
    ev = Event(client=state.G_CLIENT)
    ev.add(data)
    ev.send()
Exemple #6
0
 def new_event(self, data={}):
     '''Return an Event, initialized to be sent with this client'''
     ev = Event(data=data, client=self)
     return ev
Exemple #7
0
def new_event(data={}):
    ''' Creates a new event with the default client. If libhoney has not been
    initialized, sending this event will be a no-op.
    '''
    return Event(data=data, client=state.G_CLIENT)