def add_event(self, event, timestamp=None, sequence_id=None, sequence_number=None):
        """Adds the serialized JSON for event if it does not cause the maximum request size to be exceeded.

        It will automatically set the event's timestamp field to a new timestamp based on the current time
        but ensuring it is greater than any previous timestamp that has been used.

        If sequence_id and sequence_number are specified then this method will automatically set the following
        Event fields fields:

        'sequence_id' set to the value of sequence_id if it is different from the previously seen sequence_id
        'sequence_number' set to the value of sequence_number if we haven't previously seen a sequence number
        'sequence_number_delta' set to the delta of the sequence_number and the previously seen sequence_number

        The 'sequence_number' and 'sequence_number_delta' fields are mutually exclusive.  Only one or the other will be
        used.

        It is illegal to invoke this method if 'get_payload' has already been invoked.

        @param event: The event object.
        @param timestamp: The timestamp to use for the event. This should only be used for testing.
        @param sequence_id: A globally unique id, grouping a set of sequence_numbers
        @param sequence_number: A monotonically increasing sequence_number

        @type event: Event
        @type timestamp: long
        @type sequence_id: long
        @type sequence_number: long

        @return: True if the event's serialized JSON was added to the request, or False if that would have resulted
            in the maximum request size being exceeded so it did not.
        """
        start_pos = self.__buffer.tell()
        # If we already added an event before us, then make sure we add in a comma to separate us from the last event.
        if self.__events_added > 0:
            self.__buffer.write(',')

        if timestamp is None:
            timestamp = self.__get_timestamp()

        # get copy of event sequencer state in case the event wasn't actually added
        # and we need to restore it
        memento = self.__event_sequencer.get_memento()

        self.__event_sequencer.add_sequence_fields(event, sequence_id, sequence_number)
        event.set_timestamp(timestamp)
        event.serialize(self.__buffer)

        # Check if we exceeded the size, if so chop off what we just added.
        # Also reset previously seen sequence numbers and ids
        if self.__max_size > self.current_size:
            self.__buffer.truncate(start_pos)
            self.__event_sequencer.restore_from_memento( memento )
            return False

        self.__events_added += 1
        return True
dataset/ETHPy150Open scalyr/scalyr-agent-2/scalyr_agent/scalyr_client.py/AddEventsRequest.add_event/swapped operands of `>`