Exemplo n.º 1
0
        except KeyError:
            delete.append(k)
        OVERRIDE_OPTIONS[k] = v

    try:
        yield
    finally:
        for k, v in previous.items():
            OVERRIDE_OPTIONS[k] = v
        for k in delete:
            OVERRIDE_OPTIONS.pop(k)


_snuba_pool = connection_from_url(
    settings.SENTRY_SNUBA,
    retries=5,
    timeout=30,
    maxsize=10,
)


epoch_naive = datetime(1970, 1, 1, tzinfo=None)


def to_naive_timestamp(value):
    """
    Convert a time zone aware datetime to a POSIX timestamp (with fractional
    component.)
    """
    return (value - epoch_naive).total_seconds()

Exemplo n.º 2
0
    try:
        yield
    finally:
        for k, v in previous.items():
            OVERRIDE_OPTIONS[k] = v
        for k in delete:
            OVERRIDE_OPTIONS.pop(k)


_snuba_pool = connection_from_url(
    settings.SENTRY_SNUBA,
    retries=urllib3.Retry(
        total=5,
        # Expand our retries to POST since all of
        # our requests are POST and they don't mutate, so they
        # are safe to retry. Without this, we aren't
        # actually retrying at all.
        method_whitelist={"GET", "POST"},
    ),
    timeout=30,
    maxsize=10,
)
_query_thread_pool = ThreadPoolExecutor(max_workers=10)

epoch_naive = datetime(1970, 1, 1, tzinfo=None)


def to_naive_timestamp(value):
    """
    Convert a time zone aware datetime to a POSIX timestamp (with fractional
    component.)
Exemplo n.º 3
0
            method=method,
            url=url,
            response=response,
            error=error,
            _pool=_pool,
            _stacktrace=_stacktrace,
        )


_snuba_pool = connection_from_url(
    settings.SENTRY_SNUBA,
    retries=RetrySkipTimeout(
        total=5,
        # Our calls to snuba frequently fail due to network issues. We want to
        # automatically retry most requests. Some of our POSTs and all of our DELETEs
        # do cause mutations, but we have other things in place to handle duplicate
        # mutations.
        method_whitelist={"GET", "POST", "DELETE"},
    ),
    timeout=30,
    maxsize=10,
)
_query_thread_pool = ThreadPoolExecutor(max_workers=10)


epoch_naive = datetime(1970, 1, 1, tzinfo=None)


def to_naive_timestamp(value):
    """
    Convert a time zone aware datetime to a POSIX timestamp (with fractional
Exemplo n.º 4
0
        except KeyError:
            delete.append(k)
        OVERRIDE_OPTIONS[k] = v

    try:
        yield
    finally:
        for k, v in previous.items():
            OVERRIDE_OPTIONS[k] = v
        for k in delete:
            OVERRIDE_OPTIONS.pop(k)


_snuba_pool = connection_from_url(
    settings.SENTRY_SNUBA,
    retries=5,
    timeout=30,
    maxsize=10,
)

epoch_naive = datetime(1970, 1, 1, tzinfo=None)


def to_naive_timestamp(value):
    """
    Convert a time zone aware datetime to a POSIX timestamp (with fractional
    component.)
    """
    return (value - epoch_naive).total_seconds()


def zerofill(data, start, end, rollup, orderby):