Esempio n. 1
0
def safe_send_event(data):
    project = data.pop("project")
    # TODO: make a batched update version of create_sample_event
    try:
        create_sample_event_basic(data, project.id)
        time.sleep(DEFAULT_BACKOFF_TIME)
    except SnubaError:
        # if snuba fails, just back off and continue
        logger.info("safe_send_event.snuba_error")
        time.sleep(ERROR_BACKOFF_TIME)
Esempio n. 2
0
def safe_send_event(data, quick):
    project = data.pop("project")
    config = get_config(quick)
    try:
        create_sample_event_basic(data, project.id)
        time.sleep(config["DEFAULT_BACKOFF_TIME"])
    except SnubaError:
        # if snuba fails, just back off and continue
        logger.info("safe_send_event.snuba_error")
        time.sleep(config["ERROR_BACKOFF_TIME"])
Esempio n. 3
0
    def post(self, request: Request, project) -> Response:
        samples_root = os.path.join(DATA_ROOT, "samples")
        with open(os.path.join(samples_root, get_json_name(project))) as fp:
            data = json.load(fp)

        data = fix_event_data(data)
        event = create_sample_event_basic(data,
                                          project.id,
                                          raw=True,
                                          skip_send_first_transaction=True)

        data = serialize(event, request.user)
        return Response(data)