Skip to content

ref: Add last_usage_ts to usage service#115353

Open
noahsmartin wants to merge 1 commit into
masterfrom
usageServiceMaxTs
Open

ref: Add last_usage_ts to usage service#115353
noahsmartin wants to merge 1 commit into
masterfrom
usageServiceMaxTs

Conversation

@noahsmartin
Copy link
Copy Markdown
Contributor

Add the max ts of recorded usage to the usage service response

@noahsmartin noahsmartin requested a review from a team as a code owner May 12, 2026 00:52
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label May 12, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Backend Test Failures

Failures on 8d11aab in this run:

tests/sentry/billing/platform/services/usage/test_outcomes_query.py::TestQueryOutcomesUsage::test_query_returns_responselog
[gw1] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/billing/platform/services/usage/test_outcomes_query.py:362: in test_query_returns_response
    response = query_outcomes_usage(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/billing/platform/services/usage/_outcomes_query.py:87: in query_outcomes_usage
    return _build_response(rows, last_usage_ts)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/billing/platform/services/usage/_outcomes_query.py:215: in _build_response
    response.last_usage_ts.FromDatetime(last_usage_ts)
    ^^^^^^^^^^^^^^^^^^^^^^
E   AttributeError: last_usage_ts
tests/snuba/billing/platform/services/usage/test_outcomes_integration.py::TestOutcomesIntegration::test_accepted_errorslog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/snuba/billing/platform/services/usage/test_outcomes_integration.py:61: in test_accepted_errors
    response = query_outcomes_usage(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/billing/platform/services/usage/_outcomes_query.py:87: in query_outcomes_usage
    return _build_response(rows, last_usage_ts)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/billing/platform/services/usage/_outcomes_query.py:215: in _build_response
    response.last_usage_ts.FromDatetime(last_usage_ts)
    ^^^^^^^^^^^^^^^^^^^^^^
E   AttributeError: last_usage_ts
tests/snuba/billing/platform/services/usage/test_outcomes_integration.py::TestOutcomesIntegration::test_category_filterlog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/snuba/billing/platform/services/usage/test_outcomes_integration.py:312: in test_category_filter
    response = query_outcomes_usage(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/billing/platform/services/usage/_outcomes_query.py:87: in query_outcomes_usage
    return _build_response(rows, last_usage_ts)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/billing/platform/services/usage/_outcomes_query.py:215: in _build_response
    response.last_usage_ts.FromDatetime(last_usage_ts)
    ^^^^^^^^^^^^^^^^^^^^^^
E   AttributeError: last_usage_ts
tests/snuba/billing/platform/services/usage/test_outcomes_integration.py::TestOutcomesIntegration::test_category_filter_proto_to_relay_conversionlog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/snuba/billing/platform/services/usage/test_outcomes_integration.py:355: in test_category_filter_proto_to_relay_conversion
    response = query_outcomes_usage(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/billing/platform/services/usage/_outcomes_query.py:87: in query_outcomes_usage
    return _build_response(rows, last_usage_ts)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/billing/platform/services/usage/_outcomes_query.py:215: in _build_response
    response.last_usage_ts.FromDatetime(last_usage_ts)
    ^^^^^^^^^^^^^^^^^^^^^^
E   AttributeError: last_usage_ts
tests/snuba/billing/platform/services/usage/test_outcomes_integration.py::TestOutcomesIntegration::test_end_date_inclusivelog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/snuba/billing/platform/services/usage/test_outcomes_integration.py:275: in test_end_date_inclusive
    response = query_outcomes_usage(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/billing/platform/services/usage/_outcomes_query.py:87: in query_outcomes_usage
    return _build_response(rows, last_usage_ts)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/billing/platform/services/usage/_outcomes_query.py:215: in _build_response
    response.last_usage_ts.FromDatetime(last_usage_ts)
    ^^^^^^^^^^^^^^^^^^^^^^
E   AttributeError: last_usage_ts
tests/snuba/billing/platform/services/usage/test_outcomes_integration.py::TestOutcomesIntegration::test_filtered_dynamic_samplinglog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/snuba/billing/platform/services/usage/test_outcomes_integration.py:152: in test_filtered_dynamic_sampling
    response = query_outcomes_usage(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/billing/platform/services/usage/_outcomes_query.py:87: in query_outcomes_usage
    return _build_response(rows, last_usage_ts)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/billing/platform/services/usage/_outcomes_query.py:215: in _build_response
    response.last_usage_ts.FromDatetime(last_usage_ts)
    ^^^^^^^^^^^^^^^^^^^^^^
E   AttributeError: last_usage_ts
tests/snuba/billing/platform/services/usage/test_outcomes_integration.py::TestOutcomesIntegration::test_full_usage_service_e2elog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/snuba/billing/platform/services/usage/test_outcomes_integration.py:447: in test_full_usage_service_e2e
    response = UsageService().get_usage(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/billing/platform/core/service.py:103: in wrapper
    result = func(self, request)
             ^^^^^^^^^^^^^^^^^^^
src/sentry/billing/platform/services/usage/service.py:22: in get_usage
    return query_outcomes_usage(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/billing/platform/services/usage/_outcomes_query.py:87: in query_outcomes_usage
    return _build_response(rows, last_usage_ts)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/billing/platform/services/usage/_outcomes_query.py:215: in _build_response
    response.last_usage_ts.FromDatetime(last_usage_ts)
    ^^^^^^^^^^^^^^^^^^^^^^
E   AttributeError: last_usage_ts
tests/snuba/billing/platform/services/usage/test_outcomes_integration.py::TestOutcomesIntegration::test_multiple_days_and_categorieslog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/snuba/billing/platform/services/usage/test_outcomes_integration.py:209: in test_multiple_days_and_categories
    response = query_outcomes_usage(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/billing/platform/services/usage/_outcomes_query.py:87: in query_outcomes_usage
    return _build_response(rows, last_usage_ts)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/billing/platform/services/usage/_outcomes_query.py:215: in _build_response
    response.last_usage_ts.FromDatetime(last_usage_ts)
    ^^^^^^^^^^^^^^^^^^^^^^
E   AttributeError: last_usage_ts
tests/snuba/billing/platform/services/usage/test_outcomes_integration.py::TestOutcomesIntegration::test_overlapping_semanticslog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/snuba/billing/platform/services/usage/test_outcomes_integration.py:407: in test_overlapping_semantics
    response = query_outcomes_usage(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/billing/platform/services/usage/_outcomes_query.py:87: in query_outcomes_usage
    return _build_response(rows, last_usage_ts)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/billing/platform/services/usage/_outcomes_query.py:215: in _build_response
    response.last_usage_ts.FromDatetime(last_usage_ts)
    ^^^^^^^^^^^^^^^^^^^^^^
E   AttributeError: last_usage_ts
tests/snuba/billing/platform/services/usage/test_outcomes_integration.py::TestOutcomesIntegration::test_rate_limited_over_quotalog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/snuba/billing/platform/services/usage/test_outcomes_integration.py:95: in test_rate_limited_over_quota
    response = query_outcomes_usage(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/billing/platform/services/usage/_outcomes_query.py:87: in query_outcomes_usage
    return _build_response(rows, last_usage_ts)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/billing/platform/services/usage/_outcomes_query.py:215: in _build_response
    response.last_usage_ts.FromDatetime(last_usage_ts)
    ^^^^^^^^^^^^^^^^^^^^^^
E   AttributeError: last_usage_ts
tests/snuba/billing/platform/services/usage/test_outcomes_integration.py::TestOutcomesIntegration::test_rate_limited_spike_protectionlog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/snuba/billing/platform/services/usage/test_outcomes_integration.py:124: in test_rate_limited_spike_protection
    response = query_outcomes_usage(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/billing/platform/services/usage/_outcomes_query.py:87: in query_outcomes_usage
    return _build_response(rows, last_usage_ts)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/sentry/billing/platform/services/usage/_outcomes_query.py:215: in _build_response
    response.last_usage_ts.FromDatetime(last_usage_ts)
    ^^^^^^^^^^^^^^^^^^^^^^
E   AttributeError: last_usage_ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants