Skip to content

feat(billing): Add UsageService to billing platform#110157

Merged
dashed merged 1 commit intomasterfrom
bil-2144/usage-service
Mar 9, 2026
Merged

feat(billing): Add UsageService to billing platform#110157
dashed merged 1 commit intomasterfrom
bil-2144/usage-service

Conversation

@dashed
Copy link
Copy Markdown
Member

@dashed dashed commented Mar 6, 2026

Summary

Adds the UsageService interface to the billing platform as part of BIL-2144.

  • Introduces UsageService(BillingService) with a get_usage(GetUsageRequest) -> GetUsageResponse method
  • Default implementation returns an empty response; GetSentry will override with Postgres/ClickHouse backends
  • Uses sentry-protos v0.8.3+ protobuf types (GetUsageRequest, GetUsageResponse, DailyUsage, CategoryUsage, etc.)
  • Updates services/README.md with UsageService documentation

Per INTENTION.md, the Usage Service is the one exception that has implementation in the sentry repo (available in both self-hosted and SaaS).

Requires https://github.com/getsentry/getsentry/pull/19515

Follow-up

  • BIL-2145: GetSentry UsageService with Postgres backend + feature flag/date-based routing
  • BIL-2146: Migrate had_custom_dynamic_sampling to use the UsageService

Test plan

  • 6 unit tests covering inheritance, empty response, populated request, input validation, metrics emission, and package re-export
  • All tests passing (pytest tests/sentry/billing/platform/services/usage/test_service.py)
  • Pre-commit hooks passing

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Mar 6, 2026
@linear-code
Copy link
Copy Markdown

linear-code bot commented Mar 6, 2026

Adds the UsageService interface to sentry's billing platform. The default
implementation returns an empty response; GetSentry will override this
with Postgres/ClickHouse backends.
@dashed dashed force-pushed the bil-2144/usage-service branch from 491e81b to e0c442b Compare March 9, 2026 19:04
@dashed dashed marked this pull request as ready for review March 9, 2026 20:38
@dashed dashed requested review from a team and noahsmartin March 9, 2026 20:38
@dashed dashed enabled auto-merge (squash) March 9, 2026 21:23
@dashed dashed merged commit 2fdef93 into master Mar 9, 2026
57 checks passed
@dashed dashed deleted the bil-2144/usage-service branch March 9, 2026 21:39
@github-actions github-actions bot locked and limited conversation to collaborators Mar 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants