コード例 #1
0
def fire_event(event_type, payload=None):
    if config.DISABLE_EVENTS:
        return
    global SENDER_THREAD
    if not SENDER_THREAD:
        SENDER_THREAD = FuncThread(poll_and_send_messages, {})
        SENDER_THREAD.start()
    api_key = read_api_key_safe()
    if not api_key:
        # only store events if API key has been specified
        return
    from localstack.utils.analytics import log
    from localstack.utils.testutil import (  # leave here to avoid circular dependency
        is_local_test_mode,
    )

    if payload is None:
        payload = {}
    if isinstance(payload, dict):
        if is_travis():
            payload["travis"] = True
        if is_local_test_mode():
            payload["int"] = True

    # event = AnalyticsEvent(event_type=event_type, payload=payload, api_key=api_key)
    # EVENT_QUEUE.put_nowait(event) FIXME: remove old logging code entirely before next release
    log.event("legacy", {"event": event_type, "payload": payload})
コード例 #2
0
def fire_event(event_type, payload=None):
    # TODO: replace fire_event calls with analytics.log.event
    if config.DISABLE_EVENTS:
        return

    from localstack.utils.analytics import log

    if payload is None:
        payload = {}
    if isinstance(payload, dict):
        if is_travis():
            payload["travis"] = True
        if config.is_local_test_mode():
            payload["int"] = True

    log.event("legacy", {"event": event_type, "payload": payload})