Skip to content

feat: add queryTeamUsageStats API for multi-tenant metrics#236

Open
daksh-r wants to merge 2 commits intomainfrom
feat/add-query-team-usage-stats-api
Open

feat: add queryTeamUsageStats API for multi-tenant metrics#236
daksh-r wants to merge 2 commits intomainfrom
feat/add-query-team-usage-stats-api

Conversation

@daksh-r
Copy link
Contributor

@daksh-r daksh-r commented Feb 12, 2026

Submit a pull request

CLA

  • I have signed the Stream CLA (required).
  • The code changes follow best practices
  • Code changes are tested (add some information if not applicable)

Description of the pull request

Summary

  • Add queryTeamUsageStats() method to query team-level usage statistics from the warehouse database
  • Returns all 16 metrics grouped by team with cursor-based pagination
  • Supports monthly aggregation (month param) or daily breakdown (start_date/end_date params)

Changes

  • TeamUsageStats.java - Model classes and request builder
  • StatsService.java - Retrofit service interface
  • TeamUsageStatsTest.java - Integration tests

Test plan

  • Test with default options
  • Test with month parameter
  • Test with date range
  • Test pagination
  • Verify response structure with all 16 metrics

Daksh and others added 2 commits February 12, 2026 10:43
Add @JsonInclude(NON_NULL) to prevent Jackson from serializing null
values in the request body, which was causing 404 errors from the API.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@daksh-r daksh-r marked this pull request as ready for review February 12, 2026 10:22
@daksh-r daksh-r changed the title add team usage stats api support feat: add queryTeamUsageStats API for multi-tenant metrics Feb 12, 2026

// Verify response structure
List<TeamUsageStats> teams = response.getTeams();
if (!teams.isEmpty()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the assertions after these will be skipped, so we should create some dummy data to assert the API response completely.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants